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

Unified Diff: chrome/browser/ui/webui/settings/protocol_handlers_handler.cc

Issue 2598893002: [MD settings] lighter weight initializer for protocol handler enabled messages (Closed)
Patch Set: review changes Created 4 years 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/settings/protocol_handlers_handler.cc
diff --git a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
index 2e9c467140353b24c3a7ced2f1d6e7c56bda7386..8ede9b3f6a2a86dc37fbd0b5b4c9b4ff3d1455cb 100644
--- a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
+++ b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
@@ -40,9 +40,13 @@ void ProtocolHandlersHandler::OnJavascriptDisallowed() {
}
void ProtocolHandlersHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback("initializeProtocolHandlerList",
- base::Bind(&ProtocolHandlersHandler::HandleInitializeList,
+ web_ui()->RegisterMessageCallback("observeProtocolHandlers",
+ base::Bind(&ProtocolHandlersHandler::HandleObserveProtocolHandlers,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("observeProtocolHandlersEnabledState",
+ base::Bind(
+ &ProtocolHandlersHandler::HandleObserveProtocolHandlersEnabledState,
+ base::Unretained(this)));
web_ui()->RegisterMessageCallback("clearDefault",
base::Bind(&ProtocolHandlersHandler::HandleClearDefault,
base::Unretained(this)));
@@ -131,13 +135,19 @@ void ProtocolHandlersHandler::UpdateHandlerList() {
*ignored_handlers);
}
-void ProtocolHandlersHandler::HandleInitializeList(
+void ProtocolHandlersHandler::HandleObserveProtocolHandlers(
const base::ListValue* args) {
AllowJavascript();
SendHandlersEnabledValue();
UpdateHandlerList();
}
+void ProtocolHandlersHandler::HandleObserveProtocolHandlersEnabledState(
+ const base::ListValue* args) {
+ AllowJavascript();
+ SendHandlersEnabledValue();
+}
+
void ProtocolHandlersHandler::SendHandlersEnabledValue() {
CallJavascriptFunction("cr.webUIListenerCallback",
base::StringValue("setHandlersEnabled"),

Powered by Google App Engine
This is Rietveld 408576698