Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3446)

Unified Diff: chrome/browser/dom_ui/options/clear_browser_data_handler.cc

Issue 6122008: Also delete plugin data when the cookies checkbox in the clear browsing data dialog is checked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/dom_ui/options/clear_browser_data_handler.cc
diff --git a/chrome/browser/dom_ui/options/clear_browser_data_handler.cc b/chrome/browser/dom_ui/options/clear_browser_data_handler.cc
index e21f7a25d60a20a30090cb58ee1384fce8b6fd7c..24efa730e76ed9d8e17801b1059a004387a7d6b3 100644
--- a/chrome/browser/dom_ui/options/clear_browser_data_handler.cc
+++ b/chrome/browser/dom_ui/options/clear_browser_data_handler.cc
@@ -8,8 +8,10 @@
#include "base/basictypes.h"
#include "base/string16.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/notification_details.h"
#include "chrome/common/pref_names.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -24,6 +26,13 @@ ClearBrowserDataHandler::~ClearBrowserDataHandler() {
}
}
+void ClearBrowserDataHandler::Initialize() {
+ clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
+ g_browser_process->local_state(),
+ this);
+ UpdateClearPluginLSOData();
+}
+
void ClearBrowserDataHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
DCHECK(localized_strings);
@@ -89,6 +98,24 @@ void ClearBrowserDataHandler::RegisterMessages() {
NewCallback(this, &ClearBrowserDataHandler::HandleClearBrowserData));
}
+void ClearBrowserDataHandler::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ switch (type.value) {
+ case NotificationType::PREF_CHANGED: {
+ const std::string& pref_name = *Details<std::string>(details).ptr();
+ if (pref_name == prefs::kClearPluginLSODataEnabled)
+ UpdateClearPluginLSOData();
+ else
+ OptionsPageUIHandler::Observe(type, source, details);
+ break;
+ }
+
+ default:
+ OptionsPageUIHandler::Observe(type, source, details);
+ }
+}
+
void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
Profile* profile = dom_ui_->GetProfile();
PrefService* prefs = profile->GetPrefs();
@@ -100,8 +127,11 @@ void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
remove_mask |= BrowsingDataRemover::REMOVE_DOWNLOADS;
if (prefs->GetBoolean(prefs::kDeleteCache))
remove_mask |= BrowsingDataRemover::REMOVE_CACHE;
- if (prefs->GetBoolean(prefs::kDeleteCookies))
+ if (prefs->GetBoolean(prefs::kDeleteCookies)) {
remove_mask |= BrowsingDataRemover::REMOVE_COOKIES;
+ if (clear_plugin_lso_data_enabled_.GetValue())
+ remove_mask |= BrowsingDataRemover::REMOVE_LSO_DATA;
+ }
if (prefs->GetBoolean(prefs::kDeletePasswords))
remove_mask |= BrowsingDataRemover::REMOVE_PASSWORDS;
if (prefs->GetBoolean(prefs::kDeleteFormData))
@@ -110,7 +140,7 @@ void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
int period_selected = prefs->GetInteger(prefs::kDeleteTimePeriod);
FundamentalValue state(true);
- dom_ui_->CallJavascriptFunction(L"ClearBrowserDataOverlay.setClearingState",
+ dom_ui_->CallJavascriptFunction(L"ClearBrowserDataPage.setClearingState",
state);
// BrowsingDataRemover deletes itself when done.
@@ -121,11 +151,21 @@ void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
remover_->Remove(remove_mask);
}
+void ClearBrowserDataHandler::UpdateClearPluginLSOData() {
+ int label_id = clear_plugin_lso_data_enabled_.GetValue() ?
+ IDS_DEL_COOKIES_FLASH_CHKBOX :
+ IDS_DEL_COOKIES_CHKBOX;
+ scoped_ptr<Value> label(
+ Value::CreateStringValue(l10n_util::GetStringUTF16(label_id)));
+ dom_ui_->CallJavascriptFunction(
+ L"ClearBrowserDataPage.setClearLocalDataLabel", *label);
+}
+
void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() {
// No need to remove ourselves as an observer as BrowsingDataRemover deletes
// itself after we return.
remover_ = NULL;
DCHECK(dom_ui_);
- dom_ui_->CallJavascriptFunction(L"ClearBrowserDataOverlay.dismiss");
+ dom_ui_->CallJavascriptFunction(L"ClearBrowserDataPage.dismiss");
}
« no previous file with comments | « chrome/browser/dom_ui/options/clear_browser_data_handler.h ('k') | chrome/browser/resources/options/clear_browser_data.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698