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

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

Issue 316553007: Making sure we don't take a GestureNav screenshot unless the history position changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/frame_host/navigation_controller_impl.h" 10 #include "content/browser/frame_host/navigation_controller_impl.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 420
421 if (PageTransitionIsMainFrame(params.transition)) { 421 if (PageTransitionIsMainFrame(params.transition)) {
422 if (delegate_) { 422 if (delegate_) {
423 // When overscroll navigation gesture is enabled, a screenshot of the page 423 // When overscroll navigation gesture is enabled, a screenshot of the page
424 // in its current state is taken so that it can be used during the 424 // in its current state is taken so that it can be used during the
425 // nav-gesture. It is necessary to take the screenshot here, before 425 // nav-gesture. It is necessary to take the screenshot here, before
426 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can 426 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can
427 // change WebContents::GetRenderViewHost to return the new host, instead 427 // change WebContents::GetRenderViewHost to return the new host, instead
428 // of the one that may have just been swapped out. 428 // of the one that may have just been swapped out.
429 if (delegate_->CanOverscrollContent()) 429 NavigationEntry* current_entry = controller_->GetLastCommittedEntry();
430 int32 current_page_id = current_entry ? current_entry->GetPageID() : -1;
nasko 2014/06/04 18:53:48 nit: it will be a bit more readable with an empty
mfomitchev 2014/06/04 19:26:20 Done.
431 // If page id didn't change, then this is not a navigation to a new
432 // history entry or to the previous entry, and we don't need to take the
433 // screenshot.
nasko 2014/06/04 18:53:48 nit: For back/forward navigations we still want to
mfomitchev 2014/06/04 19:26:20 Reworded
434 bool page_id_changed = params.page_id > 0 &&
435 params.page_id != current_page_id;
436 if (delegate_->CanOverscrollContent() && page_id_changed)
430 controller_->TakeScreenshot(); 437 controller_->TakeScreenshot();
431 438
432 // Run tasks that must execute just before the commit. 439 // Run tasks that must execute just before the commit.
433 delegate_->DidNavigateMainFramePreCommit(params); 440 delegate_->DidNavigateMainFramePreCommit(params);
434 } 441 }
435 442
436 if (!use_site_per_process) 443 if (!use_site_per_process)
437 frame_tree->root()->render_manager()->DidNavigateFrame(render_frame_host); 444 frame_tree->root()->render_manager()->DidNavigateFrame(render_frame_host);
438 } 445 }
439 446
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 621
615 // Navigations in Web UI pages count as browser-initiated navigations. 622 // Navigations in Web UI pages count as browser-initiated navigations.
616 params.is_renderer_initiated = false; 623 params.is_renderer_initiated = false;
617 } 624 }
618 625
619 if (delegate_) 626 if (delegate_)
620 delegate_->RequestOpenURL(render_frame_host, params); 627 delegate_->RequestOpenURL(render_frame_host, params);
621 } 628 }
622 629
623 } // namespace content 630 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698