OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_url_loader_network_service.h" | 5 #include "content/browser/loader/navigation_url_loader_network_service.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "content/browser/frame_host/navigation_request_info.h" | 8 #include "content/browser/frame_host/navigation_request_info.h" |
| 9 #include "content/browser/loader/navigation_resource_handler.h" |
| 10 #include "content/browser/loader/navigation_resource_throttle.h" |
9 #include "content/browser/loader/navigation_url_loader_delegate.h" | 11 #include "content/browser/loader/navigation_url_loader_delegate.h" |
10 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
11 #include "content/public/browser/global_request_id.h" | 13 #include "content/public/browser/global_request_id.h" |
12 #include "content/public/browser/navigation_data.h" | 14 #include "content/public/browser/navigation_data.h" |
13 #include "content/public/browser/navigation_ui_data.h" | 15 #include "content/public/browser/navigation_ui_data.h" |
14 #include "content/public/browser/ssl_status.h" | 16 #include "content/public/browser/ssl_status.h" |
15 #include "content/public/browser/stream_handle.h" | 17 #include "content/public/browser/stream_handle.h" |
16 #include "content/public/common/service_manager_connection.h" | 18 #include "content/public/common/service_manager_connection.h" |
17 #include "content/public/common/service_names.mojom.h" | 19 #include "content/public/common/service_names.mojom.h" |
18 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
(...skipping 25 matching lines...) Expand all Loading... |
44 new_request->priority = net::HIGHEST; | 46 new_request->priority = net::HIGHEST; |
45 | 47 |
46 mojom::URLLoaderClientPtr url_loader_client_ptr; | 48 mojom::URLLoaderClientPtr url_loader_client_ptr; |
47 mojom::URLLoaderClientRequest url_loader_client_request = | 49 mojom::URLLoaderClientRequest url_loader_client_request = |
48 mojo::MakeRequest(&url_loader_client_ptr); | 50 mojo::MakeRequest(&url_loader_client_ptr); |
49 mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass; | 51 mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass; |
50 binding_.Bind(&url_loader_client_ptr_to_pass); | 52 binding_.Bind(&url_loader_client_ptr_to_pass); |
51 | 53 |
52 url_loader_factory_->CreateLoaderAndStart( | 54 url_loader_factory_->CreateLoaderAndStart( |
53 mojo::MakeRequest(&url_loader_associated_ptr_), 0 /* routing_id? */, | 55 mojo::MakeRequest(&url_loader_associated_ptr_), 0 /* routing_id? */, |
54 0 /* request_id? */, *new_request, | 56 0 /* request_id? */, |
| 57 static_cast<int32_t>(mojom::URLLoadOptions::kSendSSLInfo), *new_request, |
55 std::move(url_loader_client_ptr_to_pass)); | 58 std::move(url_loader_client_ptr_to_pass)); |
56 } | 59 } |
57 | 60 |
58 NavigationURLLoaderNetworkService::~NavigationURLLoaderNetworkService() {} | 61 NavigationURLLoaderNetworkService::~NavigationURLLoaderNetworkService() {} |
59 | 62 |
60 void NavigationURLLoaderNetworkService::FollowRedirect() { | 63 void NavigationURLLoaderNetworkService::FollowRedirect() { |
61 url_loader_associated_ptr_->FollowRedirect(); | 64 url_loader_associated_ptr_->FollowRedirect(); |
62 } | 65 } |
63 | 66 |
64 void NavigationURLLoaderNetworkService::ProceedWithResponse() {} | 67 void NavigationURLLoaderNetworkService::ProceedWithResponse() {} |
65 | 68 |
66 void NavigationURLLoaderNetworkService::OnReceiveResponse( | 69 void NavigationURLLoaderNetworkService::OnReceiveResponse( |
67 const ResourceResponseHead& head, | 70 const ResourceResponseHead& head, |
| 71 const base::Optional<net::SSLInfo>& ssl_info, |
68 mojom::DownloadedTempFilePtr downloaded_file) { | 72 mojom::DownloadedTempFilePtr downloaded_file) { |
69 // TODO(scottmg): This needs to do more of what | 73 // TODO(scottmg): This needs to do more of what |
70 // NavigationResourceHandler::OnReponseStarted() does. Or maybe in | 74 // NavigationResourceHandler::OnReponseStarted() does. Or maybe in |
71 // OnStartLoadingResponseBody(). | 75 // OnStartLoadingResponseBody(). |
| 76 if (ssl_info && ssl_info->cert) |
| 77 NavigationResourceHandler::GetSSLStatusForRequest(*ssl_info, &ssl_status_); |
72 response_ = base::MakeShared<ResourceResponse>(); | 78 response_ = base::MakeShared<ResourceResponse>(); |
73 response_->head = head; | 79 response_->head = head; |
74 } | 80 } |
75 | 81 |
76 void NavigationURLLoaderNetworkService::OnReceiveRedirect( | 82 void NavigationURLLoaderNetworkService::OnReceiveRedirect( |
77 const net::RedirectInfo& redirect_info, | 83 const net::RedirectInfo& redirect_info, |
78 const ResourceResponseHead& head) { | 84 const ResourceResponseHead& head) { |
79 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 85 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
80 scoped_refptr<ResourceResponse> response(new ResourceResponse()); | 86 scoped_refptr<ResourceResponse> response(new ResourceResponse()); |
81 response->head = head; | 87 response->head = head; |
(...skipping 14 matching lines...) Expand all Loading... |
96 | 102 |
97 void NavigationURLLoaderNetworkService::OnTransferSizeUpdated( | 103 void NavigationURLLoaderNetworkService::OnTransferSizeUpdated( |
98 int32_t transfer_size_diff) {} | 104 int32_t transfer_size_diff) {} |
99 | 105 |
100 void NavigationURLLoaderNetworkService::OnStartLoadingResponseBody( | 106 void NavigationURLLoaderNetworkService::OnStartLoadingResponseBody( |
101 mojo::ScopedDataPipeConsumerHandle body) { | 107 mojo::ScopedDataPipeConsumerHandle body) { |
102 DCHECK(response_); | 108 DCHECK(response_); |
103 // Temporarily, we pass both a stream (null) and the data pipe to the | 109 // Temporarily, we pass both a stream (null) and the data pipe to the |
104 // delegate until PlzNavigate has shipped and we can be comfortable fully | 110 // delegate until PlzNavigate has shipped and we can be comfortable fully |
105 // switching to the data pipe. | 111 // switching to the data pipe. |
106 delegate_->OnResponseStarted(response_, nullptr, std::move(body), SSLStatus(), | 112 delegate_->OnResponseStarted(response_, nullptr, std::move(body), ssl_status_, |
107 std::unique_ptr<NavigationData>(), | 113 std::unique_ptr<NavigationData>(), |
108 GlobalRequestID() /* request_id? */, | 114 GlobalRequestID() /* request_id? */, |
109 false /* is_download? */, false /* is_stream */); | 115 false /* is_download? */, false /* is_stream */); |
110 } | 116 } |
111 | 117 |
112 void NavigationURLLoaderNetworkService::OnComplete( | 118 void NavigationURLLoaderNetworkService::OnComplete( |
113 const ResourceRequestCompletionStatus& completion_status) {} | 119 const ResourceRequestCompletionStatus& completion_status) {} |
114 | 120 |
115 } // namespace content | 121 } // namespace content |
OLD | NEW |