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