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> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 return job_factory_->MaybeInterceptResponse(request, network_delegate); | 209 return job_factory_->MaybeInterceptResponse(request, network_delegate); |
210 } | 210 } |
211 | 211 |
212 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledProtocol( | 212 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledProtocol( |
213 const std::string& scheme) const { | 213 const std::string& scheme) const { |
214 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 214 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
215 return io_thread_delegate_->IsHandledProtocol(scheme) || | 215 return io_thread_delegate_->IsHandledProtocol(scheme) || |
216 job_factory_->IsHandledProtocol(scheme); | 216 job_factory_->IsHandledProtocol(scheme); |
217 } | 217 } |
218 | 218 |
219 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledURL( | |
220 const GURL& url) const { | |
221 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
222 return (url.is_valid() && | |
223 io_thread_delegate_->IsHandledProtocol(url.scheme())) || | |
224 job_factory_->IsHandledURL(url); | |
225 } | |
226 | |
227 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsSafeRedirectTarget( | 219 bool ProtocolHandlerRegistry::JobInterceptorFactory::IsSafeRedirectTarget( |
228 const GURL& location) const { | 220 const GURL& location) const { |
229 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 221 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
230 return job_factory_->IsSafeRedirectTarget(location); | 222 return job_factory_->IsSafeRedirectTarget(location); |
231 } | 223 } |
232 | 224 |
233 // Delegate -------------------------------------------------------------------- | 225 // Delegate -------------------------------------------------------------------- |
234 | 226 |
235 ProtocolHandlerRegistry::Delegate::~Delegate() {} | 227 ProtocolHandlerRegistry::Delegate::~Delegate() {} |
236 | 228 |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 | 916 |
925 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 917 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
926 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { | 918 ProtocolHandlerRegistry::CreateJobInterceptorFactory() { |
927 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 919 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
928 // 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 |
929 // InitializeOnUIThread. Any method calls must be done | 921 // InitializeOnUIThread. Any method calls must be done |
930 // on the IO thread (this is checked). | 922 // on the IO thread (this is checked). |
931 return std::unique_ptr<JobInterceptorFactory>( | 923 return std::unique_ptr<JobInterceptorFactory>( |
932 new JobInterceptorFactory(io_thread_delegate_.get())); | 924 new JobInterceptorFactory(io_thread_delegate_.get())); |
933 } | 925 } |
OLD | NEW |