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_CROS_SETTINGS_PROVIDER_USER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_USER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_USER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_USER_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 "base/scoped_ptr.h" | |
13 #include "chrome/browser/chromeos/cros_settings_provider.h" | 12 #include "chrome/browser/chromeos/cros_settings_provider.h" |
14 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | 13 #include "chrome/browser/chromeos/login/signed_settings_helper.h" |
15 | 14 |
16 class DictionaryValue; | 15 class ListValue; |
| 16 class PrefService; |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 | 19 |
20 class UserCrosSettingsProvider : public CrosSettingsProvider, | 20 class UserCrosSettingsProvider : public CrosSettingsProvider, |
21 public SignedSettingsHelper::Callback { | 21 public SignedSettingsHelper::Callback { |
22 public: | 22 public: |
23 UserCrosSettingsProvider(); | 23 UserCrosSettingsProvider(); |
24 virtual ~UserCrosSettingsProvider(); | 24 virtual ~UserCrosSettingsProvider(); |
25 | 25 |
| 26 // Registers cached users settings in preferences. |
| 27 static void RegisterPrefs(PrefService* local_state); |
| 28 |
| 29 // Helper functions to access cached settings. |
| 30 static bool cached_allow_bwsi(); |
| 31 static bool cached_allow_guest(); |
| 32 static bool cached_show_users_on_signin(); |
| 33 static const ListValue* cached_whitelist(); |
| 34 |
26 // CrosSettingsProvider implementation. | 35 // CrosSettingsProvider implementation. |
27 virtual void Set(const std::string& path, Value* in_value); | 36 virtual void Set(const std::string& path, Value* in_value); |
28 virtual bool Get(const std::string& path, Value** out_value) const; | 37 virtual bool Get(const std::string& path, Value** out_value) const; |
29 virtual bool HandlesSetting(const std::string& path); | 38 virtual bool HandlesSetting(const std::string& path); |
30 | 39 |
31 // SignedSettingsHelper::Callback overrides. | 40 // SignedSettingsHelper::Callback overrides. |
32 virtual void OnWhitelistCompleted(bool success, const std::string& email); | 41 virtual void OnWhitelistCompleted(bool success, const std::string& email); |
33 virtual void OnUnwhitelistCompleted(bool success, const std::string& email); | 42 virtual void OnUnwhitelistCompleted(bool success, const std::string& email); |
34 virtual void OnStorePropertyCompleted( | 43 virtual void OnStorePropertyCompleted( |
35 bool success, const std::string& name, const std::string& value); | 44 bool success, const std::string& name, const std::string& value); |
36 virtual void OnRetrievePropertyCompleted( | 45 virtual void OnRetrievePropertyCompleted( |
37 bool success, const std::string& name, const std::string& value); | 46 bool success, const std::string& name, const std::string& value); |
38 | 47 |
39 void WhitelistUser(const std::string& email); | 48 void WhitelistUser(const std::string& email); |
40 void UnwhitelistUser(const std::string& email); | 49 void UnwhitelistUser(const std::string& email); |
41 | 50 |
42 private: | 51 private: |
43 void StartFetchingBoolSetting(const std::string& name, bool default_value); | 52 void StartFetchingBoolSetting(const std::string& name); |
44 void LoadUserWhitelist(); | 53 ListValue* GetUserWhitelist() const; |
45 | 54 |
46 scoped_ptr<DictionaryValue> cache_; | |
47 bool current_user_is_owner_; | 55 bool current_user_is_owner_; |
48 | 56 |
49 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); | 57 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); |
50 }; | 58 }; |
51 | 59 |
52 } // namespace chromeos | 60 } // namespace chromeos |
53 | 61 |
54 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_USER_H_ | 62 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_USER_H_ |
OLD | NEW |