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/content_settings/content_settings_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 content_type, | 210 content_type, |
211 "", | 211 "", |
212 NULL); | 212 NULL); |
213 } | 213 } |
214 NotifyObservers(ContentSettingsPattern(), | 214 NotifyObservers(ContentSettingsPattern(), |
215 ContentSettingsPattern(), | 215 ContentSettingsPattern(), |
216 content_type, | 216 content_type, |
217 std::string()); | 217 std::string()); |
218 } | 218 } |
219 | 219 |
220 void PrefProvider::Observe( | 220 void PrefProvider::OnPreferenceChanged(PrefServiceBase* service, |
221 int type, | 221 const std::string& name) { |
222 const content::NotificationSource& source, | |
223 const content::NotificationDetails& details) { | |
224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
225 DCHECK_EQ(chrome::NOTIFICATION_PREF_CHANGED, type); | 223 DCHECK_EQ(prefs_, service); |
226 DCHECK_EQ(content::Source<PrefService>(source).ptr(), prefs_); | 224 DCHECK_EQ(std::string(prefs::kContentSettingsPatternPairs), name); |
227 DCHECK_EQ(std::string(prefs::kContentSettingsPatternPairs), | |
228 *content::Details<std::string>(details).ptr()); | |
229 | 225 |
230 if (updating_preferences_) | 226 if (updating_preferences_) |
231 return; | 227 return; |
232 | 228 |
233 ReadContentSettingsFromPref(true); | 229 ReadContentSettingsFromPref(true); |
234 | 230 |
235 NotifyObservers(ContentSettingsPattern(), | 231 NotifyObservers(ContentSettingsPattern(), |
236 ContentSettingsPattern(), | 232 ContentSettingsPattern(), |
237 CONTENT_SETTINGS_TYPE_DEFAULT, | 233 CONTENT_SETTINGS_TYPE_DEFAULT, |
238 std::string()); | 234 std::string()); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 690 |
695 void PrefProvider::AssertLockNotHeld() const { | 691 void PrefProvider::AssertLockNotHeld() const { |
696 #if !defined(NDEBUG) | 692 #if !defined(NDEBUG) |
697 // |Lock::Acquire()| will assert if the lock is held by this thread. | 693 // |Lock::Acquire()| will assert if the lock is held by this thread. |
698 lock_.Acquire(); | 694 lock_.Acquire(); |
699 lock_.Release(); | 695 lock_.Release(); |
700 #endif | 696 #endif |
701 } | 697 } |
702 | 698 |
703 } // namespace content_settings | 699 } // namespace content_settings |
OLD | NEW |