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

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

Issue 445403002: [android_webview] Factor AwWebContentsObserver out of AwContentsClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/java/src/org/chromium/android_webview/AwContentsClient.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/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index fc456df4a0d89ff83c3ce0ec1e57b8d2fa341ba2..8338559035220c8762571e0d4a9627c13eeb1464 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -52,6 +52,7 @@ import org.chromium.content.browser.ContentViewStatics;
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.content.browser.NavigationHistory;
import org.chromium.content.browser.PageTransitionTypes;
+import org.chromium.content.browser.WebContentsObserverAndroid;
import org.chromium.content.common.CleanupReference;
import org.chromium.content_public.Referrer;
import org.chromium.content_public.browser.GestureStateListener;
@@ -182,6 +183,7 @@ public class AwContents {
private ContentViewCore mContentViewCore;
private final AwContentsClient mContentsClient;
private final AwContentViewClient mContentViewClient;
+ private WebContentsObserverAndroid mWebContentsObserver;
private final AwContentsClientBridge mContentsClientBridge;
private final AwWebContentsDelegateAdapter mWebContentsDelegate;
private final AwContentsIoThreadClient mIoThreadClient;
@@ -758,7 +760,7 @@ public class AwContents {
new AwGestureStateListener(), mContentViewClient, mZoomControls);
nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mContentsClientBridge,
mIoThreadClient, mInterceptNavigationDelegate);
- mContentsClient.installWebContentsObserver(mContentViewCore.getWebContents());
+ installWebContentsObserver();
mSettings.setWebContents(nativeWebContents);
nativeSetDipScale(mNativeAwContents, (float) mDIPScale);
@@ -766,6 +768,14 @@ public class AwContents {
mContentViewCore.onShow();
}
+ private void installWebContentsObserver() {
+ if (mWebContentsObserver != null) {
+ mWebContentsObserver.detachFromWebContents();
+ }
+ mWebContentsObserver = new AwWebContentsObserver(mContentViewCore.getWebContents(),
+ mContentsClient);
+ }
+
/**
* Called on the "source" AwContents that is opening the popup window to
* provide the AwContents to host the pop up content.
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContentsClient.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698