| 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_API_PREFERENCE_PREFERENCE_HELPERS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_HELPERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/common/extensions/permissions/permission_set.h" | 10 #include "chrome/common/extensions/permissions/permission_set.h" |
| 11 #include "chrome/browser/extensions/extension_prefs_scope.h" | 11 #include "chrome/browser/extensions/extension_prefs_scope.h" |
| 12 | 12 |
| 13 class Profile; | 13 class Profile; |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class ListValue; | 16 class ListValue; |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 namespace extension_preference_helpers { | 19 namespace extensions { |
| 20 namespace preference_helpers { |
| 20 | 21 |
| 21 bool StringToScope(const std::string& s, | 22 bool StringToScope(const std::string& s, |
| 22 extensions::ExtensionPrefsScope* scope); | 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 preference_helpers |
| 47 } // namespace extensions |
| 46 | 48 |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFERENCE_HELPERS_H_ | 49 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_HELPERS_H_ |
| OLD | NEW |