| 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/custom_handlers/protocol_handler_registry.h" | 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 // we didn't free them they could respond to workers and try to update the | 701 // we didn't free them they could respond to workers and try to update the |
| 702 // protocol handler registry after it was deleted. | 702 // protocol handler registry after it was deleted. |
| 703 // Observers remove themselves from this list when they are deleted; so | 703 // Observers remove themselves from this list when they are deleted; so |
| 704 // we delete the last item until none are left in the list. | 704 // we delete the last item until none are left in the list. |
| 705 while (!default_client_observers_.empty()) { | 705 while (!default_client_observers_.empty()) { |
| 706 delete default_client_observers_.back(); | 706 delete default_client_observers_.back(); |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 | 709 |
| 710 // static | 710 // static |
| 711 void ProtocolHandlerRegistry::RegisterPrefs(PrefService* pref_service) { | 711 void ProtocolHandlerRegistry::RegisterUserPrefs( |
| 712 PrefServiceSyncable* pref_service) { |
| 712 pref_service->RegisterListPref(prefs::kRegisteredProtocolHandlers, | 713 pref_service->RegisterListPref(prefs::kRegisteredProtocolHandlers, |
| 713 PrefService::UNSYNCABLE_PREF); | 714 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 714 pref_service->RegisterListPref(prefs::kIgnoredProtocolHandlers, | 715 pref_service->RegisterListPref(prefs::kIgnoredProtocolHandlers, |
| 715 PrefService::UNSYNCABLE_PREF); | 716 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 716 pref_service->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true, | 717 pref_service->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true, |
| 717 PrefService::UNSYNCABLE_PREF); | 718 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 718 } | 719 } |
| 719 | 720 |
| 720 ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { | 721 ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { |
| 721 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 722 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 722 DCHECK(default_client_observers_.empty()); | 723 DCHECK(default_client_observers_.empty()); |
| 723 } | 724 } |
| 724 | 725 |
| 725 void ProtocolHandlerRegistry::PromoteHandler(const ProtocolHandler& handler) { | 726 void ProtocolHandlerRegistry::PromoteHandler(const ProtocolHandler& handler) { |
| 726 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 727 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 727 DCHECK(IsRegistered(handler)); | 728 DCHECK(IsRegistered(handler)); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 } | 876 } |
| 876 | 877 |
| 877 net::URLRequestJobFactory::Interceptor* | 878 net::URLRequestJobFactory::Interceptor* |
| 878 ProtocolHandlerRegistry::CreateURLInterceptor() { | 879 ProtocolHandlerRegistry::CreateURLInterceptor() { |
| 879 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 880 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 880 // this is always created on the UI thread (in profile_io's | 881 // this is always created on the UI thread (in profile_io's |
| 881 // InitializeOnUIThread. Any method calls must be done | 882 // InitializeOnUIThread. Any method calls must be done |
| 882 // on the IO thread (this is checked). | 883 // on the IO thread (this is checked). |
| 883 return new URLInterceptor(core_); | 884 return new URLInterceptor(core_); |
| 884 } | 885 } |
| OLD | NEW |