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