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

Side by Side Diff: chrome/browser/ui/webui/options/core_options_handler.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/prefs/public/pref_change_registrar.h" 12 #include "base/prefs/public/pref_change_registrar.h"
13 #include "base/prefs/public/pref_observer.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/plugins/plugin_status_pref_setter.h" 15 #include "chrome/browser/plugins/plugin_status_pref_setter.h"
15 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/ui/webui/options/options_ui.h" 17 #include "chrome/browser/ui/webui/options/options_ui.h"
17 18
18 namespace options { 19 namespace options {
19 20
20 // Core options UI handler. 21 // Core options UI handler.
21 // Handles resource and JS calls common to all options sub-pages. 22 // Handles resource and JS calls common to all options sub-pages.
22 class CoreOptionsHandler : public OptionsPageUIHandler { 23 class CoreOptionsHandler
24 : public OptionsPageUIHandler,
25 public PrefObserver {
23 public: 26 public:
24 CoreOptionsHandler(); 27 CoreOptionsHandler();
25 virtual ~CoreOptionsHandler(); 28 virtual ~CoreOptionsHandler();
26 29
27 // OptionsPageUIHandler implementation. 30 // OptionsPageUIHandler implementation.
28 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; 31 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE;
29 virtual void InitializeHandler() OVERRIDE; 32 virtual void InitializeHandler() OVERRIDE;
30 virtual void InitializePage() OVERRIDE; 33 virtual void InitializePage() OVERRIDE;
31 virtual void Uninitialize() OVERRIDE; 34 virtual void Uninitialize() OVERRIDE;
32 35
33 // content::NotificationObserver implementation. 36 // PrefObserver implementation.
34 virtual void Observe(int type, 37 virtual void OnPreferenceChanged(PrefServiceBase* service,
35 const content::NotificationSource& source, 38 const std::string& pref_name) OVERRIDE;
36 const content::NotificationDetails& details) OVERRIDE;
37 39
38 // WebUIMessageHandler implementation. 40 // WebUIMessageHandler implementation.
39 virtual void RegisterMessages() OVERRIDE; 41 virtual void RegisterMessages() OVERRIDE;
40 42
41 void set_handlers_host(OptionsPageUIHandlerHost* handlers_host) { 43 void set_handlers_host(OptionsPageUIHandlerHost* handlers_host) {
42 handlers_host_ = handlers_host; 44 handlers_host_ = handlers_host;
43 } 45 }
44 46
45 // Adds localized strings to |localized_strings|. 47 // Adds localized strings to |localized_strings|.
46 static void GetStaticLocalizedValues( 48 static void GetStaticLocalizedValues(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 typedef std::map<std::string, base::Callback<bool(const base::Value*)> > 167 typedef std::map<std::string, base::Callback<bool(const base::Value*)> >
166 PrefChangeFilterMap; 168 PrefChangeFilterMap;
167 PrefChangeFilterMap pref_change_filters_; 169 PrefChangeFilterMap pref_change_filters_;
168 170
169 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); 171 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler);
170 }; 172 };
171 173
172 } // namespace options 174 } // namespace options
173 175
174 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ 176 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698