OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/url_request/http_protocol_handler.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "net/base/net_errors.h" | |
9 #include "net/url_request/url_request.h" | |
10 #include "net/url_request/url_request_error_job.h" | |
11 #include "net/url_request/url_request_http_job.h" | |
12 #include "net/url_request/url_request_redirect_job.h" | |
13 | |
14 namespace net { | |
15 | |
16 HttpProtocolHandler::HttpProtocolHandler( | |
17 HttpTransactionFactory* http_transaction_factory, | |
18 NetworkDelegate* network_delegate, | |
19 URLRequestThrottlerManager* throttler_manager, | |
20 const std::string& accept_language, | |
21 const std::string& accept_charset, | |
22 CookieStore* cookie_store, | |
23 FraudulentCertificateReporter* fraudulent_certificate_reporter, | |
24 SSLConfigService* ssl_config_service, | |
25 TransportSecurityState* transport_security_state) | |
26 : http_transaction_factory_(http_transaction_factory), | |
27 network_delegate_(network_delegate), | |
28 throttler_manager_(throttler_manager), | |
29 accept_language_(accept_language), | |
30 accept_charset_(accept_charset), | |
31 cookie_store_(cookie_store), | |
32 fraudulent_certificate_reporter_(fraudulent_certificate_reporter), | |
33 ssl_config_service_(ssl_config_service), | |
34 transport_security_state_(transport_security_state) { | |
35 } | |
36 | |
37 URLRequestJob* HttpProtocolHandler::MaybeCreateJob( | |
38 URLRequest* request) const { | |
39 if (!http_transaction_factory_) { | |
40 NOTREACHED() << "requires a valid context"; | |
41 return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); | |
mmenke
2012/07/24 15:24:34
I don't believe we need this, and I don't think we
shalev
2012/07/25 20:22:45
Done.
mmenke
2012/07/26 14:22:06
The DCHECK should be in the constructor.
shalev
2012/07/26 17:45:39
Done.
| |
42 } | |
43 | |
44 GURL redirect_url; | |
45 if (request->GetHSTSRedirect(&redirect_url)) | |
46 return new URLRequestRedirectJob(request, redirect_url); | |
47 return new URLRequestHttpJob(request, | |
48 http_transaction_factory_, | |
49 network_delegate_, | |
50 throttler_manager_, | |
51 accept_language_, | |
52 accept_charset_, | |
53 cookie_store_, | |
54 fraudulent_certificate_reporter_, | |
55 ssl_config_service_, | |
56 transport_security_state_); | |
57 } | |
58 | |
59 } // namespace net | |
OLD | NEW |