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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java

Issue 2642303002: PlzNavigate: Chrome UI changes for new methods of WebContentsObserver (Closed)
Patch Set: errorDescription in WCOProxy Created 3 years, 10 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
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..dc6111fd099868a6dff9a0283597fb3f60d133f6 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 (!hasCommitted && isInMainFrame && !hasPendingNonNtpNavigation(tab)) {
Ted C 2017/02/10 00:36:01 I had a comment in an early patch set that I thin
shaktisahu 2017/02/10 08:07:41 Done.
+ 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() {

Powered by Google App Engine
This is Rietveld 408576698