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_EXTENSION_PREFERENCE_HELPERS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/common/extensions/permissions/permission_set.h" | 11 #include "chrome/common/extensions/permissions/permission_set.h" |
12 #include "chrome/browser/extensions/extension_prefs_scope.h" | 12 #include "chrome/browser/extensions/extension_prefs_scope.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class ListValue; | 17 class ListValue; |
18 }; | 18 }; |
19 | 19 |
20 namespace extension_preference_helpers { | 20 namespace extension_preference_helpers { |
21 | 21 |
22 bool StringToScope(const std::string& s, ExtensionPrefsScope* scope); | 22 bool StringToScope(const std::string& s, |
| 23 extensions::ExtensionPrefsScope* scope); |
23 | 24 |
24 // Returns a string constant (defined in the API) indicating the level of | 25 // Returns a string constant (defined in the API) indicating the level of |
25 // control this extension has over the specified preference. | 26 // control this extension has over the specified preference. |
26 const char* GetLevelOfControl( | 27 const char* GetLevelOfControl( |
27 Profile* profile, | 28 Profile* profile, |
28 const std::string& extension_id, | 29 const std::string& extension_id, |
29 const std::string& browser_pref, | 30 const std::string& browser_pref, |
30 bool incognito); | 31 bool incognito); |
31 | 32 |
32 // Dispatches |event_name| to extensions listening to the event and holding | 33 // Dispatches |event_name| to extensions listening to the event and holding |
33 // |permission|. |args| is passed as arguments to the event listener. A | 34 // |permission|. |args| is passed as arguments to the event listener. A |
34 // key-value for the level of control the extension has over |browser_pref| is | 35 // key-value for the level of control the extension has over |browser_pref| is |
35 // injected into the first item of |args|, which must be of type | 36 // injected into the first item of |args|, which must be of type |
36 // DictionaryValue. | 37 // DictionaryValue. |
37 void DispatchEventToExtensions( | 38 void DispatchEventToExtensions( |
38 Profile* profile, | 39 Profile* profile, |
39 const std::string& event_name, | 40 const std::string& event_name, |
40 base::ListValue* args, | 41 base::ListValue* args, |
41 extensions::APIPermission::ID permission, | 42 extensions::APIPermission::ID permission, |
42 bool incognito, | 43 bool incognito, |
43 const std::string& browser_pref); | 44 const std::string& browser_pref); |
44 | 45 |
45 } // namespace extension_preference_helpers | 46 } // namespace extension_preference_helpers |
46 | 47 |
47 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ | 48 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ |
OLD | NEW |