Chromium Code Reviews| 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/cros_settings.h" | 5 #include "chrome/browser/chromeos/cros_settings.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 7 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 8 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 10 #include "base/values.h" | 11 #include "base/values.h" |
| 11 #include "chrome/browser/chromeos/device_settings_provider.h" | 12 #include "chrome/browser/chromeos/device_settings_provider.h" |
| 13 #include "chrome/browser/chromeos/stub_cros_settings_provider.h" | |
| 12 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h" | 14 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chrome/common/chrome_switches.h" | |
| 14 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 15 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 16 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
| 17 | 20 |
| 18 namespace chromeos { | 21 namespace chromeos { |
| 19 | 22 |
| 20 static base::LazyInstance<CrosSettings> g_cros_settings = | 23 static base::LazyInstance<CrosSettings> g_cros_settings = |
| 21 LAZY_INSTANCE_INITIALIZER; | 24 LAZY_INSTANCE_INITIALIZER; |
| 22 | 25 |
| 23 CrosSettings* CrosSettings::Get() { | 26 CrosSettings* CrosSettings::Get() { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 bool CrosSettings::GetList(const std::string& path, | 259 bool CrosSettings::GetList(const std::string& path, |
| 257 const base::ListValue** out_value) const { | 260 const base::ListValue** out_value) const { |
| 258 DCHECK(CalledOnValidThread()); | 261 DCHECK(CalledOnValidThread()); |
| 259 const base::Value* value = GetPref(path); | 262 const base::Value* value = GetPref(path); |
| 260 if (value) | 263 if (value) |
| 261 return value->GetAsList(out_value); | 264 return value->GetAsList(out_value); |
| 262 return false; | 265 return false; |
| 263 } | 266 } |
| 264 | 267 |
| 265 CrosSettings::CrosSettings() { | 268 CrosSettings::CrosSettings() { |
| 269 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 270 switches::kStubCrosSettings)) | |
|
Nikita (slow)
2011/12/12 11:04:57
nit: Multiline condition requires { } block.
Ivan Korotkov
2011/12/13 13:15:09
Done.
| |
| 271 AddSettingsProvider(new StubCrosSettingsProvider()); | |
| 266 AddSettingsProvider(new SystemSettingsProvider()); | 272 AddSettingsProvider(new SystemSettingsProvider()); |
| 267 AddSettingsProvider(new DeviceSettingsProvider()); | 273 AddSettingsProvider(new DeviceSettingsProvider()); |
| 268 } | 274 } |
| 269 | 275 |
| 270 CrosSettings::~CrosSettings() { | 276 CrosSettings::~CrosSettings() { |
| 271 STLDeleteElements(&providers_); | 277 STLDeleteElements(&providers_); |
| 272 STLDeleteValues(&settings_observers_); | 278 STLDeleteValues(&settings_observers_); |
| 273 } | 279 } |
| 274 | 280 |
| 275 } // namespace chromeos | 281 } // namespace chromeos |
| OLD | NEW |