| 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 HandlersValue. Please update them whenever you add or remove any keys |
| 112 // here. |
| 109 handlers_value->SetString("protocol", protocol); | 113 handlers_value->SetString("protocol", protocol); |
| 110 handlers_value->SetInteger("default_handler", | 114 handlers_value->SetInteger("default_handler", |
| 111 registry->GetHandlerIndex(protocol)); | 115 registry->GetHandlerIndex(protocol)); |
| 112 handlers_value->SetBoolean( | 116 handlers_value->SetBoolean( |
| 113 "is_default_handler_set_by_user", | 117 "is_default_handler_set_by_user", |
| 114 registry->IsRegisteredByUser(registry->GetHandlerFor(protocol))); | 118 registry->IsRegisteredByUser(registry->GetHandlerFor(protocol))); |
| 115 handlers_value->SetBoolean("has_policy_recommendations", | 119 handlers_value->SetBoolean("has_policy_recommendations", |
| 116 registry->HasPolicyRegisteredHandler(protocol)); | 120 registry->HasPolicyRegisteredHandler(protocol)); |
| 117 | 121 |
| 118 base::ListValue* handlers_list = new base::ListValue(); | 122 base::ListValue* handlers_list = new base::ListValue(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 int type, | 217 int type, |
| 214 const content::NotificationSource& source, | 218 const content::NotificationSource& source, |
| 215 const content::NotificationDetails& details) { | 219 const content::NotificationDetails& details) { |
| 216 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) | 220 if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) |
| 217 UpdateHandlerList(); | 221 UpdateHandlerList(); |
| 218 else | 222 else |
| 219 NOTREACHED(); | 223 NOTREACHED(); |
| 220 } | 224 } |
| 221 | 225 |
| 222 } // namespace options | 226 } // namespace options |
| OLD | NEW |