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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 11421029: Remove PrefObserver usages, batch 13. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/ui/webui/options/content_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 notification_registrar_.Add( 481 notification_registrar_.Add(
482 this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, 482 this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
483 content::NotificationService::AllSources()); 483 content::NotificationService::AllSources());
484 Profile* profile = Profile::FromWebUI(web_ui()); 484 Profile* profile = Profile::FromWebUI(web_ui());
485 notification_registrar_.Add( 485 notification_registrar_.Add(
486 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, 486 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
487 content::Source<Profile>(profile)); 487 content::Source<Profile>(profile));
488 488
489 PrefService* prefs = profile->GetPrefs(); 489 PrefService* prefs = profile->GetPrefs();
490 pref_change_registrar_.Init(prefs); 490 pref_change_registrar_.Init(prefs);
491 pref_change_registrar_.Add(prefs::kGeolocationContentSettings, this); 491 pref_change_registrar_.Add(
492 pref_change_registrar_.Add(prefs::kPepperFlashSettingsEnabled, this); 492 prefs::kGeolocationContentSettings,
493 base::Bind(&ContentSettingsHandler::UpdateGeolocationExceptionsView,
494 base::Unretained(this)));
495 pref_change_registrar_.Add(
496 prefs::kPepperFlashSettingsEnabled,
497 base::Bind(&ContentSettingsHandler::RefreshFlashSettingsCache,
498 base::Unretained(this),
499 false));
493 500
494 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, profile)); 501 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, profile));
495 } 502 }
496 503
497 void ContentSettingsHandler::InitializePage() { 504 void ContentSettingsHandler::InitializePage() {
498 UpdateHandlersEnabledRadios(); 505 UpdateHandlersEnabledRadios();
499 UpdateAllExceptionsViewsFromModel(); 506 UpdateAllExceptionsViewsFromModel();
500 507
501 flash_cameramic_settings_ = CachedPepperFlashSettings(); 508 flash_cameramic_settings_ = CachedPepperFlashSettings();
502 RefreshFlashSettingsCache(true); 509 RefreshFlashSettingsCache(true);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { 557 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: {
551 UpdateHandlersEnabledRadios(); 558 UpdateHandlersEnabledRadios();
552 break; 559 break;
553 } 560 }
554 561
555 default: 562 default:
556 OptionsPageUIHandler::Observe(type, source, details); 563 OptionsPageUIHandler::Observe(type, source, details);
557 } 564 }
558 } 565 }
559 566
560 void ContentSettingsHandler::OnPreferenceChanged(PrefServiceBase* service,
561 const std::string& pref_name) {
562 if (pref_name == prefs::kGeolocationContentSettings)
563 UpdateGeolocationExceptionsView();
564 else if (pref_name == prefs::kPepperFlashSettingsEnabled)
565 RefreshFlashSettingsCache(false);
566 }
567
568 void ContentSettingsHandler::OnGetPermissionSettingsCompleted( 567 void ContentSettingsHandler::OnGetPermissionSettingsCompleted(
569 uint32 request_id, 568 uint32 request_id,
570 bool success, 569 bool success,
571 PP_Flash_BrowserOperations_Permission default_permission, 570 PP_Flash_BrowserOperations_Permission default_permission,
572 const ppapi::FlashSiteSettings& sites) { 571 const ppapi::FlashSiteSettings& sites) {
573 if (success && 572 if (success &&
574 request_id == flash_cameramic_settings_.last_refresh_request_id) { 573 request_id == flash_cameramic_settings_.last_refresh_request_id) {
575 flash_cameramic_settings_.default_permission = default_permission; 574 flash_cameramic_settings_.default_permission = default_permission;
576 flash_cameramic_settings_.sites.clear(); 575 flash_cameramic_settings_.sites.clear();
577 for (ppapi::FlashSiteSettings::const_iterator iter = sites.begin(); 576 for (ppapi::FlashSiteSettings::const_iterator iter = sites.begin();
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { 1316 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) {
1318 if (type == kExContentSettingsTypeGroupNames[i].type) 1317 if (type == kExContentSettingsTypeGroupNames[i].type)
1319 return kExContentSettingsTypeGroupNames[i].name; 1318 return kExContentSettingsTypeGroupNames[i].name;
1320 } 1319 }
1321 1320
1322 NOTREACHED(); 1321 NOTREACHED();
1323 return std::string(); 1322 return std::string();
1324 } 1323 }
1325 1324
1326 } // namespace options 1325 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698