| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stub_cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/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/cros_settings.h" | 9 #include "chrome/browser/chromeos/cros_settings.h" |
| 10 #include "chrome/browser/chromeos/cros_settings_names.h" | 10 #include "chrome/browser/chromeos/cros_settings_names.h" |
| 11 #include "chrome/browser/chromeos/login/user_manager.h" | 11 #include "chrome/browser/chromeos/login/user_manager.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const char* kHandledSettings[] = { | 17 const char* kHandledSettings[] = { |
| 18 kAccountsPrefAllowGuest, | 18 kAccountsPrefAllowGuest, |
| 19 kAccountsPrefAllowNewUser, | 19 kAccountsPrefAllowNewUser, |
| 20 kAccountsPrefShowUserNamesOnSignIn, | 20 kAccountsPrefShowUserNamesOnSignIn, |
| 21 kAccountsPrefUsers, | 21 kAccountsPrefUsers, |
| 22 kDeviceOwner, | 22 kDeviceOwner, |
| 23 kReleaseChannel, | 23 kReleaseChannel, |
| 24 kReportDeviceVersionInfo, |
| 25 kReportDeviceActivityTimes, |
| 26 kReportDeviceBootMode, |
| 24 kSettingProxyEverywhere, | 27 kSettingProxyEverywhere, |
| 25 kSignedDataRoamingEnabled, | 28 kSignedDataRoamingEnabled, |
| 26 kStatsReportingPref | 29 kStatsReportingPref |
| 27 }; | 30 }; |
| 28 | 31 |
| 29 } // namespace | 32 } // namespace |
| 30 | 33 |
| 31 StubCrosSettingsProvider::StubCrosSettingsProvider( | 34 StubCrosSettingsProvider::StubCrosSettingsProvider( |
| 32 const NotifyObserversCallback& notify_cb) | 35 const NotifyObserversCallback& notify_cb) |
| 33 : CrosSettingsProvider(notify_cb) { | 36 : CrosSettingsProvider(notify_cb) { |
| 34 SetDefaults(); | 37 SetDefaults(); |
| 35 } | 38 } |
| 36 | 39 |
| 40 StubCrosSettingsProvider::StubCrosSettingsProvider() |
| 41 : CrosSettingsProvider(CrosSettingsProvider::NotifyObserversCallback()) { |
| 42 SetDefaults(); |
| 43 } |
| 44 |
| 37 StubCrosSettingsProvider::~StubCrosSettingsProvider() { | 45 StubCrosSettingsProvider::~StubCrosSettingsProvider() { |
| 38 } | 46 } |
| 39 | 47 |
| 40 const base::Value* StubCrosSettingsProvider::Get( | 48 const base::Value* StubCrosSettingsProvider::Get( |
| 41 const std::string& path) const { | 49 const std::string& path) const { |
| 42 DCHECK(HandlesSetting(path)); | 50 DCHECK(HandlesSetting(path)); |
| 43 const base::Value* value; | 51 const base::Value* value; |
| 44 if (values_.GetValue(path, &value)) | 52 if (values_.GetValue(path, &value)) |
| 45 return value; | 53 return value; |
| 46 return NULL; | 54 return NULL; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 67 } | 75 } |
| 68 | 76 |
| 69 void StubCrosSettingsProvider::SetDefaults() { | 77 void StubCrosSettingsProvider::SetDefaults() { |
| 70 values_.SetBoolean(kAccountsPrefAllowGuest, true); | 78 values_.SetBoolean(kAccountsPrefAllowGuest, true); |
| 71 values_.SetBoolean(kAccountsPrefAllowNewUser, true); | 79 values_.SetBoolean(kAccountsPrefAllowNewUser, true); |
| 72 values_.SetBoolean(kAccountsPrefShowUserNamesOnSignIn, true); | 80 values_.SetBoolean(kAccountsPrefShowUserNamesOnSignIn, true); |
| 73 // |kDeviceOwner| will be set to the logged-in user by |UserManager|. | 81 // |kDeviceOwner| will be set to the logged-in user by |UserManager|. |
| 74 } | 82 } |
| 75 | 83 |
| 76 } // namespace chromeos | 84 } // namespace chromeos |
| OLD | NEW |