зеркало из https://github.com/mozilla/gecko-dev.git
Bug 697720 - Add 'Clear private data' preference [r=blassey]
This commit is contained in:
Родитель
baf2ccf966
Коммит
221a346fdf
|
@ -36,14 +36,16 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
import android.preference.*;
|
||||
import android.content.*;
|
||||
import android.util.*;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.DialogPreference;
|
||||
import android.provider.Browser;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
class ConfirmPreference extends DialogPreference {
|
||||
String mAction = null;
|
||||
Context mContext = null;
|
||||
private String mAction = null;
|
||||
private Context mContext = null;
|
||||
public ConfirmPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mAction = attrs.getAttributeValue(null, "action");
|
||||
|
@ -61,7 +63,14 @@ class ConfirmPreference extends DialogPreference {
|
|||
GeckoAppShell.getHandler().post(new Runnable(){
|
||||
public void run() {
|
||||
Browser.clearHistory(mContext.getContentResolver());
|
||||
}});
|
||||
}
|
||||
});
|
||||
} else if ("clear_private_data".equalsIgnoreCase(mAction)) {
|
||||
GeckoAppShell.getHandler().post(new Runnable(){
|
||||
public void run() {
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent("Sanitize:ClearAll", null));
|
||||
}
|
||||
});
|
||||
}
|
||||
Log.i("GeckoPref", "action: " + mAction);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,10 @@
|
|||
<!ENTITY pref_show_images "Show images">
|
||||
<!ENTITY pref_enable_js "Enable JavaScript">
|
||||
<!ENTITY pref_char_encoding "Show character encoding">
|
||||
<!ENTITY pref_clear_history "Clear history">
|
||||
<!ENTITY pref_clear_history_confirm "Browsing history will be deleted">
|
||||
<!ENTITY pref_clear_private_data "Clear private data">
|
||||
<!ENTITY pref_clear_private_data_confirm "Browsing settings, including passwords and cookies, will be deleted">
|
||||
|
||||
<!ENTITY quit "Quit">
|
||||
|
||||
|
@ -61,7 +65,3 @@
|
|||
|
||||
<!ENTITY share "Share">
|
||||
<!ENTITY saveaspdf "Save as PDF">
|
||||
|
||||
<!ENTITY pref_category_history "History">
|
||||
<!ENTITY pref_clear_history "Clear history">
|
||||
<!ENTITY pref_clear_history_confirm "Browsing history will be deleted">
|
||||
|
|
|
@ -37,13 +37,18 @@
|
|||
|
||||
<PreferenceCategory android:title="@string/pref_category_privacy">
|
||||
|
||||
<org.mozilla.gecko.ConfirmPreference
|
||||
android:title="@string/pref_clear_history"
|
||||
<org.mozilla.gecko.ConfirmPreference android:title="@string/pref_clear_history"
|
||||
android:dialogMessage="@string/pref_clear_history_confirm"
|
||||
android:positiveButtonText="@android:string/yes"
|
||||
android:negativeButtonText="@android:string/no"
|
||||
action="clear_history" />
|
||||
|
||||
<org.mozilla.gecko.ConfirmPreference android:title="@string/pref_clear_private_data"
|
||||
android:dialogMessage="@string/pref_clear_private_data_confirm"
|
||||
android:positiveButtonText="@android:string/yes"
|
||||
android:negativeButtonText="@android:string/no"
|
||||
action="clear_private_data" />
|
||||
|
||||
<CheckBoxPreference android:key="privacy.donottrackheader.enabled"
|
||||
android:title="@string/pref_do_not_track"
|
||||
android:defaultValue="false"
|
||||
|
|
|
@ -60,12 +60,12 @@
|
|||
<string name="pref_show_images">&pref_show_images;</string>
|
||||
<string name="pref_enable_js">&pref_enable_js;</string>
|
||||
<string name="pref_char_encoding">&pref_char_encoding;</string>
|
||||
<string name="pref_clear_history">&pref_clear_history;</string>
|
||||
<string name="pref_clear_history_confirm">&pref_clear_history_confirm;</string>
|
||||
<string name="pref_clear_private_data">&pref_clear_private_data;</string>
|
||||
<string name="pref_clear_private_data_confirm">&pref_clear_private_data_confirm;</string>
|
||||
|
||||
<string name="reload">&reload;</string>
|
||||
<string name="new_tab">&new_tab;</string>
|
||||
<string name="pref_category_history">&pref_category_history;</string>
|
||||
<string name="pref_clear_history">&pref_clear_history;</string>
|
||||
<string name="pref_clear_history_confirm">&pref_clear_history_confirm;</string>
|
||||
|
||||
<string name="addons">&addons;</string>
|
||||
</resources>
|
||||
|
|
|
@ -132,6 +132,7 @@ var BrowserApp = {
|
|||
Services.obs.addObserver(this, "Preferences:Get", false);
|
||||
Services.obs.addObserver(this, "Preferences:Set", false);
|
||||
Services.obs.addObserver(this, "ScrollTo:FocusedInput", false);
|
||||
Services.obs.addObserver(this, "Sanitize:ClearAll", false);
|
||||
|
||||
Services.obs.addObserver(XPInstallObserver, "addon-install-blocked", false);
|
||||
Services.obs.addObserver(XPInstallObserver, "addon-install-started", false);
|
||||
|
@ -475,6 +476,8 @@ var BrowserApp = {
|
|||
this.setPreferences(aData);
|
||||
} else if (aTopic == "ScrollTo:FocusedInput") {
|
||||
this.scrollToFocusedInput(browser);
|
||||
} else if (aTopic == "Sanitize:ClearAll") {
|
||||
Sanitizer.sanitize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<script type="application/javascript" src="chrome://browser/content/browser.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/downloads.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/exceptions.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/sanitize.js"/>
|
||||
|
||||
<deck id="browsers" flex="1"/>
|
||||
|
||||
|
|
|
@ -90,21 +90,6 @@ Sanitizer.prototype = {
|
|||
},
|
||||
|
||||
items: {
|
||||
// Clear Sync account before passwords so that Sync still has access to the
|
||||
// credentials to clean up device-specific records on the server. Also
|
||||
// disable it before wiping history so we don't accidentally sync that.
|
||||
syncAccount: {
|
||||
clear: function ()
|
||||
{
|
||||
WeaveGlue.disconnect();
|
||||
},
|
||||
|
||||
get canClear()
|
||||
{
|
||||
return (Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED);
|
||||
}
|
||||
},
|
||||
|
||||
cache: {
|
||||
clear: function ()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче