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

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

Issue 1310743003: Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
11 #include "content/browser/frame_host/frame_tree_node.h" 11 #include "content/browser/frame_host/frame_tree_node.h"
12 #include "content/browser/frame_host/navigation_controller_impl.h" 12 #include "content/browser/frame_host/navigation_controller_impl.h"
13 #include "content/browser/frame_host/navigation_entry_impl.h" 13 #include "content/browser/frame_host/navigation_entry_impl.h"
14 #include "content/browser/frame_host/navigation_handle_impl.h" 14 #include "content/browser/frame_host/navigation_handle_impl.h"
15 #include "content/browser/frame_host/navigation_request.h" 15 #include "content/browser/frame_host/navigation_request.h"
16 #include "content/browser/frame_host/navigation_request_info.h" 16 #include "content/browser/frame_host/navigation_request_info.h"
17 #include "content/browser/frame_host/navigator_delegate.h" 17 #include "content/browser/frame_host/navigator_delegate.h"
18 #include "content/browser/frame_host/render_frame_host_impl.h" 18 #include "content/browser/frame_host/render_frame_host_impl.h"
19 #include "content/browser/renderer_host/render_view_host_impl.h" 19 #include "content/browser/renderer_host/render_view_host_impl.h"
20 #include "content/browser/site_instance_impl.h" 20 #include "content/browser/site_instance_impl.h"
21 #include "content/browser/webui/web_ui_controller_factory_registry.h" 21 #include "content/browser/webui/web_ui_controller_factory_registry.h"
22 #include "content/browser/webui/web_ui_impl.h" 22 #include "content/browser/webui/web_ui_impl.h"
23 #include "content/common/frame_messages.h" 23 #include "content/common/frame_messages.h"
24 #include "content/common/navigation_params.h"
25 #include "content/common/site_isolation_policy.h" 24 #include "content/common/site_isolation_policy.h"
26 #include "content/common/view_messages.h" 25 #include "content/common/view_messages.h"
27 #include "content/public/browser/browser_context.h" 26 #include "content/public/browser/browser_context.h"
28 #include "content/public/browser/content_browser_client.h" 27 #include "content/public/browser/content_browser_client.h"
29 #include "content/public/browser/global_request_id.h" 28 #include "content/public/browser/global_request_id.h"
30 #include "content/public/browser/invalidate_type.h" 29 #include "content/public/browser/invalidate_type.h"
31 #include "content/public/browser/navigation_controller.h" 30 #include "content/public/browser/navigation_controller.h"
32 #include "content/public/browser/navigation_details.h" 31 #include "content/public/browser/navigation_details.h"
33 #include "content/public/browser/page_navigator.h" 32 #include "content/public/browser/page_navigator.h"
34 #include "content/public/browser/render_view_host.h" 33 #include "content/public/browser/render_view_host.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 render_frame_host, url, error_code, 245 render_frame_host, url, error_code,
247 error_description, was_ignored_by_handler); 246 error_description, was_ignored_by_handler);
248 } 247 }
249 } 248 }
250 249
251 bool NavigatorImpl::NavigateToEntry( 250 bool NavigatorImpl::NavigateToEntry(
252 FrameTreeNode* frame_tree_node, 251 FrameTreeNode* frame_tree_node,
253 const FrameNavigationEntry& frame_entry, 252 const FrameNavigationEntry& frame_entry,
254 const NavigationEntryImpl& entry, 253 const NavigationEntryImpl& entry,
255 NavigationController::ReloadType reload_type, 254 NavigationController::ReloadType reload_type,
256 bool is_same_document_history_load) { 255 bool is_same_document_history_load,
256 LoFiState lofi_state) {
257 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry"); 257 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry");
258 258
259 GURL dest_url = frame_entry.url(); 259 GURL dest_url = frame_entry.url();
260 Referrer dest_referrer = frame_entry.referrer(); 260 Referrer dest_referrer = frame_entry.referrer();
261 if (reload_type == 261 if (reload_type ==
262 NavigationController::ReloadType::RELOAD_ORIGINAL_REQUEST_URL && 262 NavigationController::ReloadType::RELOAD_ORIGINAL_REQUEST_URL &&
263 entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) { 263 entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) {
264 // We may have been redirected when navigating to the current URL. 264 // We may have been redirected when navigating to the current URL.
265 // Use the URL the user originally intended to visit, if it's valid and if a 265 // Use the URL the user originally intended to visit, if it's valid and if a
266 // POST wasn't involved; the latter case avoids issues with sending data to 266 // POST wasn't involved; the latter case avoids issues with sending data to
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 dest_render_frame_host->Navigate( 336 dest_render_frame_host->Navigate(
337 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, 337 entry.ConstructCommonNavigationParams(dest_url, dest_referrer,
338 frame_entry, navigation_type), 338 frame_entry, navigation_type),
339 entry.ConstructStartNavigationParams(), 339 entry.ConstructStartNavigationParams(),
340 entry.ConstructRequestNavigationParams( 340 entry.ConstructRequestNavigationParams(
341 frame_entry, navigation_start, is_same_document_history_load, 341 frame_entry, navigation_start, is_same_document_history_load,
342 frame_tree_node->has_committed_real_load(), 342 frame_tree_node->has_committed_real_load(),
343 controller_->GetPendingEntryIndex() == -1, 343 controller_->GetPendingEntryIndex() == -1,
344 controller_->GetIndexOfEntry(&entry), 344 controller_->GetIndexOfEntry(&entry),
345 controller_->GetLastCommittedEntryIndex(), 345 controller_->GetLastCommittedEntryIndex(),
346 controller_->GetEntryCount())); 346 controller_->GetEntryCount(),
347 lofi_state));
347 } else { 348 } else {
348 // No need to navigate again. Just resume the deferred request. 349 // No need to navigate again. Just resume the deferred request.
349 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( 350 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation(
350 entry.transferred_global_request_id()); 351 entry.transferred_global_request_id());
351 } 352 }
352 353
353 // Make sure no code called via RFH::Navigate clears the pending entry. 354 // Make sure no code called via RFH::Navigate clears the pending entry.
354 CHECK_EQ(controller_->GetPendingEntry(), &entry); 355 CHECK_EQ(controller_->GetPendingEntry(), &entry);
355 356
356 if (controller_->GetPendingEntryIndex() == -1 && 357 if (controller_->GetPendingEntryIndex() == -1 &&
(...skipping 14 matching lines...) Expand all
371 delegate_->DidStartNavigationToPendingEntry(dest_url, reload_type); 372 delegate_->DidStartNavigationToPendingEntry(dest_url, reload_type);
372 } 373 }
373 374
374 return true; 375 return true;
375 } 376 }
376 377
377 bool NavigatorImpl::NavigateToPendingEntry( 378 bool NavigatorImpl::NavigateToPendingEntry(
378 FrameTreeNode* frame_tree_node, 379 FrameTreeNode* frame_tree_node,
379 const FrameNavigationEntry& frame_entry, 380 const FrameNavigationEntry& frame_entry,
380 NavigationController::ReloadType reload_type, 381 NavigationController::ReloadType reload_type,
381 bool is_same_document_history_load) { 382 bool is_same_document_history_load,
383 LoFiState lofi_state) {
382 return NavigateToEntry(frame_tree_node, frame_entry, 384 return NavigateToEntry(frame_tree_node, frame_entry,
383 *controller_->GetPendingEntry(), reload_type, 385 *controller_->GetPendingEntry(), reload_type,
384 is_same_document_history_load); 386 is_same_document_history_load,
387 lofi_state);
385 } 388 }
386 389
387 void NavigatorImpl::DidNavigate( 390 void NavigatorImpl::DidNavigate(
388 RenderFrameHostImpl* render_frame_host, 391 RenderFrameHostImpl* render_frame_host,
389 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 392 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
390 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); 393 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree();
391 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); 394 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible();
392 395
393 if (ui::PageTransitionIsMainFrame(params.transition)) { 396 if (ui::PageTransitionIsMainFrame(params.transition)) {
394 if (delegate_) { 397 if (delegate_) {
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 946 entry->set_should_replace_entry(pending_entry->should_replace_entry());
944 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 947 entry->SetRedirectChain(pending_entry->GetRedirectChain());
945 } 948 }
946 controller_->SetPendingEntry(entry.Pass()); 949 controller_->SetPendingEntry(entry.Pass());
947 if (delegate_) 950 if (delegate_)
948 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 951 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
949 } 952 }
950 } 953 }
951 954
952 } // namespace content 955 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698