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

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

Issue 2598163002: WebContentsObserver update for PlzNavigate methods (Closed)
Patch Set: Fixed AwWebContentsObserver Created 4 years 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: 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..8fc8fafbf5c38b48f197019886851c0af55cb5d6 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
@@ -6,6 +6,7 @@ package org.chromium.android_webview;
import org.chromium.android_webview.AwContents.VisualStateCallback;
import org.chromium.base.ThreadUtils;
+import org.chromium.content_public.browser.NavigationHandle;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.browser.WebContentsObserver;
import org.chromium.net.NetError;
@@ -87,11 +88,17 @@ public class AwWebContentsObserver extends WebContentsObserver {
}
@Override
- public void didNavigateMainFrame(final String url, String baseUrl,
- boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
+ public void didFinishNavigation(final NavigationHandle navigation) {
+ mCommittedNavigation = true;
+ AwContentsClient client = mAwContentsClient.get();
+ if (client != null) {
+ client.getCallbackHelper().postDoUpdateVisitedHistory(
+ navigation.getURL(), navigation.isReload());
+ }
+
// 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 (!navigation.isSamePage()) {
Maria 2016/12/27 19:31:10 Check for navigation.isInMainFrame() for everythin
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
@@ -103,7 +110,7 @@ public class AwWebContentsObserver extends WebContentsObserver {
public void onComplete(long requestId) {
AwContentsClient client = mAwContentsClient.get();
if (client == null) return;
- client.onPageCommitVisible(url);
+ client.onPageCommitVisible(navigation.getURL());
}
});
}
@@ -113,21 +120,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;
- client.getCallbackHelper().postOnPageFinished(url);
+ if (navigation.isSamePage() && client != null) {
+ client.getCallbackHelper().postOnPageFinished(navigation.getURL());
}
}
- @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;
}

Powered by Google App Engine
This is Rietveld 408576698