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

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

Issue 2777813003: Fix mobile user agent string not being used when PlzNavigate is enabled. (Closed)
Patch Set: review comment Created 3 years, 9 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/web_contents/web_contents_impl_browsertest.cc » ('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 "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "content/browser/appcache/appcache_navigation_handle.h" 10 #include "content/browser/appcache/appcache_navigation_handle.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 source_site_instance_ = 334 source_site_instance_ =
335 frame_tree_node->current_frame_host()->GetSiteInstance(); 335 frame_tree_node->current_frame_host()->GetSiteInstance();
336 } 336 }
337 337
338 // Update the load flags with cache information. 338 // Update the load flags with cache information.
339 UpdateLoadFlagsWithCacheFlags(&begin_params_.load_flags, 339 UpdateLoadFlagsWithCacheFlags(&begin_params_.load_flags,
340 common_params_.navigation_type, 340 common_params_.navigation_type,
341 common_params_.method == "POST"); 341 common_params_.method == "POST");
342 342
343 // Add necessary headers that may not be present in the BeginNavigationParams. 343 // Add necessary headers that may not be present in the BeginNavigationParams.
344 const std::string user_agent_override = 344 std::string user_agent_override;
345 frame_tree_node_->navigator()->GetDelegate()->GetUserAgentOverride(); 345 if (entry && entry->GetIsOverridingUserAgent()) {
346 user_agent_override =
347 frame_tree_node_->navigator()->GetDelegate()->GetUserAgentOverride();
348 }
349
346 net::HttpRequestHeaders headers; 350 net::HttpRequestHeaders headers;
347 headers.AddHeadersFromString(begin_params_.headers); 351 headers.AddHeadersFromString(begin_params_.headers);
348 AddAdditionalRequestHeaders( 352 AddAdditionalRequestHeaders(
349 &headers, common_params_.url, common_params_.navigation_type, 353 &headers, common_params_.url, common_params_.navigation_type,
350 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 354 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
351 common_params.method, user_agent_override, frame_tree_node); 355 common_params.method, user_agent_override, frame_tree_node);
352 begin_params_.headers = headers.ToString(); 356 begin_params_.headers = headers.ToString();
353 } 357 }
354 358
355 NavigationRequest::~NavigationRequest() { 359 NavigationRequest::~NavigationRequest() {
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 837 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
834 838
835 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 839 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
836 common_params_, request_params_, 840 common_params_, request_params_,
837 is_view_source_); 841 is_view_source_);
838 842
839 frame_tree_node_->ResetNavigationRequest(true, true); 843 frame_tree_node_->ResetNavigationRequest(true, true);
840 } 844 }
841 845
842 } // namespace content 846 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698