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

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

Issue 924833003: [Android WebView] Synthesize a fake page loading event on page source modification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed android_aosp & rebased 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..0689b6582692cf61d88987ab8f9e9d4db3b1085e 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) == InvalidateTypes.URL
+ && mAwContents.hasPageScriptAccessedInitialDocument()) {
+ String url = mAwContents.getUrl();
+ final String aboutBlank = "about:blank";
+ url = TextUtils.isEmpty(url) ? aboutBlank : url;
Charlie Reis 2015/02/23 21:28:04 I'm concerned about this code being different from
mnaganov (inactive) 2015/02/23 22:17:55 I'll double-check, if we are allowed to pass null
mnaganov (inactive) 2015/02/24 11:28:42 I have checked that when executing WebView.loadUrl
Charlie Reis 2015/02/24 19:37:55 Sure, I'm not concerned about rewriting "" to abou
+ if (aboutBlank.equals(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