Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: chrome/browser/chromeos/stub_cros_settings_provider.cc

Issue 10824112: Move Chrome OS device settings stuff to chrome/browser/chromeos/settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/chromeos/stub_cros_settings_provider.h"
6
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "chrome/browser/chromeos/cros_settings.h"
10 #include "chrome/browser/chromeos/cros_settings_names.h"
11 #include "chrome/browser/chromeos/login/user_manager.h"
12
13 namespace chromeos {
14
15 namespace {
16
17 const char* kHandledSettings[] = {
18 kAccountsPrefAllowGuest,
19 kAccountsPrefAllowNewUser,
20 kAccountsPrefShowUserNamesOnSignIn,
21 kAccountsPrefUsers,
22 kAccountsPrefEphemeralUsersEnabled,
23 kDeviceOwner,
24 kPolicyMissingMitigationMode,
25 kReleaseChannel,
26 kReportDeviceVersionInfo,
27 kReportDeviceActivityTimes,
28 kReportDeviceBootMode,
29 kReportDeviceLocation,
30 kSettingProxyEverywhere,
31 kSignedDataRoamingEnabled,
32 kStatsReportingPref,
33 // Kiosk mode settings.
34 kIdleLogoutTimeout,
35 kIdleLogoutWarningDuration,
36 kScreenSaverExtensionId,
37 kScreenSaverTimeout
38 };
39
40 } // namespace
41
42 StubCrosSettingsProvider::StubCrosSettingsProvider(
43 const NotifyObserversCallback& notify_cb)
44 : CrosSettingsProvider(notify_cb) {
45 SetDefaults();
46 }
47
48 StubCrosSettingsProvider::StubCrosSettingsProvider()
49 : CrosSettingsProvider(CrosSettingsProvider::NotifyObserversCallback()) {
50 SetDefaults();
51 }
52
53 StubCrosSettingsProvider::~StubCrosSettingsProvider() {
54 }
55
56 const base::Value* StubCrosSettingsProvider::Get(
57 const std::string& path) const {
58 DCHECK(HandlesSetting(path));
59 const base::Value* value;
60 if (values_.GetValue(path, &value))
61 return value;
62 return NULL;
63 }
64
65 CrosSettingsProvider::TrustedStatus
66 StubCrosSettingsProvider::PrepareTrustedValues(const base::Closure& cb) {
67 // We don't have a trusted store so all values are available immediately.
68 return TRUSTED;
69 }
70
71 bool StubCrosSettingsProvider::HandlesSetting(const std::string& path) const {
72 const char** end = kHandledSettings + arraysize(kHandledSettings);
73 return std::find(kHandledSettings, end, path) != end;
74 }
75
76 void StubCrosSettingsProvider::Reload() {
77 }
78
79 void StubCrosSettingsProvider::DoSet(const std::string& path,
80 const base::Value& value) {
81 values_.SetValue(path, value.DeepCopy());
82 NotifyObservers(path);
83 }
84
85 void StubCrosSettingsProvider::SetDefaults() {
86 values_.SetBoolean(kAccountsPrefAllowGuest, true);
87 values_.SetBoolean(kAccountsPrefAllowNewUser, true);
88 values_.SetBoolean(kAccountsPrefShowUserNamesOnSignIn, true);
89 // |kDeviceOwner| will be set to the logged-in user by |UserManager|.
90 }
91
92 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/stub_cros_settings_provider.h ('k') | chrome/browser/chromeos/stub_cros_settings_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698