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/extension_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, ExtensionPrefsScope* scope); |
23 | 23 |
24 // Returns a string constant (defined in the API) indicating the level of | 24 // Returns a string constant (defined in the API) indicating the level of |
25 // control this extension has over the specified preference. | 25 // control this extension has over the specified preference. |
26 const char* GetLevelOfControl( | 26 const char* GetLevelOfControl( |
27 Profile* profile, | 27 Profile* profile, |
28 const std::string& extension_id, | 28 const std::string& extension_id, |
29 const std::string& browser_pref, | 29 const std::string& browser_pref, |
30 bool incognito); | 30 bool incognito); |
31 | 31 |
32 // Dispatches |event_name| to extensions listening to the event and holding | 32 // Dispatches |event_name| to extensions listening to the event and holding |
33 // |permission|. |args| is passed as arguments to the event listener. A | 33 // |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 | 34 // 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 | 35 // injected into the first item of |args|, which must be of type |
36 // DictionaryValue. | 36 // DictionaryValue. |
37 void DispatchEventToExtensions( | 37 void DispatchEventToExtensions( |
38 Profile* profile, | 38 Profile* profile, |
39 const std::string& event_name, | 39 const std::string& event_name, |
40 base::ListValue* args, | 40 base::ListValue* args, |
41 ExtensionAPIPermission::ID permission, | 41 extensions::APIPermission::ID permission, |
42 bool incognito, | 42 bool incognito, |
43 const std::string& browser_pref); | 43 const std::string& browser_pref); |
44 | 44 |
45 } // namespace extension_preference_helpers | 45 } // namespace extension_preference_helpers |
46 | 46 |
47 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ | 47 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ |
OLD | NEW |