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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_HELPERS_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_HELPERS_H_
10 #include "extensions/browser/extension_event_histogram_value.h"
11 #include "extensions/browser/extension_prefs_scope.h"
12 #include "extensions/common/permissions/permission_set.h"
20 namespace extensions
{
21 namespace preference_helpers
{
23 bool StringToScope(const std::string
& s
,
24 extensions::ExtensionPrefsScope
* scope
);
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(
30 const std::string
& extension_id
,
31 const std::string
& browser_pref
,
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
39 void DispatchEventToExtensions(Profile
* profile
,
40 events::HistogramValue histogram_value
,
41 const std::string
& event_name
,
42 base::ListValue
* args
,
43 extensions::APIPermission::ID permission
,
45 const std::string
& browser_pref
);
47 } // namespace preference_helpers
48 } // namespace extensions
50 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_PREFERENCE_HELPERS_H_