OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/browser/chromeos/cros_settings_provider.h" | 12 #include "chrome/browser/chromeos/cros_settings_provider.h" |
13 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | 13 #include "chrome/browser/chromeos/login/signed_settings_helper.h" |
14 | 14 |
15 class ListValue; | 15 class ListValue; |
16 class PrefService; | 16 class PrefService; |
17 class Task; | 17 class Task; |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
| 21 // CrosSettingsProvider implementation that works with SignedSettings. |
| 22 // TODO(nkostylev): Rename this class to indicate that it is |
| 23 // SignedSettings specific. |
21 class UserCrosSettingsProvider : public CrosSettingsProvider { | 24 class UserCrosSettingsProvider : public CrosSettingsProvider { |
22 public: | 25 public: |
23 UserCrosSettingsProvider(); | 26 UserCrosSettingsProvider(); |
24 virtual ~UserCrosSettingsProvider() {} | 27 virtual ~UserCrosSettingsProvider() {} |
25 | 28 |
26 // Registers cached users settings in preferences. | 29 // Registers cached users settings in preferences. |
27 static void RegisterPrefs(PrefService* local_state); | 30 static void RegisterPrefs(PrefService* local_state); |
28 | 31 |
29 // Methods to use when trusted (signature verified) values are required. | 32 // Methods to use when trusted (signature verified) values are required. |
30 // Return true if subsequent call to corresponding cached_* getter shall | 33 // Return true if subsequent call to corresponding cached_* getter shall |
31 // return trusted value. | 34 // return trusted value. |
32 // Return false if trusted values are unavailable at a moment. | 35 // Return false if trusted values are unavailable at a moment. |
33 // In latter case passed task will be posted when ready. | 36 // In latter case passed task will be posted when ready. |
34 bool RequestTrustedAllowGuest(Task* callback); | 37 bool RequestTrustedAllowGuest(Task* callback); |
35 bool RequestTrustedAllowNewUser(Task* callback); | 38 bool RequestTrustedAllowNewUser(Task* callback); |
| 39 bool RequestTrustedDataRoamingEnabled(Task* callback); |
36 bool RequestTrustedShowUsersOnSignin(Task* callback); | 40 bool RequestTrustedShowUsersOnSignin(Task* callback); |
37 bool RequestTrustedOwner(Task* callback); | 41 bool RequestTrustedOwner(Task* callback); |
38 | 42 |
39 // Helper functions to access cached settings. | 43 // Helper functions to access cached settings. |
40 static bool cached_allow_guest(); | 44 static bool cached_allow_guest(); |
41 static bool cached_allow_new_user(); | 45 static bool cached_allow_new_user(); |
| 46 static bool cached_data_roaming_enabled(); |
42 static bool cached_show_users_on_signin(); | 47 static bool cached_show_users_on_signin(); |
43 static const ListValue* cached_whitelist(); | 48 static const ListValue* cached_whitelist(); |
44 static std::string cached_owner(); | 49 static std::string cached_owner(); |
45 | 50 |
46 // Returns true if given email is in user whitelist. | 51 // Returns true if given email is in user whitelist. |
47 // Note this function is for display purpose only and should use | 52 // Note this function is for display purpose only and should use |
48 // CheckWhitelist op for the real whitelist check. | 53 // CheckWhitelist op for the real whitelist check. |
49 static bool IsEmailInCachedWhitelist(const std::string& email); | 54 static bool IsEmailInCachedWhitelist(const std::string& email); |
50 | 55 |
51 // CrosSettingsProvider implementation. | 56 // CrosSettingsProvider implementation. |
52 virtual bool Get(const std::string& path, Value** out_value) const; | 57 virtual bool Get(const std::string& path, Value** out_value) const; |
53 virtual bool HandlesSetting(const std::string& path); | 58 virtual bool HandlesSetting(const std::string& path); |
54 | 59 |
55 void WhitelistUser(const std::string& email); | 60 void WhitelistUser(const std::string& email); |
56 void UnwhitelistUser(const std::string& email); | 61 void UnwhitelistUser(const std::string& email); |
57 | 62 |
58 // Updates cached value of the owner. | 63 // Updates cached value of the owner. |
59 static void UpdateCachedOwner(const std::string& email); | 64 static void UpdateCachedOwner(const std::string& email); |
60 | 65 |
61 private: | 66 private: |
62 // CrosSettingsProvider implementation. | 67 // CrosSettingsProvider implementation. |
63 virtual void DoSet(const std::string& path, Value* value); | 68 virtual void DoSet(const std::string& path, Value* value); |
64 | 69 |
65 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); | 70 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); |
66 }; | 71 }; |
67 | 72 |
68 } // namespace chromeos | 73 } // namespace chromeos |
69 | 74 |
70 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ |
OLD | NEW |