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

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

Issue 873583004: Revert of Remove the use of page id from NavController's GetVisibleEntry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // initiated navigations. Most renderer-initiated navigations should not 439 // initiated navigations. Most renderer-initiated navigations should not
440 // show the pending entry, to prevent URL spoof attacks. 440 // show the pending entry, to prevent URL spoof attacks.
441 // 441 //
442 // We make an exception for renderer-initiated navigations in new tabs, as 442 // We make an exception for renderer-initiated navigations in new tabs, as
443 // long as no other page has tried to access the initial empty document in 443 // long as no other page has tried to access the initial empty document in
444 // the new tab. If another page modifies this blank page, a URL spoof is 444 // the new tab. If another page modifies this blank page, a URL spoof is
445 // possible, so we must stop showing the pending entry. 445 // possible, so we must stop showing the pending entry.
446 bool safe_to_show_pending = 446 bool safe_to_show_pending =
447 pending_entry_ && 447 pending_entry_ &&
448 // Require a new navigation. 448 // Require a new navigation.
449 pending_entry_index_ == -1 && 449 pending_entry_->GetPageID() == -1 &&
450 // Require either browser-initiated or an unmodified new tab. 450 // Require either browser-initiated or an unmodified new tab.
451 (!pending_entry_->is_renderer_initiated() || IsUnmodifiedBlankTab()); 451 (!pending_entry_->is_renderer_initiated() || IsUnmodifiedBlankTab());
452 452
453 // Also allow showing the pending entry for history navigations in a new tab, 453 // Also allow showing the pending entry for history navigations in a new tab,
454 // such as Ctrl+Back. In this case, no existing page is visible and no one 454 // such as Ctrl+Back. In this case, no existing page is visible and no one
455 // can script the new tab before it commits. 455 // can script the new tab before it commits.
456 if (!safe_to_show_pending && 456 if (!safe_to_show_pending &&
457 pending_entry_ && 457 pending_entry_ &&
458 pending_entry_index_ != -1 && 458 pending_entry_->GetPageID() != -1 &&
459 IsInitialNavigation() && 459 IsInitialNavigation() &&
460 !pending_entry_->is_renderer_initiated()) 460 !pending_entry_->is_renderer_initiated())
461 safe_to_show_pending = true; 461 safe_to_show_pending = true;
462 462
463 if (safe_to_show_pending) 463 if (safe_to_show_pending)
464 return pending_entry_; 464 return pending_entry_;
465 return GetLastCommittedEntry(); 465 return GetLastCommittedEntry();
466 } 466 }
467 467
468 int NavigationControllerImpl::GetCurrentEntryIndex() const { 468 int NavigationControllerImpl::GetCurrentEntryIndex() const {
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 } 1777 }
1778 } 1778 }
1779 } 1779 }
1780 1780
1781 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1781 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1782 const base::Callback<base::Time()>& get_timestamp_callback) { 1782 const base::Callback<base::Time()>& get_timestamp_callback) {
1783 get_timestamp_callback_ = get_timestamp_callback; 1783 get_timestamp_callback_ = get_timestamp_callback;
1784 } 1784 }
1785 1785
1786 } // namespace content 1786 } // 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