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 <utility> | 10 #include <utility> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/profiles/profile_io_data.h" | 18 #include "chrome/browser/profiles/profile_io_data.h" |
18 #include "chrome/common/custom_handlers/protocol_handler.h" | 19 #include "chrome/common/custom_handlers/protocol_handler.h" |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 754 } |
754 | 755 |
755 base::Value* ProtocolHandlerRegistry::EncodeRegisteredHandlers() { | 756 base::Value* ProtocolHandlerRegistry::EncodeRegisteredHandlers() { |
756 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 757 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
757 base::ListValue* protocol_handlers = new base::ListValue(); | 758 base::ListValue* protocol_handlers = new base::ListValue(); |
758 for (ProtocolHandlerMultiMap::iterator i = user_protocol_handlers_.begin(); | 759 for (ProtocolHandlerMultiMap::iterator i = user_protocol_handlers_.begin(); |
759 i != user_protocol_handlers_.end(); | 760 i != user_protocol_handlers_.end(); |
760 ++i) { | 761 ++i) { |
761 for (ProtocolHandlerList::iterator j = i->second.begin(); | 762 for (ProtocolHandlerList::iterator j = i->second.begin(); |
762 j != i->second.end(); ++j) { | 763 j != i->second.end(); ++j) { |
763 base::DictionaryValue* encoded = j->Encode(); | 764 std::unique_ptr<base::DictionaryValue> encoded = j->Encode(); |
764 if (IsDefault(*j)) { | 765 if (IsDefault(*j)) { |
765 encoded->Set("default", new base::FundamentalValue(true)); | 766 encoded->Set("default", new base::FundamentalValue(true)); |
766 } | 767 } |
767 protocol_handlers->Append(encoded); | 768 protocol_handlers->Append(std::move(encoded)); |
768 } | 769 } |
769 } | 770 } |
770 return protocol_handlers; | 771 return protocol_handlers; |
771 } | 772 } |
772 | 773 |
773 base::Value* ProtocolHandlerRegistry::EncodeIgnoredHandlers() { | 774 base::Value* ProtocolHandlerRegistry::EncodeIgnoredHandlers() { |
774 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 775 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
775 base::ListValue* handlers = new base::ListValue(); | 776 base::ListValue* handlers = new base::ListValue(); |
776 for (ProtocolHandlerList::iterator i = | 777 for (ProtocolHandlerList::iterator i = |
777 user_ignored_protocol_handlers_.begin(); | 778 user_ignored_protocol_handlers_.begin(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 | 924 |
924 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 925 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
925 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { | 926 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { |
926 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 927 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
927 // this is always created on the UI thread (in profile_io's | 928 // this is always created on the UI thread (in profile_io's |
928 // InitializeOnUIThread. Any method calls must be done | 929 // InitializeOnUIThread. Any method calls must be done |
929 // on the IO thread (this is checked). | 930 // on the IO thread (this is checked). |
930 return std::unique_ptr<JobInterceptorFactory>( | 931 return std::unique_ptr<JobInterceptorFactory>( |
931 new JobInterceptorFactory(io_thread_delegate_.get())); | 932 new JobInterceptorFactory(io_thread_delegate_.get())); |
932 } | 933 } |
OLD | NEW |