OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_PREFERENCE_API_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
12 #include "chrome/browser/prefs/pref_change_registrar.h" | 12 #include "chrome/browser/prefs/pref_change_registrar.h" |
13 #include "content/common/notification_observer.h" | 13 #include "content/common/notification_observer.h" |
14 | 14 |
15 class ExtensionPreferenceEventRouter : public NotificationObserver { | 15 class ExtensionPreferenceEventRouter : public NotificationObserver { |
16 public: | 16 public: |
17 explicit ExtensionPreferenceEventRouter(Profile* profile); | 17 explicit ExtensionPreferenceEventRouter(Profile* profile); |
18 virtual ~ExtensionPreferenceEventRouter(); | 18 virtual ~ExtensionPreferenceEventRouter(); |
19 | 19 |
| 20 void Init(); |
| 21 |
20 private: | 22 private: |
21 // NotificationObserver implementation. | 23 // NotificationObserver implementation. |
22 virtual void Observe(NotificationType type, | 24 virtual void Observe(NotificationType type, |
23 const NotificationSource& source, | 25 const NotificationSource& source, |
24 const NotificationDetails& details); | 26 const NotificationDetails& details); |
25 | 27 |
26 void OnPrefChanged(PrefService* pref_service, const std::string& pref_key); | 28 void OnPrefChanged(PrefService* pref_service, const std::string& pref_key); |
27 | 29 |
28 // This method dispatches events to the extension message service. | 30 // This method dispatches events to the extension message service. |
29 void DispatchEvent(const std::string& extension_id, | 31 void DispatchEvent(const std::string& extension_id, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 }; | 79 }; |
78 | 80 |
79 class ClearPreferenceFunction : public SyncExtensionFunction { | 81 class ClearPreferenceFunction : public SyncExtensionFunction { |
80 public: | 82 public: |
81 virtual ~ClearPreferenceFunction(); | 83 virtual ~ClearPreferenceFunction(); |
82 virtual bool RunImpl(); | 84 virtual bool RunImpl(); |
83 DECLARE_EXTENSION_FUNCTION_NAME("preferences.clear") | 85 DECLARE_EXTENSION_FUNCTION_NAME("preferences.clear") |
84 }; | 86 }; |
85 | 87 |
86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ | 88 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_API_H__ |
OLD | NEW |