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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ProtocolHandlerRegistry* HandlerOptionsHandler::GetProtocolHandlerRegistry() { | 85 ProtocolHandlerRegistry* HandlerOptionsHandler::GetProtocolHandlerRegistry() { |
86 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); | 86 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); |
87 } | 87 } |
88 | 88 |
89 static void GetHandlersAsListValue( | 89 static void GetHandlersAsListValue( |
90 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers, | 90 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers, |
91 ListValue* handler_list) { | 91 ListValue* handler_list) { |
92 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler; | 92 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler; |
93 for (handler = handlers.begin(); handler != handlers.end(); ++handler) { | 93 for (handler = handlers.begin(); handler != handlers.end(); ++handler) { |
94 ListValue* handlerValue = new ListValue(); | 94 ListValue* handlerValue = new ListValue(); |
95 handlerValue->Append(Value::CreateStringValue(handler->protocol())); | 95 handlerValue->Append(new base::StringValue(handler->protocol())); |
96 handlerValue->Append(Value::CreateStringValue(handler->url().spec())); | 96 handlerValue->Append(new base::StringValue(handler->url().spec())); |
97 handlerValue->Append(Value::CreateStringValue(handler->title())); | 97 handlerValue->Append(new base::StringValue(handler->title())); |
98 handler_list->Append(handlerValue); | 98 handler_list->Append(handlerValue); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 void HandlerOptionsHandler::GetHandlersForProtocol( | 102 void HandlerOptionsHandler::GetHandlersForProtocol( |
103 const std::string& protocol, | 103 const std::string& protocol, |
104 DictionaryValue* handlers_value) { | 104 DictionaryValue* handlers_value) { |
105 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); | 105 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); |
106 handlers_value->SetString("protocol", protocol); | 106 handlers_value->SetString("protocol", protocol); |
107 handlers_value->SetInteger("default_handler", | 107 handlers_value->SetInteger("default_handler", |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 int type, | 208 int type, |
209 const content::NotificationSource& source, | 209 const content::NotificationSource& source, |
210 const content::NotificationDetails& details) { | 210 const content::NotificationDetails& details) { |
211 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 211 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
212 UpdateHandlerList(); | 212 UpdateHandlerList(); |
213 else | 213 else |
214 NOTREACHED(); | 214 NOTREACHED(); |
215 } | 215 } |
216 | 216 |
217 } // namespace options | 217 } // namespace options |
OLD | NEW |