| 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; | |
| 16 class PrefService; | 15 class PrefService; |
| 17 class Task; | 16 class Task; |
| 18 | 17 |
| 18 namespace base { |
| 19 class ListValue; |
| 20 } |
| 21 |
| 19 namespace chromeos { | 22 namespace chromeos { |
| 20 | 23 |
| 21 // CrosSettingsProvider implementation that works with SignedSettings. | 24 // CrosSettingsProvider implementation that works with SignedSettings. |
| 22 // TODO(nkostylev): Rename this class to indicate that it is | 25 // TODO(nkostylev): Rename this class to indicate that it is |
| 23 // SignedSettings specific. | 26 // SignedSettings specific. |
| 24 class UserCrosSettingsProvider : public CrosSettingsProvider { | 27 class UserCrosSettingsProvider : public CrosSettingsProvider { |
| 25 public: | 28 public: |
| 26 UserCrosSettingsProvider(); | 29 UserCrosSettingsProvider(); |
| 27 virtual ~UserCrosSettingsProvider() {} | 30 virtual ~UserCrosSettingsProvider() {} |
| 28 | 31 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 bool RequestTrustedOwner(Task* callback); | 44 bool RequestTrustedOwner(Task* callback); |
| 42 | 45 |
| 43 // Reloads values from device settings. | 46 // Reloads values from device settings. |
| 44 void Reload(); | 47 void Reload(); |
| 45 | 48 |
| 46 // Helper functions to access cached settings. | 49 // Helper functions to access cached settings. |
| 47 static bool cached_allow_guest(); | 50 static bool cached_allow_guest(); |
| 48 static bool cached_allow_new_user(); | 51 static bool cached_allow_new_user(); |
| 49 static bool cached_data_roaming_enabled(); | 52 static bool cached_data_roaming_enabled(); |
| 50 static bool cached_show_users_on_signin(); | 53 static bool cached_show_users_on_signin(); |
| 51 static const ListValue* cached_whitelist(); | 54 static const base::ListValue* cached_whitelist(); |
| 52 static std::string cached_owner(); | 55 static std::string cached_owner(); |
| 53 | 56 |
| 54 // Returns true if given email is in user whitelist. | 57 // Returns true if given email is in user whitelist. |
| 55 // Note this function is for display purpose only and should use | 58 // Note this function is for display purpose only and should use |
| 56 // CheckWhitelist op for the real whitelist check. | 59 // CheckWhitelist op for the real whitelist check. |
| 57 static bool IsEmailInCachedWhitelist(const std::string& email); | 60 static bool IsEmailInCachedWhitelist(const std::string& email); |
| 58 | 61 |
| 59 // CrosSettingsProvider implementation. | 62 // CrosSettingsProvider implementation. |
| 60 virtual bool Get(const std::string& path, Value** out_value) const; | 63 virtual bool Get(const std::string& path, base::Value** out_value) const; |
| 61 virtual bool HandlesSetting(const std::string& path); | 64 virtual bool HandlesSetting(const std::string& path); |
| 62 | 65 |
| 63 void WhitelistUser(const std::string& email); | 66 void WhitelistUser(const std::string& email); |
| 64 void UnwhitelistUser(const std::string& email); | 67 void UnwhitelistUser(const std::string& email); |
| 65 | 68 |
| 66 // Updates cached value of the owner. | 69 // Updates cached value of the owner. |
| 67 static void UpdateCachedOwner(const std::string& email); | 70 static void UpdateCachedOwner(const std::string& email); |
| 68 | 71 |
| 69 private: | 72 private: |
| 70 // CrosSettingsProvider implementation. | 73 // CrosSettingsProvider implementation. |
| 71 virtual void DoSet(const std::string& path, Value* value); | 74 virtual void DoSet(const std::string& path, base::Value* value); |
| 72 | 75 |
| 73 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); | 76 DISALLOW_COPY_AND_ASSIGN(UserCrosSettingsProvider); |
| 74 }; | 77 }; |
| 75 | 78 |
| 76 } // namespace chromeos | 79 } // namespace chromeos |
| 77 | 80 |
| 78 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ | 81 #endif // CHROME_BROWSER_CHROMEOS_USER_CROS_SETTINGS_PROVIDER_H_ |
| OLD | NEW |