diff options
author | laforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 20:22:11 +0000 |
---|---|---|
committer | laforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 20:22:11 +0000 |
commit | 09b8f82f39b2e3613a4518d9390004522e432063 (patch) | |
tree | 5d2f12f8c870fe0b222ae578bd1f8b4a1e1bd360 /chrome/browser/tab_contents/navigation_controller.h | |
parent | 44a96738ed0547db89b227399c0b46aa50cbd78e (diff) | |
download | chromium_src-09b8f82f39b2e3613a4518d9390004522e432063.zip chromium_src-09b8f82f39b2e3613a4518d9390004522e432063.tar.gz chromium_src-09b8f82f39b2e3613a4518d9390004522e432063.tar.bz2 |
Revert 18512 - Revert 18373 Consider a redirect following user gesture as userinitiated in maintaining
navigation entries. Also, ignore redirect or machineinitiated new subframe
navigations.
The current code treats all redirects as machineinitiated in processing
navigation to a new page (to fix Bugs 9663 and 10531). This is not always
appropriate, because some sites, e.g., www.google.com/ig, use redirect to
implement userinitiated navigation (Bug 11896).
This change assumes that a machineinitiated redirect happens within 300ms
since the last document load was completed, while a userinitiated one
happens later.
This assumption is not always correct, e.g., a user may cause transition within
300ms. But I cannot think of any better ways to tell if a redirect is machine
initiated or userinitiated.
I believe this change works good enough, at least better than the status quo.
Review URL: http://codereview.chromium.org/115919
TEST=Open http://www.hp.com and observe it redirects to
http://www.hp.com/#Product . Hit Back button and observe
the former URL is not visited. Open http://www.google.com/ig and
click tabs inside the page, and try hitting Back and Forward to see if the
navigation is right. Open http://www.google.com/codesearch, search for
something, click on a result item, and try hitting Back.
BUG=11896,12820
TBR=yuzo@chromium.org
Review URL: http://codereview.chromium.org/125202
TBR=laforge@chromium.org
Review URL: http://codereview.chromium.org/126221
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/navigation_controller.h')
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.h b/chrome/browser/tab_contents/navigation_controller.h index 5a7fba9..8419e0b 100644 --- a/chrome/browser/tab_contents/navigation_controller.h +++ b/chrome/browser/tab_contents/navigation_controller.h @@ -11,6 +11,7 @@ #include "base/linked_ptr.h" #include "base/string16.h" +#include "base/time.h" #include "googleurl/src/gurl.h" #include "chrome/browser/sessions/session_id.h" #include "chrome/browser/ssl/ssl_manager.h" @@ -288,6 +289,12 @@ class NavigationController { return tab_contents_; } + // Called when a document has been loaded in a frame. + void DocumentLoadedInFrame(); + + // Called when the user presses the mouse, enter key or space bar. + void OnUserGesture(); + // For use by TabContents ---------------------------------------------------- // Handles updating the navigation state after the renderer has navigated. @@ -432,6 +439,13 @@ class NavigationController { // Discards the transient entry. void DiscardTransientEntry(); + // Returns true if the navigation is redirect. + bool IsRedirect(const ViewHostMsg_FrameNavigate_Params& params); + + // Returns true if the navigation is likley to be automatic rather than + // user-initiated. + bool IsLikelyAutoNavigation(base::TimeTicks now); + // --------------------------------------------------------------------------- // The user profile associated with this controller @@ -491,6 +505,12 @@ class NavigationController { // Unique identifier of the window we're in. Used by session restore. SessionID window_id_; + // The time ticks at which the last document was loaded. + base::TimeTicks last_document_loaded_; + + // Whether a user gesture has been observed since the last navigation. + bool user_gesture_observed_; + // Should Reload check for post data? The default is true, but is set to false // when testing. static bool check_for_repost_; |