| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options/handler_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/handler_options_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 base::ListValue handlers; | 133 base::ListValue handlers; |
| 134 for (std::vector<std::string>::iterator protocol = protocols.begin(); | 134 for (std::vector<std::string>::iterator protocol = protocols.begin(); |
| 135 protocol != protocols.end(); protocol++) { | 135 protocol != protocols.end(); protocol++) { |
| 136 base::DictionaryValue* handler_value = new base::DictionaryValue(); | 136 base::DictionaryValue* handler_value = new base::DictionaryValue(); |
| 137 GetHandlersForProtocol(*protocol, handler_value); | 137 GetHandlersForProtocol(*protocol, handler_value); |
| 138 handlers.Append(handler_value); | 138 handlers.Append(handler_value); |
| 139 } | 139 } |
| 140 | 140 |
| 141 std::unique_ptr<base::ListValue> ignored_handlers(new base::ListValue()); | 141 std::unique_ptr<base::ListValue> ignored_handlers(new base::ListValue()); |
| 142 GetIgnoredHandlers(ignored_handlers.get()); | 142 GetIgnoredHandlers(ignored_handlers.get()); |
| 143 web_ui()->CallJavascriptFunction("HandlerOptions.setHandlers", handlers); | 143 web_ui()->CallJavascriptFunctionUnsafe("HandlerOptions.setHandlers", |
| 144 web_ui()->CallJavascriptFunction("HandlerOptions.setIgnoredHandlers", | 144 handlers); |
| 145 *ignored_handlers); | 145 web_ui()->CallJavascriptFunctionUnsafe("HandlerOptions.setIgnoredHandlers", |
| 146 *ignored_handlers); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void HandlerOptionsHandler::RemoveHandler(const base::ListValue* args) { | 149 void HandlerOptionsHandler::RemoveHandler(const base::ListValue* args) { |
| 149 const base::ListValue* list; | 150 const base::ListValue* list; |
| 150 if (!args->GetList(0, &list)) { | 151 if (!args->GetList(0, &list)) { |
| 151 NOTREACHED(); | 152 NOTREACHED(); |
| 152 return; | 153 return; |
| 153 } | 154 } |
| 154 | 155 |
| 155 ProtocolHandler handler(ParseHandlerFromArgs(list)); | 156 ProtocolHandler handler(ParseHandlerFromArgs(list)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 int type, | 212 int type, |
| 212 const content::NotificationSource& source, | 213 const content::NotificationSource& source, |
| 213 const content::NotificationDetails& details) { | 214 const content::NotificationDetails& details) { |
| 214 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 215 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
| 215 UpdateHandlerList(); | 216 UpdateHandlerList(); |
| 216 else | 217 else |
| 217 NOTREACHED(); | 218 NOTREACHED(); |
| 218 } | 219 } |
| 219 | 220 |
| 220 } // namespace options | 221 } // namespace options |
| OLD | NEW |