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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 // Observers remove themselves from this list when they are deleted; so | 720 // Observers remove themselves from this list when they are deleted; so |
721 // we delete the last item until none are left in the list. | 721 // we delete the last item until none are left in the list. |
722 while (!default_client_observers_.empty()) { | 722 while (!default_client_observers_.empty()) { |
723 delete default_client_observers_.back(); | 723 delete default_client_observers_.back(); |
724 } | 724 } |
725 } | 725 } |
726 | 726 |
727 // static | 727 // static |
728 void ProtocolHandlerRegistry::RegisterProfilePrefs( | 728 void ProtocolHandlerRegistry::RegisterProfilePrefs( |
729 user_prefs::PrefRegistrySyncable* registry) { | 729 user_prefs::PrefRegistrySyncable* registry) { |
730 registry->RegisterListPref(prefs::kRegisteredProtocolHandlers, | 730 registry->RegisterListPref(prefs::kRegisteredProtocolHandlers); |
731 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 731 registry->RegisterListPref(prefs::kIgnoredProtocolHandlers); |
732 registry->RegisterListPref(prefs::kIgnoredProtocolHandlers, | 732 registry->RegisterListPref(prefs::kPolicyRegisteredProtocolHandlers); |
733 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 733 registry->RegisterListPref(prefs::kPolicyIgnoredProtocolHandlers); |
734 registry->RegisterListPref(prefs::kPolicyRegisteredProtocolHandlers, | 734 registry->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true); |
735 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
736 registry->RegisterListPref(prefs::kPolicyIgnoredProtocolHandlers, | |
737 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
738 registry->RegisterBooleanPref( | |
739 prefs::kCustomHandlersEnabled, | |
740 true, | |
741 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
742 } | 735 } |
743 | 736 |
744 ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { | 737 ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { |
745 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 738 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
746 DCHECK(default_client_observers_.empty()); | 739 DCHECK(default_client_observers_.empty()); |
747 } | 740 } |
748 | 741 |
749 void ProtocolHandlerRegistry::PromoteHandler(const ProtocolHandler& handler) { | 742 void ProtocolHandlerRegistry::PromoteHandler(const ProtocolHandler& handler) { |
750 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 743 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
751 DCHECK(IsRegistered(handler)); | 744 DCHECK(IsRegistered(handler)); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 963 |
971 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 964 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
972 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { | 965 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { |
973 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 966 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
974 // this is always created on the UI thread (in profile_io's | 967 // this is always created on the UI thread (in profile_io's |
975 // InitializeOnUIThread. Any method calls must be done | 968 // InitializeOnUIThread. Any method calls must be done |
976 // on the IO thread (this is checked). | 969 // on the IO thread (this is checked). |
977 return scoped_ptr<JobInterceptorFactory>( | 970 return scoped_ptr<JobInterceptorFactory>( |
978 new JobInterceptorFactory(io_thread_delegate_.get())); | 971 new JobInterceptorFactory(io_thread_delegate_.get())); |
979 } | 972 } |
OLD | NEW |