Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/extensions/api/preference/chrome_direct_setting.h

Issue 18341016: Add types.private.ChromeDirectSetting and Connect it to preferencesPrivate.googleGeolocationAccessE… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added Lazy Initialized Whitelist Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/preference/chrome_direct_setting.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
7
8 #include "base/lazy_instance.h"
9 #include "chrome/browser/extensions/extension_function.h"
10
11 class PrefService;
12
13 namespace extensions {
14 namespace chromedirectsetting {
15
16 // Base class to host instance method helpers.
17 class DirectSettingFunctionBase : public SyncExtensionFunction {
18 protected:
19 explicit DirectSettingFunctionBase() {}
20 virtual ~DirectSettingFunctionBase() {}
21
22 // Returns the user pref service.
23 PrefService* GetPrefService();
24
25 // Returns true if the caller is a component extension.
26 bool IsCalledFromComponentExtension();
27
28 // Returns true if the preference is on the whitelist.
29 bool IsPreferenceOnWhitelist(const std::string& pref_key);
30
31 private:
32 class PreferenceWhitelist {
Bernhard Bauer 2013/07/09 23:23:44 You can move this class (and the variable) to the
robliao 2013/07/09 23:37:41 I'll move the class, but keep it in the namespace.
Bernhard Bauer 2013/07/10 10:52:25 I'm sorry, but that's not the customary way in Chr
robliao 2013/07/10 16:52:39 Where can I provide feedback on this rule? I've bu
33 public:
34 explicit PreferenceWhitelist();
Bernhard Bauer 2013/07/09 23:23:44 Explicit is only necessary for single-argument con
robliao 2013/07/09 23:37:41 Done.
35
36 bool IsPreferenceOnWhitelist(const std::string& pref_key);
37
38 private:
39 base::hash_set<std::string> whitelist_;
40
41 DISALLOW_COPY_AND_ASSIGN(PreferenceWhitelist);
42 };
43
44 static base::LazyInstance<PreferenceWhitelist> preference_whitelist_;
45 DISALLOW_COPY_AND_ASSIGN(DirectSettingFunctionBase);
46 };
47
48 class GetDirectSettingFunction : public DirectSettingFunctionBase {
49 public:
50 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.get",
51 TYPES_PRIVATE_CHROMEDIRECTSETTING_GET)
52
53 explicit GetDirectSettingFunction() {}
54
55 protected:
56 // ExtensionFunction:
57 virtual bool RunImpl() OVERRIDE;
58
59 private:
60 virtual ~GetDirectSettingFunction() {}
61 DISALLOW_COPY_AND_ASSIGN(GetDirectSettingFunction);
62 };
63
64 class SetDirectSettingFunction : public DirectSettingFunctionBase {
65 public:
66 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.set",
67 TYPES_PRIVATE_CHROMEDIRECTSETTING_SET)
68
69 explicit SetDirectSettingFunction() {}
70
71 protected:
72 // ExtensionFunction:
73 virtual bool RunImpl() OVERRIDE;
74
75 private:
76 virtual ~SetDirectSettingFunction() {}
77 DISALLOW_COPY_AND_ASSIGN(SetDirectSettingFunction);
78 };
79
80 class ClearDirectSettingFunction : public DirectSettingFunctionBase {
81 public:
82 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.clear",
83 TYPES_PRIVATE_CHROMEDIRECTSETTING_CLEAR)
84
85 explicit ClearDirectSettingFunction() {}
86
87 protected:
88 // ExtensionFunction:
89 virtual bool RunImpl() OVERRIDE;
90
91 private:
92 virtual ~ClearDirectSettingFunction() {}
93 DISALLOW_COPY_AND_ASSIGN(ClearDirectSettingFunction);
94 };
95
96 } // namespace chromedirectsetting
97 } // namespace extensions
98
99 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
100
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/preference/chrome_direct_setting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698