2 * Copyright (C) 2008 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.browser;
19 import com.android.internal.preference.YesNoPreference;
21 import android.content.Context;
22 import android.util.AttributeSet;
24 class BrowserYesNoPreference extends YesNoPreference {
26 // This is the constructor called by the inflater
27 public BrowserYesNoPreference(Context context, AttributeSet attrs) {
28 super(context, attrs);
32 protected void onDialogClosed(boolean positiveResult) {
33 super.onDialogClosed(positiveResult);
38 Context context = getContext();
39 if (BrowserSettings.PREF_CLEAR_CACHE.equals(getKey())) {
40 BrowserSettings.getInstance().clearCache(context);
41 BrowserSettings.getInstance().clearDatabases(context);
42 } else if (BrowserSettings.PREF_CLEAR_COOKIES.equals(getKey())) {
43 BrowserSettings.getInstance().clearCookies(context);
44 } else if (BrowserSettings.PREF_CLEAR_HISTORY.equals(getKey())) {
45 BrowserSettings.getInstance().clearHistory(context);
46 } else if (BrowserSettings.PREF_CLEAR_FORM_DATA.equals(getKey())) {
47 BrowserSettings.getInstance().clearFormData(context);
48 } else if (BrowserSettings.PREF_CLEAR_PASSWORDS.equals(getKey())) {
49 BrowserSettings.getInstance().clearPasswords(context);
50 } else if (BrowserSettings.PREF_EXTRAS_RESET_DEFAULTS.equals(
52 BrowserSettings.getInstance().resetDefaultPreferences(context);
54 } else if (BrowserSettings.PREF_CLEAR_GEOLOCATION_ACCESS.equals(
56 BrowserSettings.getInstance().clearLocationAccess(context);