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 26 matching lines...) Expand all Loading... |
45 new_request->priority = net::HIGHEST; | 47 new_request->priority = net::HIGHEST; |
46 | 48 |
47 mojom::URLLoaderClientPtr url_loader_client_ptr; | 49 mojom::URLLoaderClientPtr url_loader_client_ptr; |
48 mojom::URLLoaderClientRequest url_loader_client_request = | 50 mojom::URLLoaderClientRequest url_loader_client_request = |
49 mojo::MakeRequest(&url_loader_client_ptr); | 51 mojo::MakeRequest(&url_loader_client_ptr); |
50 mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass; | 52 mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass; |
51 binding_.Bind(&url_loader_client_ptr_to_pass); | 53 binding_.Bind(&url_loader_client_ptr_to_pass); |
52 | 54 |
53 url_loader_factory_->CreateLoaderAndStart( | 55 url_loader_factory_->CreateLoaderAndStart( |
54 mojo::MakeRequest(&url_loader_associated_ptr_), 0 /* routing_id? */, | 56 mojo::MakeRequest(&url_loader_associated_ptr_), 0 /* routing_id? */, |
55 0 /* request_id? */, *new_request, | 57 0 /* request_id? */, mojom::kURLLoadOptionSendSSLInfo, *new_request, |
56 std::move(url_loader_client_ptr_to_pass)); | 58 std::move(url_loader_client_ptr_to_pass)); |
57 } | 59 } |
58 | 60 |
59 NavigationURLLoaderNetworkService::~NavigationURLLoaderNetworkService() {} | 61 NavigationURLLoaderNetworkService::~NavigationURLLoaderNetworkService() {} |
60 | 62 |
61 void NavigationURLLoaderNetworkService::FollowRedirect() { | 63 void NavigationURLLoaderNetworkService::FollowRedirect() { |
62 url_loader_associated_ptr_->FollowRedirect(); | 64 url_loader_associated_ptr_->FollowRedirect(); |
63 } | 65 } |
64 | 66 |
65 void NavigationURLLoaderNetworkService::ProceedWithResponse() {} | 67 void NavigationURLLoaderNetworkService::ProceedWithResponse() {} |
66 | 68 |
67 void NavigationURLLoaderNetworkService::OnReceiveResponse( | 69 void NavigationURLLoaderNetworkService::OnReceiveResponse( |
68 const ResourceResponseHead& head, | 70 const ResourceResponseHead& head, |
| 71 const base::Optional<net::SSLInfo>& ssl_info, |
69 mojom::DownloadedTempFilePtr downloaded_file) { | 72 mojom::DownloadedTempFilePtr downloaded_file) { |
70 // TODO(scottmg): This needs to do more of what | 73 // TODO(scottmg): This needs to do more of what |
71 // NavigationResourceHandler::OnReponseStarted() does. Or maybe in | 74 // NavigationResourceHandler::OnReponseStarted() does. Or maybe in |
72 // OnStartLoadingResponseBody(). | 75 // OnStartLoadingResponseBody(). |
| 76 if (ssl_info && ssl_info->cert) |
| 77 NavigationResourceHandler::GetSSLStatusForRequest(*ssl_info, &ssl_status_); |
73 response_ = base::MakeShared<ResourceResponse>(); | 78 response_ = base::MakeShared<ResourceResponse>(); |
74 response_->head = head; | 79 response_->head = head; |
75 } | 80 } |
76 | 81 |
77 void NavigationURLLoaderNetworkService::OnReceiveRedirect( | 82 void NavigationURLLoaderNetworkService::OnReceiveRedirect( |
78 const net::RedirectInfo& redirect_info, | 83 const net::RedirectInfo& redirect_info, |
79 const ResourceResponseHead& head) { | 84 const ResourceResponseHead& head) { |
80 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 85 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
81 scoped_refptr<ResourceResponse> response(new ResourceResponse()); | 86 scoped_refptr<ResourceResponse> response(new ResourceResponse()); |
82 response->head = head; | 87 response->head = head; |
(...skipping 14 matching lines...) Expand all Loading... |
97 | 102 |
98 void NavigationURLLoaderNetworkService::OnTransferSizeUpdated( | 103 void NavigationURLLoaderNetworkService::OnTransferSizeUpdated( |
99 int32_t transfer_size_diff) {} | 104 int32_t transfer_size_diff) {} |
100 | 105 |
101 void NavigationURLLoaderNetworkService::OnStartLoadingResponseBody( | 106 void NavigationURLLoaderNetworkService::OnStartLoadingResponseBody( |
102 mojo::ScopedDataPipeConsumerHandle body) { | 107 mojo::ScopedDataPipeConsumerHandle body) { |
103 DCHECK(response_); | 108 DCHECK(response_); |
104 // 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 |
105 // delegate until PlzNavigate has shipped and we can be comfortable fully | 110 // delegate until PlzNavigate has shipped and we can be comfortable fully |
106 // switching to the data pipe. | 111 // switching to the data pipe. |
107 delegate_->OnResponseStarted(response_, nullptr, std::move(body), SSLStatus(), | 112 delegate_->OnResponseStarted(response_, nullptr, std::move(body), ssl_status_, |
108 std::unique_ptr<NavigationData>(), | 113 std::unique_ptr<NavigationData>(), |
109 GlobalRequestID() /* request_id? */, | 114 GlobalRequestID() /* request_id? */, |
110 false /* is_download? */, false /* is_stream */); | 115 false /* is_download? */, false /* is_stream */); |
111 } | 116 } |
112 | 117 |
113 void NavigationURLLoaderNetworkService::OnComplete( | 118 void NavigationURLLoaderNetworkService::OnComplete( |
114 const ResourceRequestCompletionStatus& completion_status) {} | 119 const ResourceRequestCompletionStatus& completion_status) {} |
115 | 120 |
116 } // namespace content | 121 } // namespace content |
OLD | NEW |