From a6a7ced56b518de42dab6d3ac18de490fb494696 Mon Sep 17 00:00:00 2001 From: "joi@chromium.org" <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Thu, 1 Nov 2012 17:24:18 +0000 Subject: Remove content::NotificationObserver dependency from most Prefs code. Instead of using content::NotificationObserver, introduce specific type-safe observer classes and update users to use them. In a very large number of cases this was the users' only reason for being a content::NotificationObserver and they would have a lot of boiler-plate code such as a DCHECK on the notification type and unpacking of the generic NotificationDetails types, so this change removes a bunch of boilerplate and introduces more type safety. This is part of enabling more of the Prefs code to live in base/prefs/. TBR=ben@chromium.org,brettw@chromium.org BUG=155525 Review URL: https://chromiumcodereview.appspot.com/11345008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165414 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/ui/browser_command_controller.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'chrome/browser/ui/browser_command_controller.h') diff --git a/chrome/browser/ui/browser_command_controller.h b/chrome/browser/ui/browser_command_controller.h index ccce17c..5ef5b5c 100644 --- a/chrome/browser/ui/browser_command_controller.h +++ b/chrome/browser/ui/browser_command_controller.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ #include "base/prefs/public/pref_change_registrar.h" +#include "base/prefs/public/pref_observer.h" #include "chrome/browser/api/sync/profile_sync_service_observer.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/sessions/tab_restore_service_observer.h" @@ -27,6 +28,7 @@ namespace chrome { class BrowserCommandController : public CommandUpdater::CommandUpdaterDelegate, public content::NotificationObserver, + public PrefObserver, public TabStripModelObserver, public TabRestoreServiceObserver, public ProfileSyncServiceObserver { @@ -86,6 +88,10 @@ class BrowserCommandController : public CommandUpdater::CommandUpdaterDelegate, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; + // Overridden from PrefObserver: + virtual void OnPreferenceChanged(PrefServiceBase* service, + const std::string& pref_name) OVERRIDE; + // Overridden from TabStripModelObserver: virtual void TabInsertedAt(TabContents* contents, int index, -- cgit v1.1