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

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: remove in_unit_test_ 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 25263bb63352e4bbf717767ab46fb81286b01e75..2f65b4f2939ede0b46c9e92211fb3b0cda2caaed 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();
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,16 @@ bool ContentSettingsHandler::GetDefaultSettingManagedFromModel(
}
}
+void ContentSettingsHandler::UpdateHandlersEnabledRadios() {
+#if defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
+ DCHECK(web_ui_);
+ FundamentalValue handlers_enabled(GetProtocolHandlerRegistry()->enabled());
+
+ web_ui_->CallJavascriptFunction("ContentSettings.updateHandlersEnabledRadios",
+ handlers_enabled);
+#endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER)
+}
+
void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() {
for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1;
type < CONTENT_SETTINGS_NUM_TYPES; ++type) {
@@ -725,6 +746,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();
« no previous file with comments | « chrome/browser/ui/webui/options/content_settings_handler.h ('k') | chrome/browser/ui/webui/options/handler_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698