Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 DirectSettingFunctionBase() {} | |
|
miket_OOO
2013/07/10 18:34:47
No inline constructors/destructors in non-virtual
robliao
2013/07/10 20:20:09
I think the intent behind this rule is for librari
robliao
2013/07/10 20:33:33
Furthermore, these classes shouldn't store state d
Bernhard Bauer
2013/07/10 22:11:26
No, the main purpose of the rule is to prevent unn
Bernhard Bauer
2013/07/10 22:11:26
Stateless or not is not the issue here, but whethe
robliao
2013/07/10 22:18:45
What non-trivial code is present here? The compile
Bernhard Bauer
2013/07/10 22:37:24
Exactly, and it still does generate the default co
robliao
2013/07/11 00:28:13
I went ahead and removed the inline constructors a
| |
| 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 DISALLOW_COPY_AND_ASSIGN(DirectSettingFunctionBase); | |
| 33 }; | |
| 34 | |
| 35 class GetDirectSettingFunction : public DirectSettingFunctionBase { | |
| 36 public: | |
| 37 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.get", | |
| 38 TYPES_PRIVATE_CHROMEDIRECTSETTING_GET) | |
| 39 | |
| 40 GetDirectSettingFunction() {} | |
| 41 | |
| 42 protected: | |
| 43 // ExtensionFunction: | |
| 44 virtual bool RunImpl() OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 virtual ~GetDirectSettingFunction() {} | |
| 48 DISALLOW_COPY_AND_ASSIGN(GetDirectSettingFunction); | |
| 49 }; | |
| 50 | |
| 51 class SetDirectSettingFunction : public DirectSettingFunctionBase { | |
| 52 public: | |
| 53 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.set", | |
| 54 TYPES_PRIVATE_CHROMEDIRECTSETTING_SET) | |
| 55 | |
| 56 SetDirectSettingFunction() {} | |
| 57 | |
| 58 protected: | |
| 59 // ExtensionFunction: | |
| 60 virtual bool RunImpl() OVERRIDE; | |
| 61 | |
| 62 private: | |
| 63 virtual ~SetDirectSettingFunction() {} | |
| 64 DISALLOW_COPY_AND_ASSIGN(SetDirectSettingFunction); | |
| 65 }; | |
| 66 | |
| 67 class ClearDirectSettingFunction : public DirectSettingFunctionBase { | |
| 68 public: | |
| 69 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.clear", | |
| 70 TYPES_PRIVATE_CHROMEDIRECTSETTING_CLEAR) | |
| 71 | |
| 72 ClearDirectSettingFunction() {} | |
| 73 | |
| 74 protected: | |
| 75 // ExtensionFunction: | |
| 76 virtual bool RunImpl() OVERRIDE; | |
| 77 | |
| 78 private: | |
| 79 virtual ~ClearDirectSettingFunction() {} | |
| 80 DISALLOW_COPY_AND_ASSIGN(ClearDirectSettingFunction); | |
| 81 }; | |
| 82 | |
| 83 } // namespace chromedirectsetting | |
| 84 } // namespace extensions | |
| 85 | |
| 86 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__ | |
| 87 | |
| OLD | NEW |