OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/url_request/url_request_job_factory.h" | 5 #include "net/url_request/url_request_job_factory.h" |
6 | 6 |
7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
10 #include "net/url_request/url_request_job_manager.h" | 10 #include "net/url_request/url_request_job_manager.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 URLRequest* request) const { | 71 URLRequest* request) const { |
72 DCHECK(CalledOnValidThread()); | 72 DCHECK(CalledOnValidThread()); |
73 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); | 73 ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); |
74 if (it == protocol_handler_map_.end()) | 74 if (it == protocol_handler_map_.end()) |
75 return NULL; | 75 return NULL; |
76 return it->second->MaybeCreateJob(request); | 76 return it->second->MaybeCreateJob(request); |
77 } | 77 } |
78 | 78 |
79 bool URLRequestJobFactory::IsHandledProtocol(const std::string& scheme) const { | 79 bool URLRequestJobFactory::IsHandledProtocol(const std::string& scheme) const { |
80 DCHECK(CalledOnValidThread()); | 80 DCHECK(CalledOnValidThread()); |
| 81 InterceptorList::const_iterator i; |
| 82 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) { |
| 83 if ((*i)->WillHandleProtocol(scheme)) |
| 84 return true; |
| 85 } |
81 return ContainsKey(protocol_handler_map_, scheme) || | 86 return ContainsKey(protocol_handler_map_, scheme) || |
82 URLRequestJobManager::GetInstance()->SupportsScheme(scheme); | 87 URLRequestJobManager::GetInstance()->SupportsScheme(scheme); |
83 } | 88 } |
84 | 89 |
85 bool URLRequestJobFactory::IsHandledURL(const GURL& url) const { | 90 bool URLRequestJobFactory::IsHandledURL(const GURL& url) const { |
86 if (!url.is_valid()) { | 91 if (!url.is_valid()) { |
87 // We handle error cases. | 92 // We handle error cases. |
88 return true; | 93 return true; |
89 } | 94 } |
90 return IsHandledProtocol(url.scheme()); | 95 return IsHandledProtocol(url.scheme()); |
91 } | 96 } |
92 | 97 |
93 } // namespace net | 98 } // namespace net |
OLD | NEW |