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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return ProtocolHandlerRegistryFactory::GetForBrowserContext( | 83 return ProtocolHandlerRegistryFactory::GetForBrowserContext( |
84 Profile::FromWebUI(web_ui())); | 84 Profile::FromWebUI(web_ui())); |
85 } | 85 } |
86 | 86 |
87 static void GetHandlersAsListValue( | 87 static void GetHandlersAsListValue( |
88 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers, | 88 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers, |
89 base::ListValue* handler_list) { | 89 base::ListValue* handler_list) { |
90 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler; | 90 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler; |
91 for (handler = handlers.begin(); handler != handlers.end(); ++handler) { | 91 for (handler = handlers.begin(); handler != handlers.end(); ++handler) { |
92 base::ListValue* handlerValue = new base::ListValue(); | 92 base::ListValue* handlerValue = new base::ListValue(); |
93 handlerValue->Append(new base::StringValue(handler->protocol())); | 93 handlerValue->AppendString(handler->protocol()); |
94 handlerValue->Append(new base::StringValue(handler->url().spec())); | 94 handlerValue->AppendString(handler->url().spec()); |
95 handlerValue->Append(new base::StringValue(handler->url().host())); | 95 handlerValue->AppendString(handler->url().host()); |
96 handler_list->Append(handlerValue); | 96 handler_list->Append(handlerValue); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 void HandlerOptionsHandler::GetHandlersForProtocol( | 100 void HandlerOptionsHandler::GetHandlersForProtocol( |
101 const std::string& protocol, | 101 const std::string& protocol, |
102 base::DictionaryValue* handlers_value) { | 102 base::DictionaryValue* handlers_value) { |
103 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); | 103 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); |
104 // The items which are to be written into |handlers_value| are also described | 104 // The items which are to be written into |handlers_value| are also described |
105 // in chrome/browser/resources/options/handler_options.js in @typedef | 105 // in chrome/browser/resources/options/handler_options.js in @typedef |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 int type, | 211 int type, |
212 const content::NotificationSource& source, | 212 const content::NotificationSource& source, |
213 const content::NotificationDetails& details) { | 213 const content::NotificationDetails& details) { |
214 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 214 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
215 UpdateHandlerList(); | 215 UpdateHandlerList(); |
216 else | 216 else |
217 NOTREACHED(); | 217 NOTREACHED(); |
218 } | 218 } |
219 | 219 |
220 } // namespace options | 220 } // namespace options |
OLD | NEW |