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

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

Issue 1161783005: [Android WebView] Send WebChromeClient.onReceivedTitle when navigating back (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typo Created 5 years, 6 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/AwContentsClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
index 5a07dc8740f2f8415d6974f333c33e77bbfa58d1..71656c509f8a4b0798a4d3bd6578c683efc925f7 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
@@ -13,6 +13,7 @@ import android.net.Uri;
import android.net.http.SslError;
import android.os.Looper;
import android.os.Message;
+import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
@@ -44,6 +45,12 @@ public abstract class AwContentsClient {
// Last background color reported from the renderer. Holds the sentinal value INVALID_COLOR
// if not valid.
private int mCachedRendererBackgroundColor = INVALID_COLOR;
+ // Holds the last known page title. {@link ContentViewClient#onUpdateTitle} is unreliable,
+ // particularly for navigating backwards and forwards in the history stack. Instead, the last
+ // known document title is kept here, and the clients gets updated whenever the value has
+ // actually changed. Blink also only sends updates when the document title have changed,
+ // so behaviours are consistent.
+ private String mTitle = "";
private static final int INVALID_COLOR = 0;
@@ -324,4 +331,10 @@ public abstract class AwContentsClient {
View view, ActionHandler actionHandler, boolean floating);
public abstract boolean supportsFloatingActionMode();
+
+ public void updateTitle(String title, boolean forceNotification) {
+ if (!forceNotification && TextUtils.equals(mTitle, title)) return;
+ mTitle = title;
+ mCallbackHelper.postOnReceivedTitle(mTitle);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698