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 831f9e1691a06034b7758c7a004287350c6849f8..e8e0f274ce067d492474ffba8cca4ac71bc7d8ea 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 |
| @@ -860,21 +860,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); |
| } |
| /** |
| @@ -1085,7 +1072,8 @@ public class ContentViewCore |
| * forwards directions. |
| */ |
| public void clearHistory() { |
| - if (mNativeContentViewCore != 0) nativeClearHistory(mNativeContentViewCore); |
| + assert mWebContents != null; |
| + mWebContents.getNavigationController().clearHistory(); |
| } |
| /** |
| @@ -2173,10 +2161,8 @@ public class ContentViewCore |
| } |
| public boolean getUseDesktopUserAgent() { |
| - if (mNativeContentViewCore != 0) { |
| - return nativeGetUseDesktopUserAgent(mNativeContentViewCore); |
| - } |
| - return false; |
| + assert mWebContents != null; |
| + return mWebContents.getNavigationController().getUseDesktopUserAgent(); |
| } |
| /** |
| @@ -2185,13 +2171,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; |
| + mWebContents.getNavigationController().setUseDesktopUserAgent(override, |
| + reloadOnChange); |
| } |
| public void clearSslPreferences() { |
| - if (mNativeContentViewCore != 0) nativeClearSslPreferences(mNativeContentViewCore); |
| + assert mWebContents != null; |
| + mWebContents.getNavigationController().clearSslPreferences(); |
| } |
| private void hideTextHandles() { |
| @@ -2923,35 +2910,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 |
|
Yaron
2014/07/23 18:58:38
Interesting. I think with the new NavigationContro
AKVT
2014/07/24 07:47:24
As suggested will take care in follow up patch.
|
| public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) { |
| + assert mWebContents != null; |
| NavigationHistory history = new NavigationHistory(); |
|
Yaron
2014/07/23 18:58:38
remove this.
AKVT
2014/07/24 07:47:24
Done.
|
| - if (mNativeContentViewCore != 0) { |
| - nativeGetDirectedNavigationHistory( |
| - mNativeContentViewCore, history, isForward, itemLimit); |
| - } |
| + mWebContents.getNavigationController().getDirectedNavigationHistory( |
|
Yaron
2014/07/23 18:58:38
missing "return"
AKVT
2014/07/24 07:47:24
Thanks. Removed unnecessary local variable.
|
| + isForward, itemLimit); |
| return history; |
| } |
| @@ -2960,10 +2931,9 @@ public class ContentViewCore |
| * current entry. |
| */ |
| public String getOriginalUrlForActiveNavigationEntry() { |
| - if (mNativeContentViewCore != 0) { |
| - return nativeGetOriginalUrlForActiveNavigationEntry(mNativeContentViewCore); |
| - } |
| - return ""; |
| + assert mWebContents != null; |
| + return mWebContents.getNavigationController(). |
| + getOriginalUrlForActiveNavigationEntry(); |
| } |
| /** |
| @@ -3100,21 +3070,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); |
| @@ -3188,8 +3143,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); |
| @@ -3200,12 +3153,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); |
| @@ -3215,12 +3162,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( |