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_SETTINGS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_OBSERVER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_OBSERVER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/observer_list_threadsafe.h" |
9 #include "chrome/browser/extensions/extension_setting_changes.h" | 10 #include "chrome/browser/extensions/extension_setting_changes.h" |
10 | 11 |
11 class Profile; | 12 class Profile; |
12 | 13 |
13 // Interface for classes that listen to changes to extension settings. | 14 // Interface for classes that listen to changes to extension settings. |
14 class ExtensionSettingsObserver { | 15 class ExtensionSettingsObserver { |
15 public: | 16 public: |
16 // Called when a list of settings have changed for an extension. | 17 // Called when a list of settings have changed for an extension. |
17 // | 18 // |
18 // |profile| is the profile of the event originator, or NULL if the event | 19 // |profile| is the profile of the event originator, or NULL if the event |
19 // didn't originate from a background page. This is so that events can avoid | 20 // didn't originate from a background page. This is so that events can avoid |
20 // being sent back to the background page which made the change. When the | 21 // being sent back to the background page which made the change. When the |
21 // settings API is exposed to content scripts, this will need to be changed. | 22 // settings API is exposed to content scripts, this will need to be changed. |
22 virtual void OnSettingsChanged( | 23 virtual void OnSettingsChanged( |
23 const Profile* profile, | 24 const Profile* profile, |
24 const std::string& extension_id, | 25 const std::string& extension_id, |
25 const ExtensionSettingChanges& changes) = 0; | 26 const ExtensionSettingChanges& changes) = 0; |
26 | 27 |
27 protected: | 28 protected: |
28 virtual ~ExtensionSettingsObserver(); | 29 virtual ~ExtensionSettingsObserver(); |
29 }; | 30 }; |
30 | 31 |
| 32 typedef ObserverListThreadSafe<ExtensionSettingsObserver> |
| 33 ExtensionSettingsObserverList; |
| 34 |
31 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_OBSERVER_H_ | 35 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_OBSERVER_H_ |
OLD | NEW |