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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 // protocol handler registry after it was deleted. | 695 // protocol handler registry after it was deleted. |
696 // Observers remove themselves from this list when they are deleted; so | 696 // Observers remove themselves from this list when they are deleted; so |
697 // we delete the last item until none are left in the list. | 697 // we delete the last item until none are left in the list. |
698 while (!default_client_observers_.empty()) { | 698 while (!default_client_observers_.empty()) { |
699 delete default_client_observers_.back(); | 699 delete default_client_observers_.back(); |
700 } | 700 } |
701 } | 701 } |
702 | 702 |
703 // static | 703 // static |
704 void ProtocolHandlerRegistry::RegisterUserPrefs( | 704 void ProtocolHandlerRegistry::RegisterUserPrefs( |
705 PrefRegistrySyncable* registry) { | 705 user_prefs::PrefRegistrySyncable* registry) { |
706 registry->RegisterListPref(prefs::kRegisteredProtocolHandlers, | 706 registry->RegisterListPref(prefs::kRegisteredProtocolHandlers, |
707 PrefRegistrySyncable::UNSYNCABLE_PREF); | 707 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
708 registry->RegisterListPref(prefs::kIgnoredProtocolHandlers, | 708 registry->RegisterListPref(prefs::kIgnoredProtocolHandlers, |
709 PrefRegistrySyncable::UNSYNCABLE_PREF); | 709 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
710 registry->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true, | 710 registry->RegisterBooleanPref( |
711 PrefRegistrySyncable::UNSYNCABLE_PREF); | 711 prefs::kCustomHandlersEnabled, |
| 712 true, |
| 713 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
712 } | 714 } |
713 | 715 |
714 ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { | 716 ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { |
715 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 717 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
716 DCHECK(default_client_observers_.empty()); | 718 DCHECK(default_client_observers_.empty()); |
717 } | 719 } |
718 | 720 |
719 void ProtocolHandlerRegistry::PromoteHandler(const ProtocolHandler& handler) { | 721 void ProtocolHandlerRegistry::PromoteHandler(const ProtocolHandler& handler) { |
720 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 722 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
721 DCHECK(IsRegistered(handler)); | 723 DCHECK(IsRegistered(handler)); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 | 872 |
871 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 873 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
872 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { | 874 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { |
873 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 875 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
874 // this is always created on the UI thread (in profile_io's | 876 // this is always created on the UI thread (in profile_io's |
875 // InitializeOnUIThread. Any method calls must be done | 877 // InitializeOnUIThread. Any method calls must be done |
876 // on the IO thread (this is checked). | 878 // on the IO thread (this is checked). |
877 return scoped_ptr<JobInterceptorFactory>(new JobInterceptorFactory( | 879 return scoped_ptr<JobInterceptorFactory>(new JobInterceptorFactory( |
878 io_thread_delegate_)); | 880 io_thread_delegate_)); |
879 } | 881 } |
OLD | NEW |