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

Side by Side Diff: chrome/browser/content_settings/content_settings_default_provider.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
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/content_settings/content_settings_default_provider.h" 5 #include "chrome/browser/content_settings/content_settings_default_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 void DefaultProvider::ShutdownOnUIThread() { 271 void DefaultProvider::ShutdownOnUIThread() {
272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
273 DCHECK(prefs_); 273 DCHECK(prefs_);
274 RemoveAllObservers(); 274 RemoveAllObservers();
275 pref_change_registrar_.RemoveAll(); 275 pref_change_registrar_.RemoveAll();
276 prefs_ = NULL; 276 prefs_ = NULL;
277 } 277 }
278 278
279 void DefaultProvider::Observe(int type, 279 void DefaultProvider::OnPreferenceChanged(PrefServiceBase* service,
280 const content::NotificationSource& source, 280 const std::string& name) {
281 const content::NotificationDetails& details) {
282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
283 DCHECK_EQ(chrome::NOTIFICATION_PREF_CHANGED, type); 282 DCHECK_EQ(prefs_, service);
284 DCHECK_EQ(content::Source<PrefService>(source).ptr(), prefs_);
285
286 if (updating_preferences_) 283 if (updating_preferences_)
287 return; 284 return;
288 285
289 const std::string& name = *content::Details<std::string>(details).ptr();
290 if (name == prefs::kDefaultContentSettings) { 286 if (name == prefs::kDefaultContentSettings) {
291 ReadDefaultSettings(true); 287 ReadDefaultSettings(true);
292 } else if (name == prefs::kGeolocationDefaultContentSetting) { 288 } else if (name == prefs::kGeolocationDefaultContentSetting) {
293 MigrateObsoleteGeolocationPref(); 289 MigrateObsoleteGeolocationPref();
294 // Return and don't send a notifications. Migrating the obsolete 290 // Return and don't send a notifications. Migrating the obsolete
295 // geolocation pref will change the prefs::kDefaultContentSettings and 291 // geolocation pref will change the prefs::kDefaultContentSettings and
296 // cause the notification to be fired. 292 // cause the notification to be fired.
297 return; 293 return;
298 } else { 294 } else {
299 NOTREACHED() << "Unexpected preference observed"; 295 NOTREACHED() << "Unexpected preference observed";
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 SetWebsiteSetting( 379 SetWebsiteSetting(
384 ContentSettingsPattern::Wildcard(), 380 ContentSettingsPattern::Wildcard(),
385 ContentSettingsPattern::Wildcard(), 381 ContentSettingsPattern::Wildcard(),
386 CONTENT_SETTINGS_TYPE_GEOLOCATION, 382 CONTENT_SETTINGS_TYPE_GEOLOCATION,
387 std::string(), 383 std::string(),
388 value->DeepCopy()); 384 value->DeepCopy());
389 } 385 }
390 } 386 }
391 387
392 } // namespace content_settings 388 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698