| 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 1b771ee204de7f466bc69fdbfe3fe7fe260260b4..2fe2bac1a2b41825a6c96c6035e0e22ad9440fac 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,26 @@ 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 isErrorPage) {
|
| + // 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();
|
| + }
|
| +
|
| // 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 (!isInMainFrame) return;
|
|
|
| - if (NativePageFactory.isNativePageUrl(validatedUrl, tab.isIncognito())) {
|
| + if (NativePageFactory.isNativePageUrl(url, tab.isIncognito())) {
|
| finishLoadProgress(false);
|
| return;
|
| }
|
| @@ -479,6 +450,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 (!hasCommitted && 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() {
|
|
|