| OLD | NEW |
| 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" | |
| 12 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
| 13 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 14 | 13 |
| 15 class PrefService; | 14 class PrefService; |
| 16 | 15 |
| 17 namespace base { | 16 namespace base { |
| 18 class Value; | 17 class Value; |
| 19 } | 18 } |
| 20 | 19 |
| 21 namespace extensions { | 20 namespace extensions { |
| 22 | 21 |
| 23 class PreferenceEventRouter : public PrefObserver { | 22 class PreferenceEventRouter { |
| 24 public: | 23 public: |
| 25 explicit PreferenceEventRouter(Profile* profile); | 24 explicit PreferenceEventRouter(Profile* profile); |
| 26 virtual ~PreferenceEventRouter(); | 25 virtual ~PreferenceEventRouter(); |
| 27 | 26 |
| 28 private: | 27 private: |
| 29 // PrefObserver implementation. | |
| 30 virtual void OnPreferenceChanged(PrefServiceBase* service, | |
| 31 const std::string& pref_name) OVERRIDE; | |
| 32 | |
| 33 void OnPrefChanged(PrefServiceBase* pref_service, | 28 void OnPrefChanged(PrefServiceBase* pref_service, |
| 34 const std::string& pref_key); | 29 const std::string& pref_key); |
| 35 | 30 |
| 36 // This method dispatches events to the extension message service. | 31 // This method dispatches events to the extension message service. |
| 37 void DispatchEvent(const std::string& extension_id, | 32 void DispatchEvent(const std::string& extension_id, |
| 38 const std::string& event_name, | 33 const std::string& event_name, |
| 39 const std::string& json_args); | 34 const std::string& json_args); |
| 40 | 35 |
| 41 PrefChangeRegistrar registrar_; | 36 PrefChangeRegistrar registrar_; |
| 42 PrefChangeRegistrar incognito_registrar_; | 37 PrefChangeRegistrar incognito_registrar_; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 protected: | 109 protected: |
| 115 virtual ~ClearPreferenceFunction(); | 110 virtual ~ClearPreferenceFunction(); |
| 116 | 111 |
| 117 // ExtensionFunction: | 112 // ExtensionFunction: |
| 118 virtual bool RunImpl() OVERRIDE; | 113 virtual bool RunImpl() OVERRIDE; |
| 119 }; | 114 }; |
| 120 | 115 |
| 121 } // namespace extensions | 116 } // namespace extensions |
| 122 | 117 |
| 123 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ | 118 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_API_H__ |
| OLD | NEW |