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

Unified Diff: content/browser/frame_host/navigation_request.cc

Issue 2966573003: Set UA override flag for Renderer-initiated NavigationRequest (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index a9250af015b4caab551c3e063605c0c5d1e115fa..e1eab6241d3bc81d8a43f592b49e9330777a13dc 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -262,7 +262,8 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated(
const CommonNavigationParams& common_params,
const BeginNavigationParams& begin_params,
int current_history_list_offset,
- int current_history_list_length) {
+ int current_history_list_length,
+ bool override_user_agent) {
// Only normal navigations to a different document or reloads are expected.
// - Renderer-initiated fragment-navigations never take place in the browser,
// even with PlzNavigate.
@@ -274,13 +275,11 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated(
common_params.navigation_type ==
FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT);
- // TODO(clamy): See how we should handle override of the user agent when the
- // navigation may start in a renderer and commit in another one.
// TODO(clamy): See if the navigation start time should be measured in the
// renderer and sent to the browser instead of being measured here.
// TODO(clamy): The pending history list offset should be properly set.
RequestNavigationParams request_params(
- false, // is_overriding_user_agent
+ override_user_agent,
std::vector<GURL>(), // redirects
common_params.url, common_params.method,
false, // can_load_local_resources
@@ -358,13 +357,14 @@ NavigationRequest::NavigationRequest(
common_params_.method == "POST");
// Add necessary headers that may not be present in the BeginNavigationParams.
- std::string user_agent_override;
- if (entry) {
+ if (entry)
nav_entry_id_ = entry->GetUniqueID();
- if (entry->GetIsOverridingUserAgent()) {
- user_agent_override =
- frame_tree_node_->navigator()->GetDelegate()->GetUserAgentOverride();
- }
+
+ std::string user_agent_override;
+ if (request_params.is_overriding_user_agent ||
+ (entry && entry->GetIsOverridingUserAgent())) {
+ user_agent_override =
+ frame_tree_node_->navigator()->GetDelegate()->GetUserAgentOverride();
}
net::HttpRequestHeaders headers;
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698