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

Unified Diff: chrome/browser/tab_contents/navigation_controller.cc

Issue 125202: Revert 18373 - Consider a redirect following user gesture as userinitiated in... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.h ('k') | chrome/browser/tab_contents/tab_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/navigation_controller.cc
===================================================================
--- chrome/browser/tab_contents/navigation_controller.cc (revision 18510)
+++ chrome/browser/tab_contents/navigation_controller.cc (working copy)
@@ -90,12 +90,6 @@
new_url.ReplaceComponents(replacements);
}
-// Navigation within this limit since the last document load is considered to
-// be automatic (i.e., machine-initiated) rather than user-initiated unless
-// a user gesture has been observed.
-const base::TimeDelta kMaxAutoNavigationTimeDelta =
- base::TimeDelta::FromSeconds(5);
-
} // namespace
// NavigationController ---------------------------------------------------
@@ -430,14 +424,6 @@
}
}
-void NavigationController::DocumentLoadedInFrame() {
- last_document_loaded_ = base::TimeTicks::Now();
-}
-
-void NavigationController::OnUserGesture() {
- user_gesture_observed_ = true;
-}
-
bool NavigationController::RendererDidNavigate(
const ViewHostMsg_FrameNavigate_Params& params,
LoadCommittedDetails* details) {
@@ -519,8 +505,6 @@
details->http_status_code = params.http_status_code;
NotifyNavigationEntryCommitted(details);
- user_gesture_observed_ = false;
-
return true;
}
@@ -601,21 +585,6 @@
return NavigationType::EXISTING_PAGE;
}
-bool NavigationController::IsRedirect(
- const ViewHostMsg_FrameNavigate_Params& params) {
- // For main frame transition, we judge by params.transition.
- // Otherwise, by params.redirects.
- if (PageTransition::IsMainFrame(params.transition)) {
- return PageTransition::IsRedirect(params.transition);
- }
- return params.redirects.size() > 1;
-}
-
-bool NavigationController::IsLikelyAutoNavigation(base::TimeTicks now) {
- return !user_gesture_observed_ &&
- (now - last_document_loaded_) < kMaxAutoNavigationTimeDelta;
-}
-
void NavigationController::RendererDidNavigateToNewPage(
const ViewHostMsg_FrameNavigate_Params& params) {
NavigationEntry* new_entry;
@@ -642,14 +611,11 @@
new_entry->set_site_instance(tab_contents_->GetSiteInstance());
new_entry->set_has_post_data(params.is_post);
- // If the current entry is a redirection source and the redirection has
- // occurred within kMaxAutoNavigationTimeDelta since the last document load,
- // this is likely to be machine-initiated redirect and the entry needs to be
- // replaced with the new entry to avoid unwanted redirections in navigating
- // backward/forward.
- // Otherwise, just insert the new entry.
+ // If the current entry is a redirection source, it needs to be replaced with
+ // the new entry to avoid unwanted redirections in navigating backward /
+ // forward. Otherwise, just insert the new entry.
InsertOrReplaceEntry(new_entry,
- IsRedirect(params) && IsLikelyAutoNavigation(base::TimeTicks::Now()));
+ PageTransition::IsRedirect(new_entry->transition_type()));
}
void NavigationController::RendererDidNavigateToExistingPage(
@@ -721,22 +687,11 @@
NavigationEntry* new_entry = new NavigationEntry(*existing_entry);
new_entry->set_page_id(params.page_id);
new_entry->set_url(params.url);
- InsertOrReplaceEntry(new_entry,
- IsRedirect(params) && IsLikelyAutoNavigation(base::TimeTicks::Now()));
+ InsertOrReplaceEntry(new_entry, false);
}
void NavigationController::RendererDidNavigateNewSubframe(
const ViewHostMsg_FrameNavigate_Params& params) {
- if (PageTransition::StripQualifier(params.transition) ==
- PageTransition::AUTO_SUBFRAME) {
- // This is not user-initiated. Ignore.
- return;
- }
- if (IsRedirect(params)) {
- // This is redirect. Ignore.
- return;
- }
-
// Manual subframe navigations just get the current entry cloned so the user
// can go back or forward to it. The actual subframe information will be
// stored in the page state for each of those entries. This happens out of
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.h ('k') | chrome/browser/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698