From 79982b6ebef6be4b57d76797316ad1e5c32a4574 Mon Sep 17 00:00:00 2001 From: "dtrainor@chromium.org" Date: Thu, 5 Dec 2013 03:26:31 +0000 Subject: Expose swapping the web contents out to observers BUG=321901 Review URL: https://codereview.chromium.org/89563002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238874 0039d316-1c4b-4281-b951-d872f2087c98 --- .../java/src/org/chromium/chrome/browser/EmptyTabObserver.java | 3 +++ chrome/android/java/src/org/chromium/chrome/browser/TabBase.java | 1 + .../android/java/src/org/chromium/chrome/browser/TabObserver.java | 6 ++++++ .../java/src/org/chromium/content/browser/ContentViewCore.java | 1 + 4 files changed, 11 insertions(+) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/EmptyTabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/EmptyTabObserver.java index aecf9cf..d812f16 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/EmptyTabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/EmptyTabObserver.java @@ -19,6 +19,9 @@ public class EmptyTabObserver implements TabObserver { public void onFaviconUpdated(TabBase tab) { } @Override + public void onWebContentsSwapped(TabBase tab) { } + + @Override public void onLoadProgressChanged(TabBase tab, int progress) { } @Override diff --git a/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java b/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java index f809409..05f1386 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/TabBase.java @@ -713,6 +713,7 @@ public abstract class TabBase implements NavigationClient { mContentViewCore.attachImeAdapter(); for (TabObserver observer : mObservers) observer.onContentChanged(this); destroyNativePageInternal(previousNativePage); + for (TabObserver observer : mObservers) observer.onWebContentsSwapped(this); } @CalledByNative diff --git a/chrome/android/java/src/org/chromium/chrome/browser/TabObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/TabObserver.java index c967cc5..78f963d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/TabObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/TabObserver.java @@ -27,6 +27,12 @@ public interface TabObserver { */ void onFaviconUpdated(TabBase tab); + /** + * Called when the WebContents of a {@link TabBase} have been swapped. + * @param tab The notifying {@link TabBase}. + */ + void onWebContentsSwapped(TabBase tab); + // WebContentsDelegateAndroid methods --------------------------------------------------------- /** diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java index 16b9ebe..c0f2341 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java @@ -2871,6 +2871,7 @@ public class ContentViewCore * once the texture is actually ready. */ public boolean isReady() { + if (mNativeContentViewCore == 0) return false; return nativeIsRenderWidgetHostViewReady(mNativeContentViewCore); } -- cgit v1.1