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

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

Issue 3323022: Create a DefaultPrefStore to hold registered application-default preference v... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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) 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/prefs/pref_notifier.h" 5 #include "chrome/browser/prefs/pref_notifier.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/policy/configuration_policy_pref_store.h" 9 #include "chrome/browser/policy/configuration_policy_pref_store.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 20 matching lines...) Expand all
31 LOG(WARNING) << "pref observer found at shutdown " << it->first; 31 LOG(WARNING) << "pref observer found at shutdown " << it->first;
32 } 32 }
33 } 33 }
34 34
35 STLDeleteContainerPairSecondPointers(pref_observers_.begin(), 35 STLDeleteContainerPairSecondPointers(pref_observers_.begin(),
36 pref_observers_.end()); 36 pref_observers_.end());
37 pref_observers_.clear(); 37 pref_observers_.clear();
38 } 38 }
39 39
40 void PrefNotifier::OnPreferenceSet(const char* pref_name, 40 void PrefNotifier::OnPreferenceSet(const char* pref_name,
41 PrefNotifier::PrefStoreType new_store, 41 PrefNotifier::PrefStoreType new_store) {
42 const Value* old_value) { 42 if (pref_value_store_->PrefHasChanged(pref_name, new_store))
43 if (pref_value_store_->PrefHasChanged(pref_name, new_store, old_value))
44 FireObservers(pref_name); 43 FireObservers(pref_name);
45 } 44 }
46 45
47 void PrefNotifier::OnUserPreferenceSet(const char* pref_name, 46 void PrefNotifier::OnUserPreferenceSet(const char* pref_name) {
48 const Value* old_value) { 47 OnPreferenceSet(pref_name, PrefNotifier::USER_STORE);
49 OnPreferenceSet(pref_name, PrefNotifier::USER_STORE, old_value);
50 } 48 }
51 49
52 void PrefNotifier::FireObservers(const char* path) { 50 void PrefNotifier::FireObservers(const char* path) {
53 DCHECK(CalledOnValidThread()); 51 DCHECK(CalledOnValidThread());
54 52
55 // Convert path to a std::string because the Details constructor requires a 53 // Convert path to a std::string because the Details constructor requires a
56 // class. 54 // class.
57 std::string path_str(path); 55 std::string path_str(path);
58 PrefObserverMap::iterator observer_iterator = pref_observers_.find(path_str); 56 PrefObserverMap::iterator observer_iterator = pref_observers_.find(path_str);
59 if (observer_iterator == pref_observers_.end()) 57 if (observer_iterator == pref_observers_.end())
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ChromeThread::PostTask( 130 ChromeThread::PostTask(
133 ChromeThread::UI, FROM_HERE, 131 ChromeThread::UI, FROM_HERE,
134 NewRunnableMethod( 132 NewRunnableMethod(
135 pref_value_store_, 133 pref_value_store_,
136 &PrefValueStore::RefreshPolicyPrefs, 134 &PrefValueStore::RefreshPolicyPrefs,
137 ConfigurationPolicyPrefStore::CreateManagedPolicyPrefStore(), 135 ConfigurationPolicyPrefStore::CreateManagedPolicyPrefStore(),
138 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(), 136 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(),
139 callback)); 137 callback));
140 } 138 }
141 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698