| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/settings/cros_settings.h" | 9 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 10 #include "chrome/browser/chromeos/settings/device_settings_provider.h" | 10 #include "chrome/browser/chromeos/settings/device_settings_provider.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const std::string& path) const { | 30 const std::string& path) const { |
| 31 DCHECK(HandlesSetting(path)); | 31 DCHECK(HandlesSetting(path)); |
| 32 const base::Value* value; | 32 const base::Value* value; |
| 33 if (values_.GetValue(path, &value)) | 33 if (values_.GetValue(path, &value)) |
| 34 return value; | 34 return value; |
| 35 return NULL; | 35 return NULL; |
| 36 } | 36 } |
| 37 | 37 |
| 38 CrosSettingsProvider::TrustedStatus | 38 CrosSettingsProvider::TrustedStatus |
| 39 StubCrosSettingsProvider::PrepareTrustedValues(const base::Closure& cb) { | 39 StubCrosSettingsProvider::PrepareTrustedValues(const base::Closure& cb) { |
| 40 // We don't have a trusted store so all values are available immediately. | 40 return trusted_status_; |
| 41 return TRUSTED; | |
| 42 } | 41 } |
| 43 | 42 |
| 44 bool StubCrosSettingsProvider::HandlesSetting(const std::string& path) const { | 43 bool StubCrosSettingsProvider::HandlesSetting(const std::string& path) const { |
| 45 return DeviceSettingsProvider::IsDeviceSetting(path); | 44 return DeviceSettingsProvider::IsDeviceSetting(path); |
| 46 } | 45 } |
| 47 | 46 |
| 47 void StubCrosSettingsProvider::SetTrustedStatus(TrustedStatus status) { |
| 48 trusted_status_ = status; |
| 49 } |
| 50 |
| 51 void StubCrosSettingsProvider::SetCurrentUserIsOwner(bool owner) { |
| 52 current_user_is_owner_ = owner; |
| 53 } |
| 54 |
| 48 void StubCrosSettingsProvider::DoSet(const std::string& path, | 55 void StubCrosSettingsProvider::DoSet(const std::string& path, |
| 49 const base::Value& value) { | 56 const base::Value& value) { |
| 50 values_.SetValue(path, value.DeepCopy()); | 57 if (current_user_is_owner_) |
| 58 values_.SetValue(path, value.DeepCopy()); |
| 51 NotifyObservers(path); | 59 NotifyObservers(path); |
| 52 } | 60 } |
| 53 | 61 |
| 54 void StubCrosSettingsProvider::SetDefaults() { | 62 void StubCrosSettingsProvider::SetDefaults() { |
| 55 values_.SetBoolean(kAccountsPrefAllowGuest, true); | 63 values_.SetBoolean(kAccountsPrefAllowGuest, true); |
| 56 values_.SetBoolean(kAccountsPrefAllowNewUser, true); | 64 values_.SetBoolean(kAccountsPrefAllowNewUser, true); |
| 57 values_.SetBoolean(kAccountsPrefSupervisedUsersEnabled, true); | 65 values_.SetBoolean(kAccountsPrefSupervisedUsersEnabled, true); |
| 58 values_.SetBoolean(kAccountsPrefShowUserNamesOnSignIn, true); | 66 values_.SetBoolean(kAccountsPrefShowUserNamesOnSignIn, true); |
| 59 values_.SetValue(kAccountsPrefDeviceLocalAccounts, new base::ListValue); | 67 values_.SetValue(kAccountsPrefDeviceLocalAccounts, new base::ListValue); |
| 60 // |kDeviceOwner| will be set to the logged-in user by |UserManager|. | 68 // |kDeviceOwner| will be set to the logged-in user by |UserManager|. |
| 69 |
| 70 current_user_is_owner_ = true; |
| 71 |
| 72 // We don't have a trusted store so all values are available immediately. |
| 73 trusted_status_ = TRUSTED; |
| 61 } | 74 } |
| 62 | 75 |
| 63 } // namespace chromeos | 76 } // namespace chromeos |
| OLD | NEW |