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

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

Issue 970883002: [Android WebView] Synthesize a fake page loading event on page source modification (Re-land) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed findbugs warning Created 5 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: android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
index 3f2c707dce8447bc8b0abc5a24dc508ac6b8c1b2..5e37d992ca24f1353d006c4381410dfc10e1f31c 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
@@ -11,6 +11,7 @@ import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
+import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@@ -19,6 +20,7 @@ import android.webkit.ValueCallback;
import org.chromium.base.ContentUriUtils;
import org.chromium.base.ThreadUtils;
+import org.chromium.content_public.browser.InvalidateTypes;
/**
* Adapts the AwWebContentsDelegate interface to the AwContentsClient interface.
@@ -213,6 +215,22 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate {
}
@Override
+ public void navigationStateChanged(int flags) {
+ if ((flags & InvalidateTypes.URL) != 0
+ && mAwContents.hasAccessedInitialDocument()
+ && mAwContents.getDidAttemptLoad()) {
+ // Hint the client to show the last committed url, as it may be unsafe to show
+ // the pending entry.
+ String url = mAwContents.getLastCommittedUrl();
+ url = TextUtils.isEmpty(url) ? "about:blank" : url;
+ mContentsClient.onPageStarted(url);
+ mContentsClient.onLoadResource(url);
+ mContentsClient.onProgressChanged(100);
+ mContentsClient.onPageFinished(url);
+ }
+ }
+
+ @Override
public void toggleFullscreenModeForTab(boolean enterFullscreen) {
if (enterFullscreen) {
mContentViewClient.enterFullscreen();

Powered by Google App Engine
This is Rietveld 408576698