| 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/custom_handlers/protocol_handler_registry.h" | 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/custom_handlers/protocol_handler.h" | 8 #include "chrome/browser/custom_handlers/protocol_handler.h" |
| 9 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" | 9 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" |
| 10 #include "chrome/browser/net/chrome_url_request_context.h" | 10 #include "chrome/browser/net/chrome_url_request_context.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 const ProtocolHandler& handler) { | 267 const ProtocolHandler& handler) { |
| 268 } | 268 } |
| 269 | 269 |
| 270 void ProtocolHandlerRegistry::OnIgnoreRegisterProtocolHandler( | 270 void ProtocolHandlerRegistry::OnIgnoreRegisterProtocolHandler( |
| 271 const ProtocolHandler& handler) { | 271 const ProtocolHandler& handler) { |
| 272 IgnoreProtocolHandler(handler); | 272 IgnoreProtocolHandler(handler); |
| 273 Save(); | 273 Save(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void ProtocolHandlerRegistry::RegisterPrefs(PrefService* prefService) { | 276 void ProtocolHandlerRegistry::RegisterPrefs(PrefService* prefService) { |
| 277 prefService->RegisterListPref(prefs::kRegisteredProtocolHandlers); | 277 prefService->RegisterListPref(prefs::kRegisteredProtocolHandlers, |
| 278 prefService->RegisterListPref(prefs::kIgnoredProtocolHandlers); | 278 PrefService::UNSYNCABLE_PREF); |
| 279 prefService->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true); | 279 prefService->RegisterListPref(prefs::kIgnoredProtocolHandlers, |
| 280 PrefService::UNSYNCABLE_PREF); |
| 281 prefService->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true, |
| 282 PrefService::UNSYNCABLE_PREF); |
| 280 } | 283 } |
| 281 | 284 |
| 282 void ProtocolHandlerRegistry::SetDefault(const ProtocolHandler& handler) { | 285 void ProtocolHandlerRegistry::SetDefault(const ProtocolHandler& handler) { |
| 283 default_handlers_[handler.protocol()] = handler; | 286 default_handlers_[handler.protocol()] = handler; |
| 284 Save(); | 287 Save(); |
| 285 } | 288 } |
| 286 | 289 |
| 287 void ProtocolHandlerRegistry::ClearDefault(const std::string& scheme) { | 290 void ProtocolHandlerRegistry::ClearDefault(const std::string& scheme) { |
| 288 default_handlers_.erase(scheme); | 291 default_handlers_.erase(scheme); |
| 289 Save(); | 292 Save(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 337 |
| 335 void ProtocolHandlerRegistry::Delegate::DeregisterExternalHandler( | 338 void ProtocolHandlerRegistry::Delegate::DeregisterExternalHandler( |
| 336 const std::string& protocol) { | 339 const std::string& protocol) { |
| 337 net::URLRequest::RegisterProtocolFactory(protocol, NULL); | 340 net::URLRequest::RegisterProtocolFactory(protocol, NULL); |
| 338 } | 341 } |
| 339 | 342 |
| 340 bool ProtocolHandlerRegistry::Delegate::IsExternalHandlerRegistered( | 343 bool ProtocolHandlerRegistry::Delegate::IsExternalHandlerRegistered( |
| 341 const std::string& protocol) { | 344 const std::string& protocol) { |
| 342 return net::URLRequest::IsHandledProtocol(protocol); | 345 return net::URLRequest::IsHandledProtocol(protocol); |
| 343 } | 346 } |
| OLD | NEW |