Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java |
index 73e32d0886a2d261229d15f61ef49449db4edbce..74573004f37e4a2893300685089bcddb26577b5e 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java |
@@ -308,15 +308,6 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe |
} |
@Override |
- public void onDidNavigateMainFrame(Tab tab, String url, String baseUrl, |
- boolean isNavigationToDifferentPage, boolean isFragmentNavigation, |
- int statusCode) { |
- if (isNavigationToDifferentPage) { |
- mToolbar.onNavigatedToDifferentPage(); |
- } |
- } |
- |
- @Override |
public void onTitleUpdated(Tab tab) { |
mLocationBar.setTitleToPageTitle(); |
} |
@@ -393,21 +384,6 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe |
} |
@Override |
- public void onDidStartNavigationToPendingEntry(Tab tab, String url) { |
- // Update URL as soon as it becomes available when it's a new tab. |
- // But we want to update only when it's a new tab. So we check whether the current |
- // navigation entry is initial, meaning whether it has the same target URL as the |
- // initial URL of the tab. |
- WebContents webContents = tab.getWebContents(); |
- if (webContents == null) return; |
- NavigationController navigationController = webContents.getNavigationController(); |
- if (navigationController == null) return; |
- if (navigationController.isInitialNavigation()) { |
- mLocationBar.setUrlToPageUrl(); |
- } |
- } |
- |
- @Override |
public void onLoadUrl(Tab tab, LoadUrlParams params, int loadType) { |
NewTabPage ntp = mToolbarModel.getNewTabPageForCurrentTab(); |
if (ntp == null) return; |
@@ -432,21 +408,6 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe |
} |
@Override |
- public void onDidFailLoad(Tab tab, boolean isProvisionalLoad, boolean isMainFrame, |
- int errorCode, String description, String failingUrl) { |
- NewTabPage ntp = mToolbarModel.getNewTabPageForCurrentTab(); |
- if (ntp == null) return; |
- |
- // If the load failed due to a different navigation, there is no need to reset the |
- // location bar animations. |
- if (isProvisionalLoad && isMainFrame && !hasPendingNonNtpNavigation(tab)) { |
- ntp.setUrlFocusAnimationsDisabled(false); |
- mToolbar.onTabOrModelChanged(); |
- if (mToolbar.getProgressBar() != null) mToolbar.getProgressBar().finish(false); |
- } |
- } |
- |
- @Override |
public void onContextualActionBarVisibilityChanged(Tab tab, boolean visible) { |
if (visible) RecordUserAction.record("MobileActionBarShown"); |
ActionBar actionBar = mActionBarDelegate.getSupportActionBar(); |
@@ -461,16 +422,27 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe |
} |
@Override |
- public void onDidStartProvisionalLoadForFrame( |
- Tab tab, boolean isMainFrame, String validatedUrl) { |
+ public void onDidStartNavigation(Tab tab, String url, boolean isInMainFrame, |
+ boolean isSamePage, boolean isErrorPage) { |
+ if (!isInMainFrame) return; |
+ // Update URL as soon as it becomes available when it's a new tab. |
+ // But we want to update only when it's a new tab. So we check whether the current |
+ // navigation entry is initial, meaning whether it has the same target URL as the |
+ // initial URL of the tab. |
+ if (tab.getWebContents() != null |
+ && tab.getWebContents().getNavigationController() != null |
+ && tab.getWebContents().getNavigationController().isInitialNavigation()) { |
+ mLocationBar.setUrlToPageUrl(); |
+ } |
+ |
+ if (isSamePage) return; |
// This event is used as the primary trigger for the progress bar because it |
// is the earliest indication that a load has started for a particular frame. In |
// the case of the progress bar, it should only traverse the screen a single time |
// per page load. So if this event states the main frame has started loading the |
// progress bar is started. |
- if (!isMainFrame) return; |
- if (NativePageFactory.isNativePageUrl(validatedUrl, tab.isIncognito())) { |
+ if (NativePageFactory.isNativePageUrl(url, tab.isIncognito())) { |
finishLoadProgress(false); |
return; |
} |
@@ -479,6 +451,27 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe |
startLoadProgress(); |
updateLoadProgress(tab.getProgress()); |
} |
+ |
+ @Override |
+ public void onDidFinishNavigation(Tab tab, String url, boolean isInMainFrame, |
+ boolean isErrorPage, boolean hasCommitted, boolean isSamePage, |
+ boolean isFragmentNavigation, Integer pageTransition, int errorCode, |
+ int httpStatusCode) { |
+ if (hasCommitted && isInMainFrame && !isSamePage) { |
+ mToolbar.onNavigatedToDifferentPage(); |
+ } |
+ |
+ // If the load failed due to a different navigation, there is no need to reset the |
+ // location bar animations. |
+ if (errorCode != 0 && isInMainFrame && !hasPendingNonNtpNavigation(tab)) { |
+ NewTabPage ntp = mToolbarModel.getNewTabPageForCurrentTab(); |
+ if (ntp == null) return; |
+ |
+ ntp.setUrlFocusAnimationsDisabled(false); |
+ mToolbar.onTabOrModelChanged(); |
+ if (mToolbar.getProgressBar() != null) mToolbar.getProgressBar().finish(false); |
+ } |
+ } |
}; |
mBookmarksObserver = new BookmarkBridge.BookmarkModelObserver() { |