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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 handlerValue->Append(new base::StringValue(handler->url().spec())); | 99 handlerValue->Append(new base::StringValue(handler->url().spec())); |
100 handlerValue->Append(new base::StringValue(handler->url().host())); | 100 handlerValue->Append(new base::StringValue(handler->url().host())); |
101 handler_list->Append(handlerValue); | 101 handler_list->Append(handlerValue); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 void HandlerOptionsHandler::GetHandlersForProtocol( | 105 void HandlerOptionsHandler::GetHandlersForProtocol( |
106 const std::string& protocol, | 106 const std::string& protocol, |
107 base::DictionaryValue* handlers_value) { | 107 base::DictionaryValue* handlers_value) { |
108 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); | 108 ProtocolHandlerRegistry* registry = GetProtocolHandlerRegistry(); |
| 109 // The items which are to be written into |handlers_value| are also described |
| 110 // in chrome/browser/resources/options/handler_options.js in @typedef |
| 111 // for Handlers. Please update them whenever you add or remove any keys here. |
109 handlers_value->SetString("protocol", protocol); | 112 handlers_value->SetString("protocol", protocol); |
110 handlers_value->SetInteger("default_handler", | 113 handlers_value->SetInteger("default_handler", |
111 registry->GetHandlerIndex(protocol)); | 114 registry->GetHandlerIndex(protocol)); |
112 handlers_value->SetBoolean( | 115 handlers_value->SetBoolean( |
113 "is_default_handler_set_by_user", | 116 "is_default_handler_set_by_user", |
114 registry->IsRegisteredByUser(registry->GetHandlerFor(protocol))); | 117 registry->IsRegisteredByUser(registry->GetHandlerFor(protocol))); |
115 handlers_value->SetBoolean("has_policy_recommendations", | 118 handlers_value->SetBoolean("has_policy_recommendations", |
116 registry->HasPolicyRegisteredHandler(protocol)); | 119 registry->HasPolicyRegisteredHandler(protocol)); |
117 | 120 |
118 base::ListValue* handlers_list = new base::ListValue(); | 121 base::ListValue* handlers_list = new base::ListValue(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 int type, | 216 int type, |
214 const content::NotificationSource& source, | 217 const content::NotificationSource& source, |
215 const content::NotificationDetails& details) { | 218 const content::NotificationDetails& details) { |
216 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 219 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
217 UpdateHandlerList(); | 220 UpdateHandlerList(); |
218 else | 221 else |
219 NOTREACHED(); | 222 NOTREACHED(); |
220 } | 223 } |
221 | 224 |
222 } // namespace options | 225 } // namespace options |
OLD | NEW |