Index: chrome/browser/ui/webui/options/core_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc |
index c23abd42ebf2d0fe1e7300a2cc7f2b35912b22c0..2c1a9762a00a5040bdd25b5329430122108b1565 100644 |
--- a/chrome/browser/ui/webui/options/core_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/core_options_handler.cc |
@@ -10,10 +10,12 @@ |
#include "base/string_number_conversions.h" |
#include "base/utf_string_conversions.h" |
#include "base/values.h" |
+#include "chrome/browser/browser_process.h" |
#include "chrome/browser/google/google_util.h" |
#include "chrome/browser/metrics/user_metrics.h" |
#include "chrome/browser/prefs/pref_service.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/common/pref_names.h" |
#include "chrome/common/url_constants.h" |
#include "content/common/notification_details.h" |
#include "content/common/notification_type.h" |
@@ -30,6 +32,13 @@ CoreOptionsHandler::CoreOptionsHandler() |
CoreOptionsHandler::~CoreOptionsHandler() {} |
+void CoreOptionsHandler::Initialize() { |
+ clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, |
+ g_browser_process->local_state(), |
+ this); |
+ UpdateClearPluginLSOData(); |
+} |
+ |
void CoreOptionsHandler::GetLocalizedValues( |
DictionaryValue* localized_strings) { |
DCHECK(localized_strings); |
@@ -89,8 +98,9 @@ WebUIMessageHandler* CoreOptionsHandler::Attach(WebUI* web_ui) { |
void CoreOptionsHandler::Observe(NotificationType type, |
const NotificationSource& source, |
const NotificationDetails& details) { |
- if (type == NotificationType::PREF_CHANGED) |
+ if (type == NotificationType::PREF_CHANGED) { |
Evan Stade
2011/04/15 19:15:11
no curlies for single line if statements
Bernhard Bauer
2011/04/17 13:26:54
Done.
|
NotifyPrefChanged(Details<std::string>(details).ptr()); |
+ } |
} |
void CoreOptionsHandler::RegisterMessages() { |
@@ -341,7 +351,18 @@ void CoreOptionsHandler::HandleUserMetricsAction(const ListValue* args) { |
UserMetricsRecordAction(UserMetricsAction(metric.c_str())); |
} |
+void CoreOptionsHandler::UpdateClearPluginLSOData() { |
+ scoped_ptr<Value> enabled( |
+ Value::CreateBooleanValue(clear_plugin_lso_data_enabled_.GetValue())); |
+ web_ui_->CallJavascriptFunction( |
+ "OptionsPage.setClearPluginLSODataEnabled", *enabled); |
Evan Stade
2011/04/15 19:15:11
I don't think this is necessary. See Preferences.j
Bernhard Bauer
2011/04/17 13:26:54
|clear_plugin_lso_data_enabled_| is bound to local
|
+} |
+ |
void CoreOptionsHandler::NotifyPrefChanged(const std::string* pref_name) { |
+ if (*pref_name == prefs::kClearPluginLSODataEnabled) { |
Evan Stade
2011/04/15 19:15:11
no curlies
Bernhard Bauer
2011/04/17 13:26:54
Done.
|
+ UpdateClearPluginLSOData(); |
+ } |
+ |
PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); |
const PrefService::Preference* pref = |
pref_service->FindPreference(pref_name->c_str()); |