Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: chrome/browser/chromeos/cros_settings.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/lazy_instance.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/chrome_notification_types.h"
13 #include "content/common/content_notification_types.h"
12 #include "content/common/notification_details.h" 14 #include "content/common/notification_details.h"
13 #include "content/common/notification_source.h" 15 #include "content/common/notification_source.h"
14 #include "content/common/notification_type.h"
15 16
16 namespace chromeos { 17 namespace chromeos {
17 18
18 static base::LazyInstance<CrosSettings> g_cros_settings( 19 static base::LazyInstance<CrosSettings> g_cros_settings(
19 base::LINKER_INITIALIZED); 20 base::LINKER_INITIALIZED);
20 21
21 CrosSettings* CrosSettings::Get() { 22 CrosSettings* CrosSettings::Get() {
22 // TODO(xiyaun): Use real stuff when underlying libcros is ready. 23 // TODO(xiyaun): Use real stuff when underlying libcros is ready.
23 return g_cros_settings.Pointer(); 24 return g_cros_settings.Pointer();
24 } 25 }
25 26
26 bool CrosSettings::IsCrosSettings(const std::string& path) { 27 bool CrosSettings::IsCrosSettings(const std::string& path) {
27 return StartsWithASCII(path, kCrosSettingsPrefix, true); 28 return StartsWithASCII(path, kCrosSettingsPrefix, true);
28 } 29 }
29 30
30 void CrosSettings::FireObservers(const char* path) { 31 void CrosSettings::FireObservers(const char* path) {
31 DCHECK(CalledOnValidThread()); 32 DCHECK(CalledOnValidThread());
32 std::string path_str(path); 33 std::string path_str(path);
33 SettingsObserverMap::iterator observer_iterator = 34 SettingsObserverMap::iterator observer_iterator =
34 settings_observers_.find(path_str); 35 settings_observers_.find(path_str);
35 if (observer_iterator == settings_observers_.end()) 36 if (observer_iterator == settings_observers_.end())
36 return; 37 return;
37 38
38 NotificationObserverList::Iterator it(*(observer_iterator->second)); 39 NotificationObserverList::Iterator it(*(observer_iterator->second));
39 NotificationObserver* observer; 40 NotificationObserver* observer;
40 while ((observer = it.GetNext()) != NULL) { 41 while ((observer = it.GetNext()) != NULL) {
41 observer->Observe(NotificationType::SYSTEM_SETTING_CHANGED, 42 observer->Observe(chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED,
42 Source<CrosSettings>(this), 43 Source<CrosSettings>(this),
43 Details<std::string>(&path_str)); 44 Details<std::string>(&path_str));
44 } 45 }
45 } 46 }
46 47
47 void CrosSettings::Set(const std::string& path, Value* in_value) { 48 void CrosSettings::Set(const std::string& path, Value* in_value) {
48 DCHECK(CalledOnValidThread()); 49 DCHECK(CalledOnValidThread());
49 CrosSettingsProvider* provider; 50 CrosSettingsProvider* provider;
50 provider = GetProvider(path); 51 provider = GetProvider(path);
51 if (provider) { 52 if (provider) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 CrosSettings::CrosSettings() { 205 CrosSettings::CrosSettings() {
205 } 206 }
206 207
207 CrosSettings::~CrosSettings() { 208 CrosSettings::~CrosSettings() {
208 DCHECK(providers_.empty()); 209 DCHECK(providers_.empty());
209 } 210 }
210 211
211 } // namespace chromeos 212 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/login_library.cc ('k') | chrome/browser/chromeos/enterprise_extension_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698