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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 11348165: Remove PrefObserver usages, batch 10. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 6adbaff077e797b78b43fa27776f21acdae36bf6..b1142408c004fd6f60e26d156fe52873ef0130d2 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -330,14 +330,6 @@ void AppLauncherHandler::Observe(int type,
}
}
-void AppLauncherHandler::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
- DictionaryValue dictionary;
- FillAppDictionary(&dictionary);
- web_ui()->CallJavascriptFunction("ntp.appsPrefChangeCallback",
- dictionary);
-}
-
void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
// CreateAppInfo and ClearOrdinals can change the extension prefs.
AutoReset<bool> auto_reset(&ignore_changes_, true);
@@ -439,10 +431,13 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) {
// First time we get here we set up the observer so that we can tell update
// the apps as they change.
if (!has_loaded_apps_) {
+ base::Closure callback = base::Bind(
+ &AppLauncherHandler::OnPreferencesChanged,
+ base::Unretained(this));
pref_change_registrar_.Init(
extension_service_->extension_prefs()->pref_service());
- pref_change_registrar_.Add(ExtensionPrefs::kExtensionsPref, this);
- pref_change_registrar_.Add(prefs::kNtpAppPageNames, this);
+ pref_change_registrar_.Add(ExtensionPrefs::kExtensionsPref, callback);
+ pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback);
registrar_.Add(this, chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED,
content::Source<Profile>(profile));
@@ -775,6 +770,12 @@ void AppLauncherHandler::SetAppToBeHighlighted() {
highlight_app_id_.clear();
}
+void AppLauncherHandler::OnPreferencesChanged() {
+ DictionaryValue dictionary;
+ FillAppDictionary(&dictionary);
+ web_ui()->CallJavascriptFunction("ntp.appsPrefChangeCallback", dictionary);
+}
+
// static
void AppLauncherHandler::RegisterUserPrefs(PrefServiceBase* pref_service) {
pref_service->RegisterListPref(prefs::kNtpAppPageNames,

Powered by Google App Engine
This is Rietveld 408576698