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

Side by Side Diff: chrome/browser/prefs/pref_service.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/pref_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/prefs/pref_service.h" 5 #include "chrome/browser/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 return NULL; 762 return NULL;
763 } 763 }
764 const Value* value = pref->GetValue(); 764 const Value* value = pref->GetValue();
765 if (value->GetType() != Value::TYPE_LIST) { 765 if (value->GetType() != Value::TYPE_LIST) {
766 NOTREACHED(); 766 NOTREACHED();
767 return NULL; 767 return NULL;
768 } 768 }
769 return static_cast<const ListValue*>(value); 769 return static_cast<const ListValue*>(value);
770 } 770 }
771 771
772 void PrefService::AddPrefObserver(const char* path, 772 void PrefService::AddPrefObserver(const char* path, PrefObserver* obs) {
773 content::NotificationObserver* obs) {
774 pref_notifier_->AddPrefObserver(path, obs); 773 pref_notifier_->AddPrefObserver(path, obs);
775 } 774 }
776 775
777 void PrefService::RemovePrefObserver(const char* path, 776 void PrefService::RemovePrefObserver(const char* path, PrefObserver* obs) {
778 content::NotificationObserver* obs) {
779 pref_notifier_->RemovePrefObserver(path, obs); 777 pref_notifier_->RemovePrefObserver(path, obs);
780 } 778 }
781 779
780 void PrefService::AddPrefInitObserver(base::Callback<void(bool)> obs) {
781 pref_notifier_->AddInitObserver(obs);
782 }
783
782 void PrefService::RegisterPreference(const char* path, 784 void PrefService::RegisterPreference(const char* path,
783 Value* default_value, 785 Value* default_value,
784 PrefSyncStatus sync_status) { 786 PrefSyncStatus sync_status) {
785 DCHECK(CalledOnValidThread()); 787 DCHECK(CalledOnValidThread());
786 788
787 // The main code path takes ownership, but most don't. We'll be safe. 789 // The main code path takes ownership, but most don't. We'll be safe.
788 scoped_ptr<Value> scoped_value(default_value); 790 scoped_ptr<Value> scoped_value(default_value);
789 791
790 DCHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path; 792 DCHECK(!FindPreference(path)) << "Tried to register duplicate pref " << path;
791 793
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); 1059 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str());
1058 } 1060 }
1059 1061
1060 bool PrefService::Preference::IsUserModifiable() const { 1062 bool PrefService::Preference::IsUserModifiable() const {
1061 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); 1063 return pref_value_store()->PrefValueUserModifiable(name_.c_str());
1062 } 1064 }
1063 1065
1064 bool PrefService::Preference::IsExtensionModifiable() const { 1066 bool PrefService::Preference::IsExtensionModifiable() const {
1065 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); 1067 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str());
1066 } 1068 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/pref_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698