| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_API_PREFERENCE_CHROME_DIRECT_SETTING_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__ |
| 7 | 7 |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 | 10 |
| 11 class PrefService; | 11 class PrefService; |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 namespace chromedirectsetting { | 14 namespace chromedirectsetting { |
| 15 | 15 |
| 16 // Base class to host instance method helpers. | 16 // Base class to host instance method helpers. |
| 17 class DirectSettingFunctionBase : public SyncExtensionFunction { | 17 class DirectSettingFunctionBase : public SyncExtensionFunction { |
| 18 protected: | 18 protected: |
| 19 DirectSettingFunctionBase(); | 19 DirectSettingFunctionBase(); |
| 20 virtual ~DirectSettingFunctionBase(); | 20 virtual ~DirectSettingFunctionBase(); |
| 21 | 21 |
| 22 // Returns the user pref service. | 22 // Returns the user pref service. |
| 23 PrefService* GetPrefService(); | 23 PrefService* GetPrefService(); |
| 24 | 24 |
| 25 // Returns true if the caller is a component extension. | 25 // Returns true if the caller is a component extension. |
| 26 bool IsCalledFromComponentExtension(); | 26 bool IsCalledFromComponentExtension(); |
| 27 | 27 |
| 28 // Returns true if the preference is on the whitelist. | |
| 29 bool IsPreferenceOnWhitelist(const std::string& pref_key); | |
| 30 | |
| 31 private: | 28 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(DirectSettingFunctionBase); | 29 DISALLOW_COPY_AND_ASSIGN(DirectSettingFunctionBase); |
| 33 }; | 30 }; |
| 34 | 31 |
| 35 class GetDirectSettingFunction : public DirectSettingFunctionBase { | 32 class GetDirectSettingFunction : public DirectSettingFunctionBase { |
| 36 public: | 33 public: |
| 37 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.get", | 34 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.get", |
| 38 TYPES_PRIVATE_CHROMEDIRECTSETTING_GET) | 35 TYPES_PRIVATE_CHROMEDIRECTSETTING_GET) |
| 39 | 36 |
| 40 GetDirectSettingFunction(); | 37 GetDirectSettingFunction(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 private: | 75 private: |
| 79 virtual ~ClearDirectSettingFunction(); | 76 virtual ~ClearDirectSettingFunction(); |
| 80 DISALLOW_COPY_AND_ASSIGN(ClearDirectSettingFunction); | 77 DISALLOW_COPY_AND_ASSIGN(ClearDirectSettingFunction); |
| 81 }; | 78 }; |
| 82 | 79 |
| 83 } // namespace chromedirectsetting | 80 } // namespace chromedirectsetting |
| 84 } // namespace extensions | 81 } // namespace extensions |
| 85 | 82 |
| 86 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__ | 83 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__ |
| 87 | 84 |
| OLD | NEW |