| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/singleton.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/cros_settings_provider.h" | 10 #include "chrome/browser/chromeos/cros_settings_provider.h" |
| 11 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 11 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 12 #include "chrome/common/notification_service.h" | 12 #include "chrome/common/notification_service.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 | 15 |
| 16 static base::LazyInstance<CrosSettings> g_cros_settings( |
| 17 base::LINKER_INITIALIZED); |
| 18 |
| 16 CrosSettings* CrosSettings::Get() { | 19 CrosSettings* CrosSettings::Get() { |
| 17 // TODO(xiyaun): Use real stuff when underlying libcros is ready. | 20 // TODO(xiyaun): Use real stuff when underlying libcros is ready. |
| 18 return Singleton<CrosSettings>::get(); | 21 return g_cros_settings.Pointer(); |
| 19 } | 22 } |
| 20 | 23 |
| 21 bool CrosSettings::IsCrosSettings(const std::string& path) { | 24 bool CrosSettings::IsCrosSettings(const std::string& path) { |
| 22 return StartsWithASCII(path, kCrosSettingsPrefix, true); | 25 return StartsWithASCII(path, kCrosSettingsPrefix, true); |
| 23 } | 26 } |
| 24 | 27 |
| 25 void CrosSettings::FireObservers(const char* path) { | 28 void CrosSettings::FireObservers(const char* path) { |
| 26 DCHECK(CalledOnValidThread()); | 29 DCHECK(CalledOnValidThread()); |
| 27 std::string path_str(path); | 30 std::string path_str(path); |
| 28 SettingsObserverMap::iterator observer_iterator = | 31 SettingsObserverMap::iterator observer_iterator = |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 200 } |
| 198 | 201 |
| 199 CrosSettings::CrosSettings() { | 202 CrosSettings::CrosSettings() { |
| 200 } | 203 } |
| 201 | 204 |
| 202 CrosSettings::~CrosSettings() { | 205 CrosSettings::~CrosSettings() { |
| 203 DCHECK(providers_.empty()); | 206 DCHECK(providers_.empty()); |
| 204 } | 207 } |
| 205 | 208 |
| 206 } // namespace chromeos | 209 } // namespace chromeos |
| OLD | NEW |