OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/settings/protocol_handlers_handler.h" | 5 #include "chrome/browser/ui/webui/settings/protocol_handlers_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 void ProtocolHandlersHandler::HandleObserveProtocolHandlersEnabledState( | 145 void ProtocolHandlersHandler::HandleObserveProtocolHandlersEnabledState( |
146 const base::ListValue* args) { | 146 const base::ListValue* args) { |
147 AllowJavascript(); | 147 AllowJavascript(); |
148 SendHandlersEnabledValue(); | 148 SendHandlersEnabledValue(); |
149 } | 149 } |
150 | 150 |
151 void ProtocolHandlersHandler::SendHandlersEnabledValue() { | 151 void ProtocolHandlersHandler::SendHandlersEnabledValue() { |
152 CallJavascriptFunction("cr.webUIListenerCallback", | 152 CallJavascriptFunction("cr.webUIListenerCallback", |
153 base::StringValue("setHandlersEnabled"), | 153 base::StringValue("setHandlersEnabled"), |
154 base::FundamentalValue( | 154 base::Value(GetProtocolHandlerRegistry()->enabled())); |
155 GetProtocolHandlerRegistry()->enabled())); | |
156 } | 155 } |
157 | 156 |
158 void ProtocolHandlersHandler::HandleRemoveHandler(const base::ListValue* args) { | 157 void ProtocolHandlersHandler::HandleRemoveHandler(const base::ListValue* args) { |
159 const base::ListValue* list; | 158 const base::ListValue* list; |
160 if (!args->GetList(0, &list)) { | 159 if (!args->GetList(0, &list)) { |
161 NOTREACHED(); | 160 NOTREACHED(); |
162 return; | 161 return; |
163 } | 162 } |
164 | 163 |
165 ProtocolHandler handler(ParseHandlerFromArgs(list)); | 164 ProtocolHandler handler(ParseHandlerFromArgs(list)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void ProtocolHandlersHandler::Observe( | 221 void ProtocolHandlersHandler::Observe( |
223 int type, | 222 int type, |
224 const content::NotificationSource& source, | 223 const content::NotificationSource& source, |
225 const content::NotificationDetails& details) { | 224 const content::NotificationDetails& details) { |
226 DCHECK_EQ(chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, type); | 225 DCHECK_EQ(chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, type); |
227 SendHandlersEnabledValue(); | 226 SendHandlersEnabledValue(); |
228 UpdateHandlerList(); | 227 UpdateHandlerList(); |
229 } | 228 } |
230 | 229 |
231 } // namespace settings | 230 } // namespace settings |
OLD | NEW |