| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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::Observe( | 
| 221     int type, | 221     int type, | 
| 222     const content::NotificationSource& source, | 222     const content::NotificationSource& source, | 
| 223     const content::NotificationDetails& details) { | 223     const content::NotificationDetails& details) { | 
| 224   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 224   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
|  | 225   DCHECK_EQ(chrome::NOTIFICATION_PREF_CHANGED, type); | 
|  | 226   DCHECK_EQ(content::Source<PrefService>(source).ptr(), prefs_); | 
|  | 227   DCHECK_EQ(std::string(prefs::kContentSettingsPatternPairs), | 
|  | 228             *content::Details<std::string>(details).ptr()); | 
| 225 | 229 | 
| 226   if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 230   if (updating_preferences_) | 
| 227     DCHECK_EQ(prefs_, content::Source<PrefService>(source).ptr()); | 231     return; | 
| 228     if (updating_preferences_) |  | 
| 229       return; |  | 
| 230 | 232 | 
| 231     std::string* name = content::Details<std::string>(details).ptr(); | 233   ReadContentSettingsFromPref(true); | 
| 232     if (*name != prefs::kContentSettingsPatternPairs) { |  | 
| 233       NOTREACHED() << "Unexpected preference observed"; |  | 
| 234       return; |  | 
| 235     } |  | 
| 236     ReadContentSettingsFromPref(true); |  | 
| 237 | 234 | 
| 238     NotifyObservers(ContentSettingsPattern(), | 235   NotifyObservers(ContentSettingsPattern(), | 
| 239                     ContentSettingsPattern(), | 236                   ContentSettingsPattern(), | 
| 240                     CONTENT_SETTINGS_TYPE_DEFAULT, | 237                   CONTENT_SETTINGS_TYPE_DEFAULT, | 
| 241                     std::string()); | 238                   std::string()); | 
| 242   } else { |  | 
| 243     NOTREACHED() << "Unexpected notification"; |  | 
| 244   } |  | 
| 245 } | 239 } | 
| 246 | 240 | 
| 247 PrefProvider::~PrefProvider() { | 241 PrefProvider::~PrefProvider() { | 
| 248   DCHECK(!prefs_); | 242   DCHECK(!prefs_); | 
| 249 } | 243 } | 
| 250 | 244 | 
| 251 RuleIterator* PrefProvider::GetRuleIterator( | 245 RuleIterator* PrefProvider::GetRuleIterator( | 
| 252     ContentSettingsType content_type, | 246     ContentSettingsType content_type, | 
| 253     const ResourceIdentifier& resource_identifier, | 247     const ResourceIdentifier& resource_identifier, | 
| 254     bool incognito) const { | 248     bool incognito) const { | 
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 700 | 694 | 
| 701 void PrefProvider::AssertLockNotHeld() const { | 695 void PrefProvider::AssertLockNotHeld() const { | 
| 702 #if !defined(NDEBUG) | 696 #if !defined(NDEBUG) | 
| 703   // |Lock::Acquire()| will assert if the lock is held by this thread. | 697   // |Lock::Acquire()| will assert if the lock is held by this thread. | 
| 704   lock_.Acquire(); | 698   lock_.Acquire(); | 
| 705   lock_.Release(); | 699   lock_.Release(); | 
| 706 #endif | 700 #endif | 
| 707 } | 701 } | 
| 708 | 702 | 
| 709 }  // namespace content_settings | 703 }  // namespace content_settings | 
| OLD | NEW | 
|---|