OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/loader/navigation_resource_handler.h" | 5 #include "content/browser/loader/navigation_resource_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 10 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/common/resource_response.h" | 21 #include "content/public/common/resource_response.h" |
22 #include "content/public/common/ssl_status.h" | 22 #include "content/public/common/ssl_status.h" |
23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
24 #include "net/url_request/url_request.h" | 24 #include "net/url_request/url_request.h" |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 NavigationResourceHandler::NavigationResourceHandler( | 28 NavigationResourceHandler::NavigationResourceHandler( |
29 net::URLRequest* request, | 29 net::URLRequest* request, |
30 NavigationURLLoaderImplCore* core, | 30 NavigationURLLoaderImplCore* core, |
31 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate, | 31 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate) |
32 CertStore* cert_store) | |
33 : ResourceHandler(request), | 32 : ResourceHandler(request), |
34 core_(core), | 33 core_(core), |
35 resource_dispatcher_host_delegate_(resource_dispatcher_host_delegate), | 34 resource_dispatcher_host_delegate_(resource_dispatcher_host_delegate) { |
36 cert_store_(cert_store) { | |
37 core_->set_resource_handler(this); | 35 core_->set_resource_handler(this); |
38 writer_.set_immediate_mode(true); | 36 writer_.set_immediate_mode(true); |
39 } | 37 } |
40 | 38 |
41 NavigationResourceHandler::~NavigationResourceHandler() { | 39 NavigationResourceHandler::~NavigationResourceHandler() { |
42 if (core_) { | 40 if (core_) { |
43 core_->NotifyRequestFailed(false, net::ERR_ABORTED); | 41 core_->NotifyRequestFailed(false, net::ERR_ABORTED); |
44 DetachFromCore(); | 42 DetachFromCore(); |
45 } | 43 } |
46 } | 44 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 109 |
112 // Clone the embedder's NavigationData before moving it to the UI thread. | 110 // Clone the embedder's NavigationData before moving it to the UI thread. |
113 if (navigation_data) | 111 if (navigation_data) |
114 cloned_data = navigation_data->Clone(); | 112 cloned_data = navigation_data->Clone(); |
115 } | 113 } |
116 | 114 |
117 SSLStatus ssl_status; | 115 SSLStatus ssl_status; |
118 if (request()->ssl_info().cert.get()) { | 116 if (request()->ssl_info().cert.get()) { |
119 ResourceLoader::GetSSLStatusForRequest( | 117 ResourceLoader::GetSSLStatusForRequest( |
120 request()->url(), request()->ssl_info(), info->GetChildID(), | 118 request()->url(), request()->ssl_info(), info->GetChildID(), |
121 cert_store_, &ssl_status); | 119 &ssl_status); |
122 } | 120 } |
123 | 121 |
124 core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle(), | 122 core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle(), |
125 ssl_status, std::move(cloned_data)); | 123 ssl_status, std::move(cloned_data)); |
126 *defer = true; | 124 *defer = true; |
127 | 125 |
128 return true; | 126 return true; |
129 } | 127 } |
130 | 128 |
131 bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) { | 129 bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 NOTREACHED(); | 166 NOTREACHED(); |
169 } | 167 } |
170 | 168 |
171 void NavigationResourceHandler::DetachFromCore() { | 169 void NavigationResourceHandler::DetachFromCore() { |
172 DCHECK(core_); | 170 DCHECK(core_); |
173 core_->set_resource_handler(nullptr); | 171 core_->set_resource_handler(nullptr); |
174 core_ = nullptr; | 172 core_ = nullptr; |
175 } | 173 } |
176 | 174 |
177 } // namespace content | 175 } // namespace content |
OLD | NEW |