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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 net::NetworkDelegate* network_delegate) const { | 183 net::NetworkDelegate* network_delegate) const { |
184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
185 net::URLRequestJob* job = io_thread_delegate_->MaybeCreateJob( | 185 net::URLRequestJob* job = io_thread_delegate_->MaybeCreateJob( |
186 request, network_delegate); | 186 request, network_delegate); |
187 if (job) | 187 if (job) |
188 return job; | 188 return job; |
189 return job_factory_->MaybeCreateJobWithProtocolHandler( | 189 return job_factory_->MaybeCreateJobWithProtocolHandler( |
190 scheme, request, network_delegate); | 190 scheme, request, network_delegate); |
191 } | 191 } |
192 | 192 |
| 193 net::URLRequestJob* |
| 194 ProtocolHandlerRegistry::JobInterceptorFactory::MaybeInterceptRedirect( |
| 195 net::URLRequest* request, |
| 196 net::NetworkDelegate* network_delegate, |
| 197 const GURL& location) const { |
| 198 return job_factory_->MaybeInterceptRedirect( |
| 199 request, network_delegate, location); |
| 200 } |
| 201 |
| 202 net::URLRequestJob* |
| 203 ProtocolHandlerRegistry::JobInterceptorFactory::MaybeInterceptResponse( |
| 204 net::URLRequest* request, |
| 205 net::NetworkDelegate* network_delegate) const { |
| 206 return job_factory_->MaybeInterceptResponse(request, network_delegate); |
| 207 } |
| 208 |
193 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledProtocol( | 209 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledProtocol( |
194 const std::string& scheme) const { | 210 const std::string& scheme) const { |
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
196 return io_thread_delegate_->IsHandledProtocol(scheme) || | 212 return io_thread_delegate_->IsHandledProtocol(scheme) || |
197 job_factory_->IsHandledProtocol(scheme); | 213 job_factory_->IsHandledProtocol(scheme); |
198 } | 214 } |
199 | 215 |
200 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledURL( | 216 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledURL( |
201 const GURL& url) const { | 217 const GURL& url) const { |
202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 | 970 |
955 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 971 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
956 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { | 972 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { |
957 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 973 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
958 // this is always created on the UI thread (in profile_io's | 974 // this is always created on the UI thread (in profile_io's |
959 // InitializeOnUIThread. Any method calls must be done | 975 // InitializeOnUIThread. Any method calls must be done |
960 // on the IO thread (this is checked). | 976 // on the IO thread (this is checked). |
961 return scoped_ptr<JobInterceptorFactory>( | 977 return scoped_ptr<JobInterceptorFactory>( |
962 new JobInterceptorFactory(io_thread_delegate_.get())); | 978 new JobInterceptorFactory(io_thread_delegate_.get())); |
963 } | 979 } |
OLD | NEW |