| 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/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 Loading... |
| 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::kPepperFlashSettingsEnabled, this); | 491 pref_change_registrar_.Add( |
| 492 prefs::kPepperFlashSettingsEnabled, |
| 493 base::Bind(&ContentSettingsHandler::RefreshFlashSettingsCache, |
| 494 base::Unretained(this), |
| 495 false)); |
| 492 | 496 |
| 493 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, profile)); | 497 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, profile)); |
| 494 } | 498 } |
| 495 | 499 |
| 496 void ContentSettingsHandler::InitializePage() { | 500 void ContentSettingsHandler::InitializePage() { |
| 497 UpdateHandlersEnabledRadios(); | 501 UpdateHandlersEnabledRadios(); |
| 498 UpdateAllExceptionsViewsFromModel(); | 502 UpdateAllExceptionsViewsFromModel(); |
| 499 | 503 |
| 500 flash_cameramic_settings_ = CachedPepperFlashSettings(); | 504 flash_cameramic_settings_ = CachedPepperFlashSettings(); |
| 501 RefreshFlashSettingsCache(true); | 505 RefreshFlashSettingsCache(true); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { | 553 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { |
| 550 UpdateHandlersEnabledRadios(); | 554 UpdateHandlersEnabledRadios(); |
| 551 break; | 555 break; |
| 552 } | 556 } |
| 553 | 557 |
| 554 default: | 558 default: |
| 555 OptionsPageUIHandler::Observe(type, source, details); | 559 OptionsPageUIHandler::Observe(type, source, details); |
| 556 } | 560 } |
| 557 } | 561 } |
| 558 | 562 |
| 559 void ContentSettingsHandler::OnPreferenceChanged(PrefServiceBase* service, | |
| 560 const std::string& pref_name) { | |
| 561 DCHECK_EQ(pref_name, std::string(prefs::kPepperFlashSettingsEnabled)); | |
| 562 RefreshFlashSettingsCache(false); | |
| 563 } | |
| 564 | |
| 565 void ContentSettingsHandler::OnGetPermissionSettingsCompleted( | 563 void ContentSettingsHandler::OnGetPermissionSettingsCompleted( |
| 566 uint32 request_id, | 564 uint32 request_id, |
| 567 bool success, | 565 bool success, |
| 568 PP_Flash_BrowserOperations_Permission default_permission, | 566 PP_Flash_BrowserOperations_Permission default_permission, |
| 569 const ppapi::FlashSiteSettings& sites) { | 567 const ppapi::FlashSiteSettings& sites) { |
| 570 if (success && | 568 if (success && |
| 571 request_id == flash_cameramic_settings_.last_refresh_request_id) { | 569 request_id == flash_cameramic_settings_.last_refresh_request_id) { |
| 572 flash_cameramic_settings_.default_permission = default_permission; | 570 flash_cameramic_settings_.default_permission = default_permission; |
| 573 flash_cameramic_settings_.sites.clear(); | 571 flash_cameramic_settings_.sites.clear(); |
| 574 for (ppapi::FlashSiteSettings::const_iterator iter = sites.begin(); | 572 for (ppapi::FlashSiteSettings::const_iterator iter = sites.begin(); |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { | 1312 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { |
| 1315 if (type == kExContentSettingsTypeGroupNames[i].type) | 1313 if (type == kExContentSettingsTypeGroupNames[i].type) |
| 1316 return kExContentSettingsTypeGroupNames[i].name; | 1314 return kExContentSettingsTypeGroupNames[i].name; |
| 1317 } | 1315 } |
| 1318 | 1316 |
| 1319 NOTREACHED(); | 1317 NOTREACHED(); |
| 1320 return std::string(); | 1318 return std::string(); |
| 1321 } | 1319 } |
| 1322 | 1320 |
| 1323 } // namespace options | 1321 } // namespace options |
| OLD | NEW |