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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 1839473002: Centralize the setting of Accept headers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 4 years, 8 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
« no previous file with comments | « no previous file | content/browser/loader/mime_type_resource_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 LoFiState lofi_state, 72 LoFiState lofi_state,
73 bool is_same_document_history_load, 73 bool is_same_document_history_load,
74 const base::TimeTicks& navigation_start, 74 const base::TimeTicks& navigation_start,
75 NavigationControllerImpl* controller) { 75 NavigationControllerImpl* controller) {
76 // Copy existing headers and add necessary headers that may not be present 76 // Copy existing headers and add necessary headers that may not be present
77 // in the RequestNavigationParams. 77 // in the RequestNavigationParams.
78 net::HttpRequestHeaders headers; 78 net::HttpRequestHeaders headers;
79 headers.AddHeadersFromString(entry.extra_headers()); 79 headers.AddHeadersFromString(entry.extra_headers());
80 headers.SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent, 80 headers.SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent,
81 GetContentClient()->GetUserAgent()); 81 GetContentClient()->GetUserAgent());
82 // TODO(clamy): match what blink is doing with accept headers.
83 headers.SetHeaderIfMissing("Accept", "*/*");
84 82
85 // Fill POST data from the browser in the request body. 83 // Fill POST data from the browser in the request body.
86 scoped_refptr<ResourceRequestBody> request_body; 84 scoped_refptr<ResourceRequestBody> request_body;
87 if (entry.GetHasPostData()) { 85 if (entry.GetHasPostData()) {
88 request_body = new ResourceRequestBody(); 86 request_body = new ResourceRequestBody();
89 request_body->AppendBytes( 87 request_body->AppendBytes(
90 reinterpret_cast<const char *>( 88 reinterpret_cast<const char *>(
91 entry.GetBrowserInitiatedPostData()->front()), 89 entry.GetBrowserInitiatedPostData()->front()),
92 entry.GetBrowserInitiatedPostData()->size()); 90 entry.GetBrowserInitiatedPostData()->size());
93 } 91 }
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 browser_context, navigating_frame_host->GetSiteInstance()); 453 browser_context, navigating_frame_host->GetSiteInstance());
456 DCHECK(partition); 454 DCHECK(partition);
457 455
458 ServiceWorkerContextWrapper* service_worker_context = 456 ServiceWorkerContextWrapper* service_worker_context =
459 static_cast<ServiceWorkerContextWrapper*>( 457 static_cast<ServiceWorkerContextWrapper*>(
460 partition->GetServiceWorkerContext()); 458 partition->GetServiceWorkerContext());
461 navigation_handle_->InitServiceWorkerHandle(service_worker_context); 459 navigation_handle_->InitServiceWorkerHandle(service_worker_context);
462 } 460 }
463 461
464 } // namespace content 462 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/mime_type_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698