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

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 7033018: Handler settings page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responded to comments Created 9 years, 7 months 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 side-by-side diff with in-line comments
Download patch
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 7f76ed8e30956ef86aae6aadb7dc6105dba238b5..cd26c255b8190fdfc0da54452e572ad43e0f025d 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -11,6 +11,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"
@@ -199,6 +200,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.
@@ -271,6 +273,7 @@ void ContentSettingsHandler::Initialize() {
this, NotificationType::PROFILE_DESTROYED,
NotificationService::AllSources());
+ UpdateHandlersEnabledRadios();
UpdateAllExceptionsViewsFromModel();
notification_registrar_.Add(
this, NotificationType::CONTENT_SETTINGS_CHANGED,
@@ -281,6 +284,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);
@@ -337,6 +343,11 @@ void ContentSettingsHandler::Observe(NotificationType type,
break;
}
+ case NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED: {
+ UpdateHandlersEnabledRadios();
+ break;
+ }
+
default:
OptionsPageUIHandler::Observe(type, source, details);
}
@@ -383,6 +394,14 @@ bool ContentSettingsHandler::GetDefaultSettingManagedFromModel(
}
}
+void ContentSettingsHandler::UpdateHandlersEnabledRadios() {
+ DCHECK(web_ui_);
+ FundamentalValue* handlers_enabled = Value::CreateBooleanValue(
+ GetProtocolHandlerRegistry()->enabled());
+ web_ui_->CallJavascriptFunction("ContentSettings.updateHandlersEnabledRadios",
+ *handlers_enabled);
+}
+
void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() {
for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1;
type < CONTENT_SETTINGS_NUM_TYPES; ++type) {
@@ -721,6 +740,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();

Powered by Google App Engine
This is Rietveld 408576698