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

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: add back previews_unspecified 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } // namespace 138 } // namespace
139 139
140 // static 140 // static
141 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( 141 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
142 FrameTreeNode* frame_tree_node, 142 FrameTreeNode* frame_tree_node,
143 const GURL& dest_url, 143 const GURL& dest_url,
144 const Referrer& dest_referrer, 144 const Referrer& dest_referrer,
145 const FrameNavigationEntry& frame_entry, 145 const FrameNavigationEntry& frame_entry,
146 const NavigationEntryImpl& entry, 146 const NavigationEntryImpl& entry,
147 FrameMsg_Navigate_Type::Value navigation_type, 147 FrameMsg_Navigate_Type::Value navigation_type,
148 LoFiState lofi_state, 148 int previews_state,
nasko 2016/12/08 22:19:32 PreviewsState
megjablon 2016/12/09 20:35:53 Done.
149 bool is_same_document_history_load, 149 bool is_same_document_history_load,
150 bool is_history_navigation_in_new_child, 150 bool is_history_navigation_in_new_child,
151 const base::TimeTicks& navigation_start, 151 const base::TimeTicks& navigation_start,
152 NavigationControllerImpl* controller) { 152 NavigationControllerImpl* controller) {
153 // Fill POST data in the request body. 153 // Fill POST data in the request body.
154 scoped_refptr<ResourceRequestBodyImpl> request_body; 154 scoped_refptr<ResourceRequestBodyImpl> request_body;
155 if (frame_entry.method() == "POST") 155 if (frame_entry.method() == "POST")
156 request_body = frame_entry.GetPostData(); 156 request_body = frame_entry.GetPostData();
157 157
158 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( 158 std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
159 frame_tree_node, entry.ConstructCommonNavigationParams( 159 frame_tree_node, entry.ConstructCommonNavigationParams(
160 frame_entry, request_body, dest_url, dest_referrer, 160 frame_entry, request_body, dest_url, dest_referrer,
161 navigation_type, lofi_state, navigation_start), 161 navigation_type, previews_state, navigation_start),
162 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL, 162 BeginNavigationParams(entry.extra_headers(), net::LOAD_NORMAL,
163 false, // skip_service_worker 163 false, // skip_service_worker
164 REQUEST_CONTEXT_TYPE_LOCATION), 164 REQUEST_CONTEXT_TYPE_LOCATION),
165 entry.ConstructRequestNavigationParams( 165 entry.ConstructRequestNavigationParams(
166 frame_entry, is_same_document_history_load, 166 frame_entry, is_same_document_history_load,
167 is_history_navigation_in_new_child, 167 is_history_navigation_in_new_child,
168 entry.GetSubframeUniqueNames(frame_tree_node), 168 entry.GetSubframeUniqueNames(frame_tree_node),
169 frame_tree_node->has_committed_real_load(), 169 frame_tree_node->has_committed_real_load(),
170 controller->GetPendingEntryIndex() == -1, 170 controller->GetPendingEntryIndex() == -1,
171 controller->GetIndexOfEntry(&entry), 171 controller->GetIndexOfEntry(&entry),
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 navigation_handle_->service_worker_handle() && 398 navigation_handle_->service_worker_handle() &&
399 navigation_handle_->service_worker_handle() 399 navigation_handle_->service_worker_handle()
400 ->service_worker_provider_host_id() != 400 ->service_worker_provider_host_id() !=
401 kInvalidServiceWorkerProviderId; 401 kInvalidServiceWorkerProviderId;
402 request_params_.service_worker_provider_id = 402 request_params_.service_worker_provider_id =
403 did_create_service_worker_host 403 did_create_service_worker_host
404 ? navigation_handle_->service_worker_handle() 404 ? navigation_handle_->service_worker_handle()
405 ->service_worker_provider_host_id() 405 ->service_worker_provider_host_id()
406 : kInvalidServiceWorkerProviderId; 406 : kInvalidServiceWorkerProviderId;
407 407
408 // Update the lofi state of the request. 408 // Update the previews state of the request.
409 if (response->head.is_using_lofi) 409 common_params_.previews_state = response->head.previews_state;
410 common_params_.lofi_state = LOFI_ON;
411 else
412 common_params_.lofi_state = LOFI_OFF;
413 410
414 // Select an appropriate renderer to commit the navigation. 411 // Select an appropriate renderer to commit the navigation.
415 RenderFrameHostImpl* render_frame_host = 412 RenderFrameHostImpl* render_frame_host =
416 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); 413 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this);
417 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, 414 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host,
418 common_params_.url); 415 common_params_.url);
419 416
420 // For renderer-initiated navigations that are set to commit in a different 417 // For renderer-initiated navigations that are set to commit in a different
421 // renderer, allow the embedder to cancel the transfer. 418 // renderer, allow the embedder to cancel the transfer.
422 if (!browser_initiated_ && 419 if (!browser_initiated_ &&
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 TransferNavigationHandleOwnership(render_frame_host); 596 TransferNavigationHandleOwnership(render_frame_host);
600 597
601 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 598 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
602 common_params_, request_params_, 599 common_params_, request_params_,
603 is_view_source_); 600 is_view_source_);
604 601
605 frame_tree_node_->ResetNavigationRequest(true); 602 frame_tree_node_->ResetNavigationRequest(true);
606 } 603 }
607 604
608 } // namespace content 605 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698