Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/url_request/http_intercept_job_factory.h" | |
| 6 | |
| 7 #include "base/stl_util.h" | |
| 8 #include "googleurl/src/gurl.h" | |
| 9 #include "net/base/load_flags.h" | |
| 10 #include "net/url_request/url_request_job_manager.h" | |
| 11 | |
| 12 class GURL; | |
| 13 | |
| 14 namespace net { | |
| 15 | |
| 16 HttpInterceptJobFactory::HttpInterceptJobFactory( | |
| 17 const URLRequestJobFactory* job_factory, | |
| 18 ProtocolHandler* protocol_handler) | |
| 19 : job_factory_(job_factory), | |
| 20 protocol_handler_(protocol_handler) { | |
| 21 } | |
| 22 | |
| 23 HttpInterceptJobFactory::~HttpInterceptJobFactory() {} | |
| 24 | |
| 25 bool HttpInterceptJobFactory::SetProtocolHandler( | |
| 26 const std::string& scheme, ProtocolHandler* protocol_handler) { | |
| 27 return false; | |
| 28 } | |
| 29 | |
| 30 void HttpInterceptJobFactory::AddInterceptor(Interceptor* interceptor) { | |
| 31 // Interceptor addition is not allowed. | |
| 32 DCHECK(false); | |
|
erikwright (departed)
2012/08/16 15:49:01
NOTREACHED()
shalev
2012/08/16 18:40:39
Done.
| |
| 33 } | |
| 34 | |
| 35 URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithInterceptor( | |
| 36 URLRequest* request) const { | |
| 37 return job_factory_->MaybeCreateJobWithInterceptor(request); | |
| 38 } | |
| 39 | |
| 40 URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithProtocolHandler( | |
| 41 const std::string& scheme, URLRequest* request) const { | |
| 42 DCHECK(CalledOnValidThread()); | |
| 43 if (scheme == "http" || scheme == "https") | |
|
erikwright (departed)
2012/08/16 15:49:01
constants for http/https?
shalev
2012/08/16 18:40:39
I can't use the constant chrome::kHttpScheme becau
| |
| 44 return protocol_handler_->MaybeCreateJob(request); | |
| 45 return job_factory_->MaybeCreateJobWithProtocolHandler(scheme, request); | |
| 46 } | |
| 47 | |
| 48 URLRequestJob* HttpInterceptJobFactory::MaybeInterceptRedirect( | |
| 49 const GURL& location, URLRequest* request) const { | |
| 50 return job_factory_->MaybeInterceptRedirect(location, request); | |
| 51 } | |
| 52 | |
| 53 URLRequestJob* HttpInterceptJobFactory::MaybeInterceptResponse( | |
| 54 URLRequest* request) const { | |
| 55 return job_factory_->MaybeInterceptResponse(request); | |
| 56 } | |
| 57 | |
| 58 bool HttpInterceptJobFactory::IsHandledProtocol( | |
| 59 const std::string& scheme) const { | |
| 60 DCHECK(CalledOnValidThread()); | |
| 61 if (scheme == "http" || scheme == "https") | |
|
erikwright (departed)
2012/08/16 15:49:01
constants
shalev
2012/08/16 18:40:39
Done.
| |
| 62 return true; | |
| 63 return job_factory_->IsHandledProtocol(scheme); | |
| 64 } | |
| 65 | |
| 66 bool HttpInterceptJobFactory::IsHandledURL(const GURL& url) const { | |
| 67 if (url.scheme() == "http" || url.scheme() == "https") | |
|
erikwright (departed)
2012/08/16 15:49:01
constants
shalev
2012/08/16 18:40:39
Done.
| |
| 68 return true; | |
| 69 return job_factory_->IsHandledURL(url); | |
| 70 } | |
| 71 | |
| 72 } // namespace net | |
| OLD | NEW |