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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR. 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 // TODO(estade): we pretend update_all() is always true. 533 // TODO(estade): we pretend update_all() is always true.
534 if (settings_details->update_all_types()) { 534 if (settings_details->update_all_types()) {
535 UpdateAllExceptionsViewsFromModel(); 535 UpdateAllExceptionsViewsFromModel();
536 } else { 536 } else {
537 UpdateExceptionsViewFromModel( 537 UpdateExceptionsViewFromModel(
538 ExContentSettingsType(settings_details->type())); 538 ExContentSettingsType(settings_details->type()));
539 } 539 }
540 break; 540 break;
541 } 541 }
542 542
543 case chrome::NOTIFICATION_PREF_CHANGED: {
544 const std::string& pref_name =
545 *content::Details<std::string>(details).ptr();
546 if (pref_name == prefs::kGeolocationContentSettings)
547 UpdateGeolocationExceptionsView();
548 else if (pref_name == prefs::kPepperFlashSettingsEnabled)
549 RefreshFlashSettingsCache(false);
550
551 break;
552 }
553
554 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { 543 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: {
555 UpdateNotificationExceptionsView(); 544 UpdateNotificationExceptionsView();
556 break; 545 break;
557 } 546 }
558 547
559 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { 548 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: {
560 UpdateHandlersEnabledRadios(); 549 UpdateHandlersEnabledRadios();
561 break; 550 break;
562 } 551 }
563 552
564 default: 553 default:
565 OptionsPageUIHandler::Observe(type, source, details); 554 OptionsPageUIHandler::Observe(type, source, details);
566 } 555 }
567 } 556 }
568 557
558 void ContentSettingsHandler::OnPreferenceChanged(PrefServiceBase* service,
559 const std::string& pref_name) {
560 if (pref_name == prefs::kGeolocationContentSettings)
561 UpdateGeolocationExceptionsView();
562 else if (pref_name == prefs::kPepperFlashSettingsEnabled)
563 RefreshFlashSettingsCache(false);
564 }
565
569 void ContentSettingsHandler::OnGetPermissionSettingsCompleted( 566 void ContentSettingsHandler::OnGetPermissionSettingsCompleted(
570 uint32 request_id, 567 uint32 request_id,
571 bool success, 568 bool success,
572 PP_Flash_BrowserOperations_Permission default_permission, 569 PP_Flash_BrowserOperations_Permission default_permission,
573 const ppapi::FlashSiteSettings& sites) { 570 const ppapi::FlashSiteSettings& sites) {
574 if (success && 571 if (success &&
575 request_id == flash_cameramic_settings_.last_refresh_request_id) { 572 request_id == flash_cameramic_settings_.last_refresh_request_id) {
576 flash_cameramic_settings_.default_permission = default_permission; 573 flash_cameramic_settings_.default_permission = default_permission;
577 flash_cameramic_settings_.sites.clear(); 574 flash_cameramic_settings_.sites.clear();
578 for (ppapi::FlashSiteSettings::const_iterator iter = sites.begin(); 575 for (ppapi::FlashSiteSettings::const_iterator iter = sites.begin();
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { 1315 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) {
1319 if (type == kExContentSettingsTypeGroupNames[i].type) 1316 if (type == kExContentSettingsTypeGroupNames[i].type)
1320 return kExContentSettingsTypeGroupNames[i].name; 1317 return kExContentSettingsTypeGroupNames[i].name;
1321 } 1318 }
1322 1319
1323 NOTREACHED(); 1320 NOTREACHED();
1324 return std::string(); 1321 return std::string();
1325 } 1322 }
1326 1323
1327 } // namespace options 1324 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698