| 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/cros_settings.h" | 5 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 CrosSettings* CrosSettings::Get() { | 43 CrosSettings* CrosSettings::Get() { |
| 44 CHECK(g_cros_settings); | 44 CHECK(g_cros_settings); |
| 45 return g_cros_settings; | 45 return g_cros_settings; |
| 46 } | 46 } |
| 47 | 47 |
| 48 CrosSettings::CrosSettings(DeviceSettingsService* device_settings_service) { | 48 CrosSettings::CrosSettings(DeviceSettingsService* device_settings_service) { |
| 49 CrosSettingsProvider::NotifyObserversCallback notify_cb( | 49 CrosSettingsProvider::NotifyObserversCallback notify_cb( |
| 50 base::Bind(&CrosSettings::FireObservers, | 50 base::Bind(&CrosSettings::FireObservers, |
| 51 // This is safe since |this| is never deleted. | 51 // This is safe since |this| is never deleted. |
| 52 base::Unretained(this))); | 52 base::Unretained(this))); |
| 53 if (CommandLine::ForCurrentProcess()->HasSwitch( | 53 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 54 switches::kStubCrosSettings)) { | 54 switches::kStubCrosSettings)) { |
| 55 AddSettingsProvider(new StubCrosSettingsProvider(notify_cb)); | 55 AddSettingsProvider(new StubCrosSettingsProvider(notify_cb)); |
| 56 } else { | 56 } else { |
| 57 AddSettingsProvider( | 57 AddSettingsProvider( |
| 58 new DeviceSettingsProvider(notify_cb, device_settings_service)); | 58 new DeviceSettingsProvider(notify_cb, device_settings_service)); |
| 59 } | 59 } |
| 60 // System settings are not mocked currently. | 60 // System settings are not mocked currently. |
| 61 AddSettingsProvider(new SystemSettingsProvider(notify_cb)); | 61 AddSettingsProvider(new SystemSettingsProvider(notify_cb)); |
| 62 } | 62 } |
| 63 | 63 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 ScopedTestCrosSettings::ScopedTestCrosSettings() { | 322 ScopedTestCrosSettings::ScopedTestCrosSettings() { |
| 323 CrosSettings::Initialize(); | 323 CrosSettings::Initialize(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 ScopedTestCrosSettings::~ScopedTestCrosSettings() { | 326 ScopedTestCrosSettings::~ScopedTestCrosSettings() { |
| 327 CrosSettings::Shutdown(); | 327 CrosSettings::Shutdown(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace chromeos | 330 } // namespace chromeos |
| OLD | NEW |