Bug 719434 - Purge session files when clearing history and update about:home accordingly (r=mfinkle)

This commit is contained in:
Lucas Rocha 2012-02-14 17:50:55 +00:00
parent cdf67883cc
commit 61a0b171d9
3 changed files with 18 additions and 0 deletions

View File

@ -205,6 +205,13 @@ public class AboutHomeContent extends ScrollView {
});
}
void setLastTabsVisibility(boolean visible) {
int visibility = visible ? View.VISIBLE : View.GONE;
findViewById(R.id.last_tabs_title).setVisibility(visibility);
findViewById(R.id.last_tabs).setVisibility(visibility);
findViewById(R.id.last_tabs_open_all).setVisibility(visibility);
}
private void setAddonsVisibility(boolean visible) {
int visibility = visible ? View.VISIBLE : View.GONE;
findViewById(R.id.recommended_addons_title).setVisibility(visibility);

View File

@ -67,6 +67,7 @@ class ConfirmPreference extends DialogPreference {
public void run() {
BrowserDB.clearHistory(mContext.getContentResolver());
GeckoApp.mAppContext.mFavicons.clearFavicons();
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("browser:purge-session-history", null));
}
});
} else if ("clear_private_data".equalsIgnoreCase(mAction)) {

View File

@ -1101,6 +1101,14 @@ abstract public class GeckoApp
}
});
}
} else if (event.equals("Session:StatePurged")) {
if (mAboutHomeContent != null) {
mMainHandler.post(new Runnable() {
public void run() {
mAboutHomeContent.setLastTabsVisibility(false);
}
});
}
}
} catch (Exception e) {
Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e);
@ -1818,6 +1826,7 @@ abstract public class GeckoApp
GeckoAppShell.registerGeckoEventListener("CharEncoding:State", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Update:Restart", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Tab:HasTouchListener", GeckoApp.mAppContext);
GeckoAppShell.registerGeckoEventListener("Session:StatePurged", GeckoApp.mAppContext);
mConnectivityFilter = new IntentFilter();
mConnectivityFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
@ -2165,6 +2174,7 @@ abstract public class GeckoApp
GeckoAppShell.unregisterGeckoEventListener("CharEncoding:Data", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("CharEncoding:State", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("Tab:HasTouchListener", GeckoApp.mAppContext);
GeckoAppShell.unregisterGeckoEventListener("Session:StatePurged", GeckoApp.mAppContext);
mFavicons.close();