summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/preference/chrome_direct_setting.h
diff options
context:
space:
mode:
authorrobliao@chromium.org <robliao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 03:09:41 +0000
committerrobliao@chromium.org <robliao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 03:09:41 +0000
commitd56228dfe042da4946a7ca52e6e3bdada257963e (patch)
treeff529ca39f9636deecb98cad022a80cf9e83b9de /chrome/browser/extensions/api/preference/chrome_direct_setting.h
parent93b29064e134da54291c3e07bdf7fe0dd0335169 (diff)
downloadchromium_src-d56228dfe042da4946a7ca52e6e3bdada257963e.zip
chromium_src-d56228dfe042da4946a7ca52e6e3bdada257963e.tar.gz
chromium_src-d56228dfe042da4946a7ca52e6e3bdada257963e.tar.bz2
Add types.private.ChromeDirectSetting and Connect it to preferencesPrivate.googleGeolocationAccessEnabled
* Adds a component extension only API type chrome.types.private.ChromeDirectSetting (mirrors ChromeSetting except that it does not provide levelOfControl info given that this only applies to component extensions). * Switches preferencesPrivate.googleGeolocationAccessEnabled to use chrome.types.private.ChromeDirectSetting * Implements preliminary get, set, and clear functionality (direct access to the preferences) * Adds stubs for onChange to be done later. * Removes existing component extension affordances in the existing extension preferences codepath BUG=164227 Review URL: https://chromiumcodereview.appspot.com/18341016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/preference/chrome_direct_setting.h')
-rw-r--r--chrome/browser/extensions/api/preference/chrome_direct_setting.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting.h b/chrome/browser/extensions/api/preference/chrome_direct_setting.h
new file mode 100644
index 0000000..1a8164b
--- /dev/null
+++ b/chrome/browser/extensions/api/preference/chrome_direct_setting.h
@@ -0,0 +1,87 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
+#define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
+
+#include "base/lazy_instance.h"
+#include "chrome/browser/extensions/extension_function.h"
+
+class PrefService;
+
+namespace extensions {
+namespace chromedirectsetting {
+
+// Base class to host instance method helpers.
+class DirectSettingFunctionBase : public SyncExtensionFunction {
+ protected:
+ DirectSettingFunctionBase();
+ virtual ~DirectSettingFunctionBase();
+
+ // Returns the user pref service.
+ PrefService* GetPrefService();
+
+ // Returns true if the caller is a component extension.
+ bool IsCalledFromComponentExtension();
+
+ // Returns true if the preference is on the whitelist.
+ bool IsPreferenceOnWhitelist(const std::string& pref_key);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DirectSettingFunctionBase);
+};
+
+class GetDirectSettingFunction : public DirectSettingFunctionBase {
+ public:
+ DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.get",
+ TYPES_PRIVATE_CHROMEDIRECTSETTING_GET)
+
+ GetDirectSettingFunction();
+
+ protected:
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+
+ private:
+ virtual ~GetDirectSettingFunction();
+ DISALLOW_COPY_AND_ASSIGN(GetDirectSettingFunction);
+};
+
+class SetDirectSettingFunction : public DirectSettingFunctionBase {
+ public:
+ DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.set",
+ TYPES_PRIVATE_CHROMEDIRECTSETTING_SET)
+
+ SetDirectSettingFunction();
+
+ protected:
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+
+ private:
+ virtual ~SetDirectSettingFunction();
+ DISALLOW_COPY_AND_ASSIGN(SetDirectSettingFunction);
+};
+
+class ClearDirectSettingFunction : public DirectSettingFunctionBase {
+ public:
+ DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.clear",
+ TYPES_PRIVATE_CHROMEDIRECTSETTING_CLEAR)
+
+ ClearDirectSettingFunction();
+
+ protected:
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+
+ private:
+ virtual ~ClearDirectSettingFunction();
+ DISALLOW_COPY_AND_ASSIGN(ClearDirectSettingFunction);
+};
+
+} // namespace chromedirectsetting
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
+