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

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

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: clean up comments Created 4 years 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 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/child_process_security_policy_impl.h" 9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } // namespace 137 } // namespace
138 138
139 // static 139 // static
140 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( 140 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
141 FrameTreeNode* frame_tree_node, 141 FrameTreeNode* frame_tree_node,
142 const GURL& dest_url, 142 const GURL& dest_url,
143 const Referrer& dest_referrer, 143 const Referrer& dest_referrer,
144 const FrameNavigationEntry& frame_entry, 144 const FrameNavigationEntry& frame_entry,
145 const NavigationEntryImpl& entry, 145 const NavigationEntryImpl& entry,
146 FrameMsg_Navigate_Type::Value navigation_type, 146 FrameMsg_Navigate_Type::Value navigation_type,
147 LoFiState lofi_state, 147 int previews_state,
148 bool is_same_document_history_load, 148 bool is_same_document_history_load,
149 bool is_history_navigation_in_new_child, 149 bool is_history_navigation_in_new_child,
150 const base::TimeTicks& navigation_start, 150 const base::TimeTicks& navigation_start,
151 NavigationControllerImpl* controller) { 151 NavigationControllerImpl* controller) {
152 // Fill POST data in the request body. 152 // Fill POST data in the request body.
153 scoped_refptr<ResourceRequestBodyImpl> request_body; 153 scoped_refptr<ResourceRequestBodyImpl> request_body;
154 if (frame_entry.method() == "POST") 154 if (frame_entry.method() == "POST")
155 request_body = frame_entry.GetPostData(); 155 request_body = frame_entry.GetPostData();
156 156
157 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( 157 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
158 frame_tree_node, entry.ConstructCommonNavigationParams( 158 frame_tree_node, entry.ConstructCommonNavigationParams(
159 frame_entry, request_body, dest_url, dest_referrer, 159 frame_entry, request_body, dest_url, dest_referrer,
160 navigation_type, lofi_state, navigation_start), 160 navigation_type, previews_state, navigation_start),
161 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, 161 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL,
162 false, // skip_service_worker 162 false, // skip_service_worker
163 REQUEST_CONTEXT_TYPE_LOCATION), 163 REQUEST_CONTEXT_TYPE_LOCATION),
164 entry.ConstructRequestNavigationParams( 164 entry.ConstructRequestNavigationParams(
165 frame_entry, is_same_document_history_load, 165 frame_entry, is_same_document_history_load,
166 is_history_navigation_in_new_child, 166 is_history_navigation_in_new_child,
167 entry.GetSubframeUniqueNames(frame_tree_node), 167 entry.GetSubframeUniqueNames(frame_tree_node),
168 frame_tree_node->has_committed_real_load(), 168 frame_tree_node->has_committed_real_load(),
169 controller->GetPendingEntryIndex() == -1, 169 controller->GetPendingEntryIndex() == -1,
170 controller->GetIndexOfEntry(&entry), 170 controller->GetIndexOfEntry(&entry),
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 navigation_handle_->service_worker_handle() && 394 navigation_handle_->service_worker_handle() &&
395 navigation_handle_->service_worker_handle() 395 navigation_handle_->service_worker_handle()
396 ->service_worker_provider_host_id() != 396 ->service_worker_provider_host_id() !=
397 kInvalidServiceWorkerProviderId; 397 kInvalidServiceWorkerProviderId;
398 request_params_.service_worker_provider_id = 398 request_params_.service_worker_provider_id =
399 did_create_service_worker_host 399 did_create_service_worker_host
400 ? navigation_handle_->service_worker_handle() 400 ? navigation_handle_->service_worker_handle()
401 ->service_worker_provider_host_id() 401 ->service_worker_provider_host_id()
402 : kInvalidServiceWorkerProviderId; 402 : kInvalidServiceWorkerProviderId;
403 403
404 // Update the lofi state of the request. 404 // Update the previews state of the request.
405 if (response->head.is_using_lofi) 405 common_params_.previews_state = response->head.previews_state;
406 common_params_.lofi_state = LOFI_ON;
407 else
408 common_params_.lofi_state = LOFI_OFF;
409 406
410 // Select an appropriate renderer to commit the navigation. 407 // Select an appropriate renderer to commit the navigation.
411 RenderFrameHostImpl* render_frame_host = 408 RenderFrameHostImpl* render_frame_host =
412 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); 409 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this);
413 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, 410 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host,
414 common_params_.url); 411 common_params_.url);
415 412
416 // For renderer-initiated navigations that are set to commit in a different 413 // For renderer-initiated navigations that are set to commit in a different
417 // renderer, allow the embedder to cancel the transfer. 414 // renderer, allow the embedder to cancel the transfer.
418 if (!browser_initiated_ && 415 if (!browser_initiated_ &&
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 TransferNavigationHandleOwnership(render_frame_host); 594 TransferNavigationHandleOwnership(render_frame_host);
598 595
599 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 596 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
600 common_params_, request_params_, 597 common_params_, request_params_,
601 is_view_source_); 598 is_view_source_);
602 599
603 frame_tree_node_->ResetNavigationRequest(true); 600 frame_tree_node_->ResetNavigationRequest(true);
604 } 601 }
605 602
606 } // namespace content 603 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698