OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 DCHECK(web_ui_); | 66 DCHECK(web_ui_); |
67 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 67 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
68 } | 68 } |
69 | 69 |
70 static void GetHandlersAsListValue( | 70 static void GetHandlersAsListValue( |
71 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers, | 71 const ProtocolHandlerRegistry::ProtocolHandlerList& handlers, |
72 ListValue* handler_list) { | 72 ListValue* handler_list) { |
73 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler; | 73 ProtocolHandlerRegistry::ProtocolHandlerList::const_iterator handler; |
74 for (handler = handlers.begin(); handler != handlers.end(); ++handler) { | 74 for (handler = handlers.begin(); handler != handlers.end(); ++handler) { |
75 ListValue* handlerValue = new ListValue(); | 75 ListValue* handlerValue = new ListValue(); |
76 handlerValue->Append(Value::CreateStringValue(handler->protocol())); | 76 handlerValue->Append(base::StringValue::New(handler->protocol())); |
77 handlerValue->Append(Value::CreateStringValue(handler->url().spec())); | 77 handlerValue->Append(base::StringValue::New(handler->url().spec())); |
78 handlerValue->Append(Value::CreateStringValue(handler->title())); | 78 handlerValue->Append(base::StringValue::New(handler->title())); |
79 handler_list->Append(handlerValue); | 79 handler_list->Append(handlerValue); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 void HandlerOptionsHandler::GetHandlersForProtocol( | 83 void HandlerOptionsHandler::GetHandlersForProtocol( |
84 const std::string& protocol, | 84 const std::string& protocol, |
85 DictionaryValue* handlers_value) { | 85 DictionaryValue* handlers_value) { |
86 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); | 86 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); |
87 handlers_value->SetString("protocol", protocol); | 87 handlers_value->SetString("protocol", protocol); |
88 handlers_value->SetInteger("default_handler", | 88 handlers_value->SetInteger("default_handler", |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 | 191 |
192 void HandlerOptionsHandler::Observe(int type, | 192 void HandlerOptionsHandler::Observe(int type, |
193 const NotificationSource& source, | 193 const NotificationSource& source, |
194 const NotificationDetails& details) { | 194 const NotificationDetails& details) { |
195 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 195 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
196 UpdateHandlerList(); | 196 UpdateHandlerList(); |
197 else | 197 else |
198 NOTREACHED(); | 198 NOTREACHED(); |
199 } | 199 } |
OLD | NEW |