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 436e65c6ca4f1445535e22ad4178a1fd8fdc4f85..b3aaef6107721014f0d9303bba4b22e2b9bb0a05 100644 |
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
@@ -57,6 +57,7 @@ import org.chromium.content.common.CleanupReference; |
import org.chromium.content_public.Referrer; |
import org.chromium.content_public.browser.GestureStateListener; |
import org.chromium.content_public.browser.JavaScriptCallback; |
+import org.chromium.content_public.browser.WebContents; |
import org.chromium.ui.base.ActivityWindowAndroid; |
import org.chromium.ui.base.WindowAndroid; |
import org.chromium.ui.gfx.DeviceDisplayInfo; |
@@ -182,6 +183,7 @@ public class AwContents { |
private final AwLayoutChangeListener mLayoutChangeListener; |
private final Context mContext; |
private ContentViewCore mContentViewCore; |
+ private WebContents mWebContents; |
private final AwContentsClient mContentsClient; |
private final AwContentViewClient mContentViewClient; |
private WebContentsObserverAndroid mWebContentsObserver; |
@@ -742,6 +744,7 @@ public class AwContents { |
if (mNativeAwContents != 0) { |
destroy(); |
mContentViewCore = null; |
+ mWebContents = null; |
} |
assert mNativeAwContents == 0 && mCleanupReference == null && mContentViewCore == null; |
@@ -764,7 +767,7 @@ public class AwContents { |
installWebContentsObserver(); |
mSettings.setWebContents(nativeWebContents); |
nativeSetDipScale(mNativeAwContents, (float) mDIPScale); |
- |
+ mWebContents = mContentViewCore.getWebContents(); |
// The only call to onShow. onHide should never be called. |
mContentViewCore.onShow(); |
} |
@@ -773,8 +776,7 @@ public class AwContents { |
if (mWebContentsObserver != null) { |
mWebContentsObserver.detachFromWebContents(); |
} |
- mWebContentsObserver = new AwWebContentsObserver(mContentViewCore.getWebContents(), |
- mContentsClient); |
+ mWebContentsObserver = new AwWebContentsObserver(mWebContents, mContentsClient); |
} |
/** |
@@ -1069,7 +1071,7 @@ public class AwContents { |
// If we are reloading the same url, then set transition type as reload. |
if (params.getUrl() != null && |
- params.getUrl().equals(mContentViewCore.getUrl()) && |
+ params.getUrl().equals(mWebContents.getUrl()) && |
params.getTransitionType() == PageTransitionTypes.PAGE_TRANSITION_LINK) { |
params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_RELOAD); |
} |
@@ -1126,7 +1128,7 @@ public class AwContents { |
* @return The URL of the current page or null if it's empty. |
*/ |
public String getUrl() { |
- String url = mContentViewCore.getUrl(); |
+ String url = mWebContents.getUrl(); |
if (url == null || url.trim().isEmpty()) return null; |
return url; |
} |
@@ -1317,7 +1319,7 @@ public class AwContents { |
* @see android.webkit.WebView#stopLoading() |
*/ |
public void stopLoading() { |
- mContentViewCore.stopLoading(); |
+ mWebContents.stop(); |
} |
/** |
@@ -1486,7 +1488,7 @@ public class AwContents { |
* @see android.webkit.WebView#getTitle() |
*/ |
public String getTitle() { |
- return mContentViewCore.getTitle(); |
+ return mWebContents.getTitle(); |
} |
/** |
@@ -1847,7 +1849,7 @@ public class AwContents { |
// but is optimized out in the restoreState case because the title is |
// already restored. See WebContentsImpl::UpdateTitleForEntry. So we |
// call the callback explicitly here. |
- if (result) mContentsClient.onReceivedTitle(mContentViewCore.getTitle()); |
+ if (result) mContentsClient.onReceivedTitle(mWebContents.getTitle()); |
return result; |
} |