| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 DCHECK(!callback.is_null()); | 265 DCHECK(!callback.is_null()); |
| 266 DCHECK(CalledOnValidThread()); | 266 DCHECK(CalledOnValidThread()); |
| 267 | 267 |
| 268 if (!GetProvider(path)) { | 268 if (!GetProvider(path)) { |
| 269 NOTREACHED() << "Trying to add an observer for an unregistered setting: " | 269 NOTREACHED() << "Trying to add an observer for an unregistered setting: " |
| 270 << path; | 270 << path; |
| 271 return scoped_ptr<CrosSettings::ObserverSubscription>(); | 271 return scoped_ptr<CrosSettings::ObserverSubscription>(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 // Get the callback registry associated with the path. | 274 // Get the callback registry associated with the path. |
| 275 base::CallbackRegistry<void>* registry = NULL; | 275 base::CallbackRegistry<void(void)>* registry = NULL; |
| 276 SettingsObserverMap::iterator observer_iterator = | 276 SettingsObserverMap::iterator observer_iterator = |
| 277 settings_observers_.find(path); | 277 settings_observers_.find(path); |
| 278 if (observer_iterator == settings_observers_.end()) { | 278 if (observer_iterator == settings_observers_.end()) { |
| 279 registry = new base::CallbackRegistry<void>; | 279 registry = new base::CallbackRegistry<void(void)>; |
| 280 settings_observers_[path] = registry; | 280 settings_observers_[path] = registry; |
| 281 } else { | 281 } else { |
| 282 registry = observer_iterator->second; | 282 registry = observer_iterator->second; |
| 283 } | 283 } |
| 284 | 284 |
| 285 return registry->Add(callback); | 285 return registry->Add(callback); |
| 286 } | 286 } |
| 287 | 287 |
| 288 CrosSettingsProvider* CrosSettings::GetProvider( | 288 CrosSettingsProvider* CrosSettings::GetProvider( |
| 289 const std::string& path) const { | 289 const std::string& path) const { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 306 | 306 |
| 307 ScopedTestCrosSettings::ScopedTestCrosSettings() { | 307 ScopedTestCrosSettings::ScopedTestCrosSettings() { |
| 308 CrosSettings::Initialize(); | 308 CrosSettings::Initialize(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 ScopedTestCrosSettings::~ScopedTestCrosSettings() { | 311 ScopedTestCrosSettings::~ScopedTestCrosSettings() { |
| 312 CrosSettings::Shutdown(); | 312 CrosSettings::Shutdown(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace chromeos | 315 } // namespace chromeos |
| OLD | NEW |