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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java

Issue 2642303002: PlzNavigate: Chrome UI changes for new methods of WebContentsObserver (Closed)
Patch Set: undo changes for error description 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
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
index 9a444fef9b00c0c7c53fbc506336eb7e4d43cc5c..38262899bf1d849c01f826acdd21f45fcd4debcf 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
@@ -9,6 +9,7 @@ import org.chromium.base.ThreadUtils;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.browser.WebContentsObserver;
import org.chromium.net.NetError;
+import org.chromium.ui.base.PageTransition;
import java.lang.ref.WeakReference;
@@ -65,8 +66,8 @@ public class AwWebContentsObserver extends WebContentsObserver {
}
@Override
- public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
- String description, String failingUrl, boolean wasIgnoredByHandler) {
+ public void didFailLoad(
+ boolean isMainFrame, int errorCode, String description, String failingUrl) {
AwContentsClient client = mAwContentsClient.get();
if (client == null) return;
String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUrl();
@@ -87,11 +88,30 @@ public class AwWebContentsObserver extends WebContentsObserver {
}
@Override
- public void didNavigateMainFrame(final String url, String baseUrl,
- boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
+ public void didFinishNavigation(final String url, boolean isInMainFrame, boolean isErrorPage,
+ boolean hasCommitted, boolean isSamePage, boolean isFragmentNavigation,
+ Integer pageTransition, int errorCode, String errorDescription, int httpStatusCode) {
+ if (errorCode != 0) {
+ didFailLoad(isInMainFrame, errorCode, errorDescription, url);
+ return;
+ }
+
+ if (!hasCommitted) return;
+
+ mCommittedNavigation = true;
+
+ AwContentsClient client = mAwContentsClient.get();
+ if (hasCommitted && client != null) {
+ boolean isReload = pageTransition != null
+ && ((pageTransition & PageTransition.CORE_MASK) == PageTransition.RELOAD);
+ client.getCallbackHelper().postDoUpdateVisitedHistory(url, isReload);
+ }
+
+ if (!isInMainFrame) return;
+
// Only invoke the onPageCommitVisible callback when navigating to a different page,
// but not when navigating to a different fragment within the same page.
- if (isNavigationToDifferentPage) {
+ if (!isSamePage) {
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
@@ -111,23 +131,11 @@ public class AwWebContentsObserver extends WebContentsObserver {
});
}
- // This is here to emulate the Classic WebView firing onPageFinished for main frame
- // navigations where only the hash fragment changes.
- if (isFragmentNavigation) {
- AwContentsClient client = mAwContentsClient.get();
- if (client == null) return;
+ if (client != null && isFragmentNavigation) {
client.getCallbackHelper().postOnPageFinished(url);
}
}
- @Override
- public void didNavigateAnyFrame(String url, String baseUrl, boolean isReload) {
- mCommittedNavigation = true;
- final AwContentsClient client = mAwContentsClient.get();
- if (client == null) return;
- client.getCallbackHelper().postDoUpdateVisitedHistory(url, isReload);
- }
-
public boolean didEverCommitNavigation() {
return mCommittedNavigation;
}
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwWebContentsObserverTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698