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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ptr_util.h" | |
17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/profiles/profile_io_data.h" | 18 #include "chrome/browser/profiles/profile_io_data.h" |
20 #include "chrome/common/custom_handlers/protocol_handler.h" | 19 #include "chrome/common/custom_handlers/protocol_handler.h" |
21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
22 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
23 #include "components/pref_registry/pref_registry_syncable.h" | 22 #include "components/pref_registry/pref_registry_syncable.h" |
24 #include "components/prefs/pref_service.h" | 23 #include "components/prefs/pref_service.h" |
25 #include "components/user_prefs/user_prefs.h" | 24 #include "components/user_prefs/user_prefs.h" |
26 #include "content/public/browser/child_process_security_policy.h" | 25 #include "content/public/browser/child_process_security_policy.h" |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 base::Value* ProtocolHandlerRegistry::EncodeRegisteredHandlers() { | 748 base::Value* ProtocolHandlerRegistry::EncodeRegisteredHandlers() { |
750 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 749 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
751 base::ListValue* protocol_handlers = new base::ListValue(); | 750 base::ListValue* protocol_handlers = new base::ListValue(); |
752 for (ProtocolHandlerMultiMap::iterator i = user_protocol_handlers_.begin(); | 751 for (ProtocolHandlerMultiMap::iterator i = user_protocol_handlers_.begin(); |
753 i != user_protocol_handlers_.end(); | 752 i != user_protocol_handlers_.end(); |
754 ++i) { | 753 ++i) { |
755 for (ProtocolHandlerList::iterator j = i->second.begin(); | 754 for (ProtocolHandlerList::iterator j = i->second.begin(); |
756 j != i->second.end(); ++j) { | 755 j != i->second.end(); ++j) { |
757 std::unique_ptr<base::DictionaryValue> encoded = j->Encode(); | 756 std::unique_ptr<base::DictionaryValue> encoded = j->Encode(); |
758 if (IsDefault(*j)) { | 757 if (IsDefault(*j)) { |
759 encoded->Set("default", base::MakeUnique<base::Value>(true)); | 758 encoded->Set("default", new base::Value(true)); |
760 } | 759 } |
761 protocol_handlers->Append(std::move(encoded)); | 760 protocol_handlers->Append(std::move(encoded)); |
762 } | 761 } |
763 } | 762 } |
764 return protocol_handlers; | 763 return protocol_handlers; |
765 } | 764 } |
766 | 765 |
767 base::Value* ProtocolHandlerRegistry::EncodeIgnoredHandlers() { | 766 base::Value* ProtocolHandlerRegistry::EncodeIgnoredHandlers() { |
768 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 767 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
769 base::ListValue* handlers = new base::ListValue(); | 768 base::ListValue* handlers = new base::ListValue(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 | 916 |
918 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 917 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
919 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { | 918 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { |
920 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 919 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
921 // this is always created on the UI thread (in profile_io's | 920 // this is always created on the UI thread (in profile_io's |
922 // InitializeOnUIThread. Any method calls must be done | 921 // InitializeOnUIThread. Any method calls must be done |
923 // on the IO thread (this is checked). | 922 // on the IO thread (this is checked). |
924 return std::unique_ptr<JobInterceptorFactory>( | 923 return std::unique_ptr<JobInterceptorFactory>( |
925 new JobInterceptorFactory(io_thread_delegate_.get())); | 924 new JobInterceptorFactory(io_thread_delegate_.get())); |
926 } | 925 } |
OLD | NEW |