Bug 697720 - Add 'Clear private data' preference [r=blassey]

This commit is contained in:
Mark Finkle 2011-10-28 00:55:15 -04:00
Родитель baf2ccf966
Коммит 221a346fdf
7 изменённых файлов: 53 добавлений и 50 удалений

Просмотреть файл

@ -36,33 +36,42 @@
* ***** 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");
mContext = context;
super(context, attrs);
mAction = attrs.getAttributeValue(null, "action");
mContext = context;
}
public ConfirmPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mAction = attrs.getAttributeValue(null, "action");
mContext = context;
super(context, attrs, defStyle);
mAction = attrs.getAttributeValue(null, "action");
mContext = context;
}
protected void onDialogClosed(boolean positiveResult) {
if (!positiveResult)
return;
if ("clear_history".equalsIgnoreCase(mAction)) {
GeckoAppShell.getHandler().post(new Runnable(){
public void run() {
Browser.clearHistory(mContext.getContentResolver());
}});
}
Log.i("GeckoPref", "action: " + mAction);
if (!positiveResult)
return;
if ("clear_history".equalsIgnoreCase(mAction)) {
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,12 +37,17 @@
<PreferenceCategory android:title="@string/pref_category_privacy">
<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_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"

Просмотреть файл

@ -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);
@ -467,7 +468,7 @@ var BrowserApp = {
this.selectTab(this.getTabForId(parseInt(aData)));
} else if (aTopic == "Tab:Close") {
this.closeTab(this.getTabForId(parseInt(aData)));
} else if (aTopic == "SaveAs:PDF") {
} else if (aTopic == "SaveAs:PDF") {
this.saveAsPDF(browser);
} else if (aTopic == "Preferences:Get") {
this.getPreferences(aData);
@ -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 ()
{