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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "chrome/browser/chromeos/login/users/user_manager.h"
10 #include "chrome/browser/chromeos/settings/cros_settings.h"
11 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
12 #include "chromeos/settings/cros_settings_names.h"
16 StubCrosSettingsProvider::StubCrosSettingsProvider(
17 const NotifyObserversCallback
& notify_cb
)
18 : CrosSettingsProvider(notify_cb
) {
22 StubCrosSettingsProvider::StubCrosSettingsProvider()
23 : CrosSettingsProvider(CrosSettingsProvider::NotifyObserversCallback()) {
27 StubCrosSettingsProvider::~StubCrosSettingsProvider() {
30 const base::Value
* StubCrosSettingsProvider::Get(
31 const std::string
& path
) const {
32 DCHECK(HandlesSetting(path
));
33 const base::Value
* value
;
34 if (values_
.GetValue(path
, &value
))
39 CrosSettingsProvider::TrustedStatus
40 StubCrosSettingsProvider::PrepareTrustedValues(const base::Closure
& cb
) {
41 // We don't have a trusted store so all values are available immediately.
45 bool StubCrosSettingsProvider::HandlesSetting(const std::string
& path
) const {
46 return DeviceSettingsProvider::IsDeviceSetting(path
);
49 void StubCrosSettingsProvider::DoSet(const std::string
& path
,
50 const base::Value
& value
) {
51 values_
.SetValue(path
, value
.DeepCopy());
52 NotifyObservers(path
);
55 void StubCrosSettingsProvider::SetDefaults() {
56 values_
.SetBoolean(kAccountsPrefAllowGuest
, true);
57 values_
.SetBoolean(kAccountsPrefAllowNewUser
, true);
58 values_
.SetBoolean(kAccountsPrefShowUserNamesOnSignIn
, true);
59 values_
.SetValue(kAccountsPrefDeviceLocalAccounts
, new base::ListValue
);
60 // |kDeviceOwner| will be set to the logged-in user by |UserManager|.
63 } // namespace chromeos