OLD | NEW |
---|---|
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/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 | 434 |
435 if (PageTransitionIsMainFrame(params.transition)) { | 435 if (PageTransitionIsMainFrame(params.transition)) { |
436 if (delegate_) { | 436 if (delegate_) { |
437 // When overscroll navigation gesture is enabled, a screenshot of the page | 437 // When overscroll navigation gesture is enabled, a screenshot of the page |
438 // in its current state is taken so that it can be used during the | 438 // in its current state is taken so that it can be used during the |
439 // nav-gesture. It is necessary to take the screenshot here, before | 439 // nav-gesture. It is necessary to take the screenshot here, before |
440 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can | 440 // calling RenderFrameHostManager::DidNavigateMainFrame, because that can |
441 // change WebContents::GetRenderViewHost to return the new host, instead | 441 // change WebContents::GetRenderViewHost to return the new host, instead |
442 // of the one that may have just been swapped out. | 442 // of the one that may have just been swapped out. |
443 if (delegate_->CanOverscrollContent()) { | 443 if (delegate_->CanOverscrollContent()) { |
444 bool page_id_changed; | 444 bool same_page_navigation = false; |
sky
2014/07/25 22:08:05
Is this the same as params.was_within_same_page?
mfomitchev
2014/07/25 22:29:15
Please see my reply to creis@ below.
| |
445 bool url_changed; | |
446 NavigationEntry* current_entry = controller_->GetLastCommittedEntry(); | 445 NavigationEntry* current_entry = controller_->GetLastCommittedEntry(); |
447 if (current_entry) { | 446 if (current_entry) { |
448 page_id_changed = params.page_id > 0 && | 447 url::Replacements<char> clear_ref; |
449 params.page_id != current_entry->GetPageID(); | 448 clear_ref.ClearRef(); |
450 url_changed = params.url != current_entry->GetURL(); | 449 const GURL new_url = params.url; |
451 } else { | 450 const GURL& cur_url = current_entry->GetURL(); |
452 page_id_changed = params.page_id > 0; | 451 if (new_url.ReplaceComponents(clear_ref) == |
Charlie Reis
2014/07/25 22:07:40
We probably shouldn't add yet another way to detec
mfomitchev
2014/07/25 22:29:15
Ok, so the pushState test does fail if I use param
Charlie Reis
2014/07/25 22:45:28
That's kind of a no-op example for pushState, thou
mfomitchev
2014/07/25 23:09:58
Yep, it fails. Changing it to use params.was_withi
| |
453 url_changed = params.url != GURL::EmptyGURL(); | 452 cur_url.ReplaceComponents(clear_ref)) { |
453 same_page_navigation = true; | |
454 } | |
454 } | 455 } |
455 | 456 // Don't take screenshots if we are staying on the same page. We want |
456 // We only want to take the screenshot if the are navigating to a | 457 // in-page navigations to be super fast, and taking a screenshot |
457 // different history entry than the current one. So if neither the | 458 // currently blocks GPU for a longer time than we are willing to |
458 // page id nor the url changed - don't take the screenshot. | 459 // tolerate in this use case. |
459 if (page_id_changed || url_changed) | 460 if (!same_page_navigation) |
460 controller_->TakeScreenshot(); | 461 controller_->TakeScreenshot(); |
461 } | 462 } |
462 | 463 |
463 // Run tasks that must execute just before the commit. | 464 // Run tasks that must execute just before the commit. |
464 bool is_navigation_within_page = controller_->IsURLInPageNavigation( | 465 bool is_navigation_within_page = controller_->IsURLInPageNavigation( |
465 params.url, params.was_within_same_page, render_frame_host); | 466 params.url, params.was_within_same_page, render_frame_host); |
466 delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page); | 467 delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page); |
467 } | 468 } |
468 | 469 |
469 if (!use_site_per_process) | 470 if (!use_site_per_process) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 | 643 |
643 // Navigations in Web UI pages count as browser-initiated navigations. | 644 // Navigations in Web UI pages count as browser-initiated navigations. |
644 params.is_renderer_initiated = false; | 645 params.is_renderer_initiated = false; |
645 } | 646 } |
646 | 647 |
647 if (delegate_) | 648 if (delegate_) |
648 delegate_->RequestOpenURL(render_frame_host, params); | 649 delegate_->RequestOpenURL(render_frame_host, params); |
649 } | 650 } |
650 | 651 |
651 } // namespace content | 652 } // namespace content |
OLD | NEW |