Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| 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 6f22fcf9811528abd9d58739344be7b401c1f721..20f1d9f6bd8c6fab74bd77b881bbd7569aa2b9f8 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 |
| @@ -876,21 +876,8 @@ public class ContentViewCore |
| * @param params Parameters for this load. |
| */ |
| public void loadUrl(LoadUrlParams params) { |
| - if (mNativeContentViewCore == 0) return; |
| - |
| - nativeLoadUrl(mNativeContentViewCore, |
| - params.mUrl, |
| - params.mLoadUrlType, |
| - params.mTransitionType, |
| - params.getReferrer() != null ? params.getReferrer().getUrl() : null, |
| - params.getReferrer() != null ? params.getReferrer().getPolicy() : 0, |
| - params.mUaOverrideOption, |
| - params.getExtraHeadersString(), |
| - params.mPostData, |
| - params.mBaseUrlForDataUrl, |
| - params.mVirtualUrlForDataUrl, |
| - params.mCanLoadLocalResources, |
| - params.mIsRendererInitiated); |
| + assert mWebContents != null; |
| + mWebContents.getNavigationController().loadUrl(params); |
| } |
| /** |
| @@ -1101,7 +1088,8 @@ public class ContentViewCore |
| * forwards directions. |
| */ |
| public void clearHistory() { |
| - if (mNativeContentViewCore != 0) nativeClearHistory(mNativeContentViewCore); |
| + assert mWebContents != null; |
| + mWebContents.getNavigationController().clearHistory(); |
| } |
| /** |
| @@ -2248,10 +2236,8 @@ public class ContentViewCore |
| } |
| public boolean getUseDesktopUserAgent() { |
| - if (mNativeContentViewCore != 0) { |
| - return nativeGetUseDesktopUserAgent(mNativeContentViewCore); |
| - } |
| - return false; |
| + assert mWebContents != null; |
| + return mWebContents.getNavigationController().getUseDesktopUserAgent(); |
| } |
| /** |
| @@ -2260,13 +2246,14 @@ public class ContentViewCore |
| * @param reloadOnChange Reload the page if the UA has changed. |
| */ |
| public void setUseDesktopUserAgent(boolean override, boolean reloadOnChange) { |
| - if (mNativeContentViewCore != 0) { |
| - nativeSetUseDesktopUserAgent(mNativeContentViewCore, override, reloadOnChange); |
| - } |
| + assert mWebContents != null; |
|
Yaron
2014/07/22 20:49:06
Sadly, I think this one can happen, which would be
Ted C
2014/07/23 00:04:22
A CVC should always have a WebContents (unless des
|
| + mWebContents.getNavigationController().setUseDesktopUserAgent(override, |
| + reloadOnChange); |
| } |
| public void clearSslPreferences() { |
| - if (mNativeContentViewCore != 0) nativeClearSslPreferences(mNativeContentViewCore); |
| + assert mWebContents != null; |
| + mWebContents.getNavigationController().clearSslPreferences(); |
| } |
| private boolean isSelectionHandleShowing() { |
| @@ -3085,35 +3072,19 @@ public class ContentViewCore |
| } |
| /** |
| - * Callback factory method for nativeGetNavigationHistory(). |
| - */ |
| - @CalledByNative |
| - private void addToNavigationHistory(Object history, int index, String url, String virtualUrl, |
| - String originalUrl, String title, Bitmap favicon) { |
| - NavigationEntry entry = new NavigationEntry( |
| - index, url, virtualUrl, originalUrl, title, favicon); |
| - ((NavigationHistory) history).addEntry(entry); |
| - } |
| - |
| - /** |
| * Get a copy of the navigation history of the view. |
| */ |
| public NavigationHistory getNavigationHistory() { |
| - NavigationHistory history = new NavigationHistory(); |
| - if (mNativeContentViewCore != 0) { |
| - int currentIndex = nativeGetNavigationHistory(mNativeContentViewCore, history); |
| - history.setCurrentEntryIndex(currentIndex); |
| - } |
| - return history; |
| + assert mWebContents != null; |
| + return mWebContents.getNavigationController().getNavigationHistory(); |
| } |
| @Override |
| public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) { |
| + assert mWebContents != null; |
| NavigationHistory history = new NavigationHistory(); |
| - if (mNativeContentViewCore != 0) { |
| - nativeGetDirectedNavigationHistory( |
| - mNativeContentViewCore, history, isForward, itemLimit); |
| - } |
| + mWebContents.getNavigationController().getDirectedNavigationHistory( |
| + isForward, itemLimit); |
| return history; |
| } |
| @@ -3122,10 +3093,9 @@ public class ContentViewCore |
| * current entry. |
| */ |
| public String getOriginalUrlForActiveNavigationEntry() { |
| - if (mNativeContentViewCore != 0) { |
| - return nativeGetOriginalUrlForActiveNavigationEntry(mNativeContentViewCore); |
| - } |
| - return ""; |
| + assert mWebContents != null; |
| + return mWebContents.getNavigationController(). |
| + getOriginalUrlForActiveNavigationEntry(); |
| } |
| /** |
| @@ -3262,21 +3232,6 @@ public class ContentViewCore |
| private native void nativeOnJavaContentViewCoreDestroyed(long nativeContentViewCoreImpl); |
| - private native void nativeLoadUrl( |
| - long nativeContentViewCoreImpl, |
| - String url, |
| - int loadUrlType, |
| - int transitionType, |
| - String referrerUrl, |
| - int referrerPolicy, |
| - int uaOverrideOption, |
| - String extraHeaders, |
| - byte[] postData, |
| - String baseUrlForDataUrl, |
| - String virtualUrlForDataUrl, |
| - boolean canLoadLocalResources, |
| - boolean isRendererInitiated); |
| - |
| private native String nativeGetURL(long nativeContentViewCoreImpl); |
| private native boolean nativeIsIncognito(long nativeContentViewCoreImpl); |
| @@ -3347,8 +3302,6 @@ public class ContentViewCore |
| private native void nativeSelectPopupMenuItems(long nativeContentViewCoreImpl, int[] indices); |
| - private native void nativeClearHistory(long nativeContentViewCoreImpl); |
| - |
| private native void nativeEvaluateJavaScript(long nativeContentViewCoreImpl, |
| String script, JavaScriptCallback callback, boolean startRenderer); |
| @@ -3359,12 +3312,6 @@ public class ContentViewCore |
| private native int nativeGetCurrentRenderProcessId(long nativeContentViewCoreImpl); |
| - private native void nativeSetUseDesktopUserAgent(long nativeContentViewCoreImpl, |
| - boolean enabled, boolean reloadOnChange); |
| - private native boolean nativeGetUseDesktopUserAgent(long nativeContentViewCoreImpl); |
| - |
| - private native void nativeClearSslPreferences(long nativeContentViewCoreImpl); |
| - |
| private native void nativeSetAllowJavascriptInterfacesInspection( |
| long nativeContentViewCoreImpl, boolean allow); |
| @@ -3374,12 +3321,6 @@ public class ContentViewCore |
| private native void nativeRemoveJavascriptInterface(long nativeContentViewCoreImpl, |
| String name); |
| - private native int nativeGetNavigationHistory(long nativeContentViewCoreImpl, Object context); |
| - private native void nativeGetDirectedNavigationHistory(long nativeContentViewCoreImpl, |
| - Object context, boolean isForward, int maxEntries); |
| - private native String nativeGetOriginalUrlForActiveNavigationEntry( |
| - long nativeContentViewCoreImpl); |
| - |
| private native void nativeWasResized(long nativeContentViewCoreImpl); |
| private native void nativeSetAccessibilityEnabled( |