Chromium Code Reviews| Index: chrome/browser/ui/webui/options/content_settings_handler.cc |
| diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc |
| index 25263bb63352e4bbf717767ab46fb81286b01e75..fd9b480b7ab4970c0b3e6bb0384b185f91e86f31 100644 |
| --- a/chrome/browser/ui/webui/options/content_settings_handler.cc |
| +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc |
| @@ -14,6 +14,7 @@ |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/content_settings/content_settings_details.h" |
| #include "chrome/browser/content_settings/host_content_settings_map.h" |
| +#include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| #include "chrome/browser/notifications/desktop_notification_service.h" |
| #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| @@ -202,6 +203,7 @@ void ContentSettingsHandler::GetLocalizedValues( |
| { "examplePattern", IDS_EXCEPTIONS_PATTERN_EXAMPLE }, |
| { "addNewExceptionInstructions", IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS }, |
| { "manage_exceptions", IDS_EXCEPTIONS_MANAGE }, |
| + { "manage_handlers", IDS_HANDLERS_MANAGE }, |
| { "exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER }, |
| { "exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER }, |
| // Cookies filter. |
| @@ -274,6 +276,7 @@ void ContentSettingsHandler::Initialize() { |
| this, NotificationType::PROFILE_DESTROYED, |
| NotificationService::AllSources()); |
| + UpdateHandlersEnabledRadios(); |
|
tony
2011/05/23 21:42:00
Should this be part of UpdateAllExceptionsViewsFro
koz (OOO until 15th September)
2011/05/24 08:47:49
I think not, because it's not an exceptions view.
|
| UpdateAllExceptionsViewsFromModel(); |
| notification_registrar_.Add( |
| this, NotificationType::CONTENT_SETTINGS_CHANGED, |
| @@ -284,6 +287,9 @@ void ContentSettingsHandler::Initialize() { |
| notification_registrar_.Add( |
| this, NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, |
| NotificationService::AllSources()); |
| + notification_registrar_.Add( |
| + this, NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, |
| + NotificationService::AllSources()); |
| PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); |
| pref_change_registrar_.Init(prefs); |
| @@ -340,6 +346,11 @@ void ContentSettingsHandler::Observe(NotificationType type, |
| break; |
| } |
| + case NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED: { |
| + UpdateHandlersEnabledRadios(); |
| + break; |
| + } |
| + |
| default: |
| OptionsPageUIHandler::Observe(type, source, details); |
| } |
| @@ -386,6 +397,14 @@ bool ContentSettingsHandler::GetDefaultSettingManagedFromModel( |
| } |
| } |
| +void ContentSettingsHandler::UpdateHandlersEnabledRadios() { |
| + DCHECK(web_ui_); |
| + FundamentalValue* handlers_enabled = Value::CreateBooleanValue( |
| + GetProtocolHandlerRegistry()->enabled()); |
|
tony
2011/05/23 21:42:00
It looks like this is leaked. Can you just stack
koz (OOO until 15th September)
2011/05/24 08:47:49
Done.
|
| + web_ui_->CallJavascriptFunction("ContentSettings.updateHandlersEnabledRadios", |
| + *handlers_enabled); |
| +} |
| + |
| void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { |
| for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
| type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
| @@ -725,6 +744,10 @@ HostContentSettingsMap* ContentSettingsHandler::GetContentSettingsMap() { |
| return web_ui_->GetProfile()->GetHostContentSettingsMap(); |
| } |
| +ProtocolHandlerRegistry* ContentSettingsHandler::GetProtocolHandlerRegistry() { |
| + return web_ui_->GetProfile()->GetProtocolHandlerRegistry(); |
| +} |
| + |
| HostContentSettingsMap* |
| ContentSettingsHandler::GetOTRContentSettingsMap() { |
| Profile* profile = web_ui_->GetProfile(); |