OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 // TODO(nkostylev): Rename this class to indicate that it is | 25 // TODO(nkostylev): Rename this class to indicate that it is |
26 // SignedSettings specific. | 26 // SignedSettings specific. |
27 class UserCrosSettingsProvider : public CrosSettingsProvider { | 27 class UserCrosSettingsProvider : public CrosSettingsProvider { |
28 public: | 28 public: |
29 UserCrosSettingsProvider(); | 29 UserCrosSettingsProvider(); |
30 virtual ~UserCrosSettingsProvider() {} | 30 virtual ~UserCrosSettingsProvider() {} |
31 | 31 |
32 // Registers cached users settings in preferences. | 32 // Registers cached users settings in preferences. |
33 static void RegisterPrefs(PrefService* local_state); | 33 static void RegisterPrefs(PrefService* local_state); |
34 | 34 |
35 // Methods to use when trusted (signature verified) values are required. | |
36 // Return true if subsequent call to corresponding cached_* getter shall | |
37 // return trusted value. | |
38 // Return false if trusted values are unavailable at a moment. | |
39 // In latter case passed task will be posted when ready. | |
40 bool RequestTrustedAllowGuest(Task* callback); | |
41 bool RequestTrustedAllowNewUser(Task* callback); | |
42 bool RequestTrustedDataRoamingEnabled(Task* callback); | |
43 bool RequestTrustedShowUsersOnSignin(Task* callback); | |
44 bool RequestTrustedOwner(Task* callback); | |
45 bool RequestTrustedReportingEnabled(Task* callback); | |
46 | |
47 // Reloads values from device settings. | 35 // Reloads values from device settings. |
48 void Reload(); | 36 void Reload(); |
49 | 37 |
50 // Helper functions to access cached settings. | |
51 static bool cached_allow_guest(); | |
52 static bool cached_allow_new_user(); | |
53 static bool cached_data_roaming_enabled(); | |
54 static bool cached_show_users_on_signin(); | |
55 static bool cached_reporting_enabled(); | |
56 static const base::ListValue* cached_whitelist(); | |
57 static std::string cached_owner(); | |
58 | |
59 // Returns true if given email is in user whitelist. | |
60 // Note this function is for display purpose only and should use | |
61 // CheckWhitelist op for the real whitelist check. | |
62 static bool IsEmailInCachedWhitelist(const std::string& email); | |
63 | |
64 // CrosSettingsProvider implementation. | 38 // CrosSettingsProvider implementation. |
65 virtual bool Get(const std::string& path, | 39 virtual const base::Value* Get(const std::string& path) const OVERRIDE; |
66 base::Value** out_value) const OVERRIDE; | 40 virtual bool GetTrusted(const std::string& path, |
41 const Callback& callback) const OVERRIDE; | |
67 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; | 42 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; |
68 | 43 |
69 void WhitelistUser(const std::string& email); | 44 static void WhitelistUser(const std::string& email); |
Denis Lagno
2011/09/20 14:05:22
Is it good making them static?
Also, you forgot t
pastarmovj
2011/09/20 17:11:52
I intend on getting rid of the special handling of
| |
70 void UnwhitelistUser(const std::string& email); | 45 static void UnwhitelistUser(const std::string& email); |
71 | 46 |
72 // Updates cached value of the owner. | 47 // Updates cached value of the owner. |
73 static void UpdateCachedOwner(const std::string& email); | 48 static void UpdateCachedOwner(const std::string& email); |
74 | 49 |
75 private: | 50 private: |
76 // CrosSettingsProvider implementation. | 51 // CrosSettingsProvider implementation. |
77 virtual void DoSet(const std::string& path, base::Value* value) OVERRIDE; | 52 virtual void DoSet(const std::string& path, base::Value* value) OVERRIDE; |
78 | 53 |
79 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); | 54 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); |
80 }; | 55 }; |
81 | 56 |
82 } // namespace chromeos | 57 } // namespace chromeos |
83 | 58 |
84 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ | 59 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ |
OLD | NEW |