Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/browser/loader/navigation_resource_handler.cc

Issue 2239273002: Don't use SSLStatus from FrameHostMsg_DidCommitProvisionalLoad and instead cache it on the browser … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "content/browser/loader/netlog_observer.h" 11 #include "content/browser/loader/netlog_observer.h"
12 #include "content/browser/loader/resource_loader.h"
12 #include "content/browser/loader/resource_request_info_impl.h" 13 #include "content/browser/loader/resource_request_info_impl.h"
13 #include "content/browser/resource_context_impl.h" 14 #include "content/browser/resource_context_impl.h"
14 #include "content/browser/streams/stream.h" 15 #include "content/browser/streams/stream.h"
15 #include "content/browser/streams/stream_context.h" 16 #include "content/browser/streams/stream_context.h"
16 #include "content/public/browser/navigation_data.h" 17 #include "content/public/browser/navigation_data.h"
17 #include "content/public/browser/resource_controller.h" 18 #include "content/public/browser/resource_controller.h"
18 #include "content/public/browser/resource_dispatcher_host_delegate.h" 19 #include "content/public/browser/resource_dispatcher_host_delegate.h"
19 #include "content/public/browser/stream_handle.h" 20 #include "content/public/browser/stream_handle.h"
20 #include "content/public/common/resource_response.h" 21 #include "content/public/common/resource_response.h"
22 #include "content/public/common/ssl_status.h"
21 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
22 #include "net/url_request/url_request.h" 24 #include "net/url_request/url_request.h"
23 25
24 namespace content { 26 namespace content {
25 27
26 NavigationResourceHandler::NavigationResourceHandler( 28 NavigationResourceHandler::NavigationResourceHandler(
27 net::URLRequest* request, 29 net::URLRequest* request,
28 NavigationURLLoaderImplCore* core, 30 NavigationURLLoaderImplCore* core,
29 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate) 31 ResourceDispatcherHostDelegate* resource_dispatcher_host_delegate,
32 CertStore* cert_store)
30 : ResourceHandler(request), 33 : ResourceHandler(request),
31 core_(core), 34 core_(core),
32 resource_dispatcher_host_delegate_(resource_dispatcher_host_delegate) { 35 resource_dispatcher_host_delegate_(resource_dispatcher_host_delegate),
36 cert_store_(cert_store) {
33 core_->set_resource_handler(this); 37 core_->set_resource_handler(this);
34 writer_.set_immediate_mode(true); 38 writer_.set_immediate_mode(true);
35 } 39 }
36 40
37 NavigationResourceHandler::~NavigationResourceHandler() { 41 NavigationResourceHandler::~NavigationResourceHandler() {
38 if (core_) { 42 if (core_) {
39 core_->NotifyRequestFailed(false, net::ERR_ABORTED); 43 core_->NotifyRequestFailed(false, net::ERR_ABORTED);
40 DetachFromCore(); 44 DetachFromCore();
41 } 45 }
42 } 46 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (resource_dispatcher_host_delegate_) { 107 if (resource_dispatcher_host_delegate_) {
104 // Ask the embedder for a NavigationData instance. 108 // Ask the embedder for a NavigationData instance.
105 NavigationData* navigation_data = 109 NavigationData* navigation_data =
106 resource_dispatcher_host_delegate_->GetNavigationData(request()); 110 resource_dispatcher_host_delegate_->GetNavigationData(request());
107 111
108 // Clone the embedder's NavigationData before moving it to the UI thread. 112 // Clone the embedder's NavigationData before moving it to the UI thread.
109 if (navigation_data) 113 if (navigation_data)
110 cloned_data = navigation_data->Clone(); 114 cloned_data = navigation_data->Clone();
111 } 115 }
112 116
117 SSLStatus ssl_status;
118 if (request()->ssl_info().cert.get()) {
119 ResourceLoader::GetSSLStatusForRequest(
120 request()->url(), request()->ssl_info(), info->GetChildID(),
121 cert_store_, &ssl_status);
122 }
123
113 core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle(), 124 core_->NotifyResponseStarted(response, writer_.stream()->CreateHandle(),
114 std::move(cloned_data)); 125 ssl_status, std::move(cloned_data));
115 *defer = true; 126 *defer = true;
116 127
117 return true; 128 return true;
118 } 129 }
119 130
120 bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) { 131 bool NavigationResourceHandler::OnWillStart(const GURL& url, bool* defer) {
121 return true; 132 return true;
122 } 133 }
123 134
124 bool NavigationResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, 135 bool NavigationResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 NOTREACHED(); 169 NOTREACHED();
159 } 170 }
160 171
161 void NavigationResourceHandler::DetachFromCore() { 172 void NavigationResourceHandler::DetachFromCore() {
162 DCHECK(core_); 173 DCHECK(core_);
163 core_->set_resource_handler(nullptr); 174 core_->set_resource_handler(nullptr);
164 core_ = nullptr; 175 core_ = nullptr;
165 } 176 }
166 177
167 } // namespace content 178 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698