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

Side by Side Diff: chrome/browser/extensions/api/preference/preference_api.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit 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_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/prefs/public/pref_change_registrar.h" 10 #include "base/prefs/public/pref_change_registrar.h"
11 #include "base/prefs/public/pref_observer.h"
11 #include "chrome/browser/extensions/extension_function.h" 12 #include "chrome/browser/extensions/extension_function.h"
12 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
13 14
14 class PrefService; 15 class PrefService;
15 16
16 namespace base { 17 namespace base {
17 class Value; 18 class Value;
18 } 19 }
19 20
20 namespace extensions { 21 namespace extensions {
21 22
22 class PreferenceEventRouter : public content::NotificationObserver { 23 class PreferenceEventRouter : public PrefObserver {
23 public: 24 public:
24 explicit PreferenceEventRouter(Profile* profile); 25 explicit PreferenceEventRouter(Profile* profile);
25 virtual ~PreferenceEventRouter(); 26 virtual ~PreferenceEventRouter();
26 27
27 private: 28 private:
28 // content::NotificationObserver implementation. 29 // PrefObserver implementation.
29 virtual void Observe(int type, 30 virtual void OnPreferenceChanged(PrefServiceBase* service,
30 const content::NotificationSource& source, 31 const std::string& pref_name) OVERRIDE;
31 const content::NotificationDetails& details) OVERRIDE;
32 32
33 void OnPrefChanged(PrefService* pref_service, const std::string& pref_key); 33 void OnPrefChanged(PrefServiceBase* pref_service,
34 const std::string& pref_key);
34 35
35 // This method dispatches events to the extension message service. 36 // This method dispatches events to the extension message service.
36 void DispatchEvent(const std::string& extension_id, 37 void DispatchEvent(const std::string& extension_id,
37 const std::string& event_name, 38 const std::string& event_name,
38 const std::string& json_args); 39 const std::string& json_args);
39 40
40 PrefChangeRegistrar registrar_; 41 PrefChangeRegistrar registrar_;
41 PrefChangeRegistrar incognito_registrar_; 42 PrefChangeRegistrar incognito_registrar_;
42 43
43 // Weak, owns us (transitively via ExtensionService). 44 // Weak, owns us (transitively via ExtensionService).
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 protected: 114 protected:
114 virtual ~ClearPreferenceFunction(); 115 virtual ~ClearPreferenceFunction();
115 116
116 // ExtensionFunction: 117 // ExtensionFunction:
117 virtual bool RunImpl() OVERRIDE; 118 virtual bool RunImpl() OVERRIDE;
118 }; 119 };
119 120
120 } // namespace extensions 121 } // namespace extensions
121 122
122 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ 123 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698