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

Side by Side Diff: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc

Issue 2334603002: Fix SSLUITest.TestBadHTTPSDownload with PlzNavigate. (Closed)
Patch Set: fix android temporarily 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" 5 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "android_webview/browser/aw_browser_context.h" 10 #include "android_webview/browser/aw_browser_context.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 DLOG(WARNING) << "io_client is null, onReceivedError dropped for " << 260 DLOG(WARNING) << "io_client is null, onReceivedError dropped for " <<
261 request->url(); 261 request->url();
262 } 262 }
263 } 263 }
264 } 264 }
265 265
266 266
267 void AwResourceDispatcherHostDelegate::DownloadStarting( 267 void AwResourceDispatcherHostDelegate::DownloadStarting(
268 net::URLRequest* request, 268 net::URLRequest* request,
269 content::ResourceContext* resource_context, 269 content::ResourceContext* resource_context,
270 int child_id,
271 int route_id,
272 bool is_content_initiated, 270 bool is_content_initiated,
273 bool must_download, 271 bool must_download,
274 ScopedVector<content::ResourceThrottle>* throttles) { 272 ScopedVector<content::ResourceThrottle>* throttles) {
275 GURL url(request->url()); 273 GURL url(request->url());
276 std::string user_agent; 274 std::string user_agent;
277 std::string content_disposition; 275 std::string content_disposition;
278 std::string mime_type; 276 std::string mime_type;
279 int64_t content_length = request->GetExpectedContentSize(); 277 int64_t content_length = request->GetExpectedContentSize();
280 278
281 request->extra_request_headers().GetHeader( 279 request->extra_request_headers().GetHeader(
282 net::HttpRequestHeaders::kUserAgent, &user_agent); 280 net::HttpRequestHeaders::kUserAgent, &user_agent);
283 281
284 282
285 net::HttpResponseHeaders* response_headers = request->response_headers(); 283 net::HttpResponseHeaders* response_headers = request->response_headers();
286 if (response_headers) { 284 if (response_headers) {
287 response_headers->GetNormalizedHeader("content-disposition", 285 response_headers->GetNormalizedHeader("content-disposition",
288 &content_disposition); 286 &content_disposition);
289 response_headers->GetMimeType(&mime_type); 287 response_headers->GetMimeType(&mime_type);
290 } 288 }
291 289
292 request->Cancel(); 290 request->Cancel();
293 291
294 const content::ResourceRequestInfo* request_info = 292 const content::ResourceRequestInfo* request_info =
295 content::ResourceRequestInfo::ForRequest(request); 293 content::ResourceRequestInfo::ForRequest(request);
296 294
295 // TODO(jam): http://crbug.com/645983 we will need to make this map work with
296 // both RFH IDs and FTN IDs.
297 std::unique_ptr<AwContentsIoThreadClient> io_client = 297 std::unique_ptr<AwContentsIoThreadClient> io_client =
298 AwContentsIoThreadClient::FromID(child_id, 298 AwContentsIoThreadClient::FromID(request_info->GetChildID(),
299 request_info->GetRenderFrameID()); 299 request_info->GetRenderFrameID());
300 300
301 // POST request cannot be repeated in general, so prevent client from 301 // POST request cannot be repeated in general, so prevent client from
302 // retrying the same request, even if it is with a GET. 302 // retrying the same request, even if it is with a GET.
303 if ("GET" == request->method() && io_client) { 303 if ("GET" == request->method() && io_client) {
304 io_client->NewDownload(url, 304 io_client->NewDownload(url,
305 user_agent, 305 user_agent,
306 content_disposition, 306 content_disposition,
307 mime_type, 307 mime_type,
308 content_length); 308 content_length);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 net::HttpRequestHeaders headers; 443 net::HttpRequestHeaders headers;
444 headers.AddHeadersFromString(extra_headers); 444 headers.AddHeadersFromString(extra_headers);
445 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) { 445 for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext(); ) {
446 request->SetExtraRequestHeaderByName(it.name(), it.value(), false); 446 request->SetExtraRequestHeaderByName(it.name(), it.value(), false);
447 } 447 }
448 } 448 }
449 } 449 }
450 } 450 }
451 451
452 } // namespace android_webview 452 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698