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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/framehost/NavigationControllerImpl.java

Issue 406023002: Restructuring NavigationController functionalities from ContentViewCore to NavigationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch with findbugs_known_bugs.txt changes. Created 6 years, 3 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
Index: content/public/android/java/src/org/chromium/content/browser/framehost/NavigationControllerImpl.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/framehost/NavigationControllerImpl.java b/content/public/android/java/src/org/chromium/content/browser/framehost/NavigationControllerImpl.java
index 44233f4b9e0169b1e645ce10f00fcafe177e5da1..131da09c9bb27e485f120808931bbfcb93d57c7f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/framehost/NavigationControllerImpl.java
+++ b/content/public/android/java/src/org/chromium/content/browser/framehost/NavigationControllerImpl.java
@@ -4,9 +4,14 @@
package org.chromium.content.browser.framehost;
+import android.graphics.Bitmap;
+
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
+import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.NavigationController;
+import org.chromium.content_public.browser.NavigationEntry;
+import org.chromium.content_public.browser.NavigationHistory;
/**
* The NavigationControllerImpl Java wrapper to allow communicating with the native
@@ -121,6 +126,86 @@ import org.chromium.content_public.browser.NavigationController;
}
}
+ @Override
+ public void loadUrl(LoadUrlParams params) {
+ if (mNativeNavigationControllerAndroid != 0) {
+ nativeLoadUrl(
+ mNativeNavigationControllerAndroid,
+ params.getUrl(),
+ params.getLoadUrlType(), params.getTransitionType(),
+ params.getReferrer() != null ? params.getReferrer().getUrl() : null,
+ params.getReferrer() != null ? params.getReferrer().getPolicy() : 0,
+ params.getUserAgentOverrideOption(),
+ params.getExtraHeadersString(),
+ params.getPostData(),
+ params.getBaseUrl(),
+ params.getVirtualUrlForDataUrl(),
+ params.getCanLoadLocalResources(),
+ params.getIsRendererInitiated());
+ }
+ }
+
+ @Override
+ public void clearHistory() {
+ if (mNativeNavigationControllerAndroid != 0) {
+ nativeClearHistory(mNativeNavigationControllerAndroid);
+ }
+ }
+
+ @Override
+ public NavigationHistory getNavigationHistory() {
+ if (mNativeNavigationControllerAndroid == 0) return null;
+ NavigationHistory history = new NavigationHistory();
+ int currentIndex = nativeGetNavigationHistory(
+ mNativeNavigationControllerAndroid, history);
+ history.setCurrentEntryIndex(currentIndex);
+ return history;
+ }
+
+ @Override
+ public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) {
+ if (mNativeNavigationControllerAndroid == 0) return null;
+ NavigationHistory history = new NavigationHistory();
+ nativeGetDirectedNavigationHistory(mNativeNavigationControllerAndroid,
+ history, isForward, itemLimit);
+ return history;
+ }
+
+ @Override
+ public String getOriginalUrlForVisibleNavigationEntry() {
+ if (mNativeNavigationControllerAndroid == 0) return null;
+ return nativeGetOriginalUrlForVisibleNavigationEntry(mNativeNavigationControllerAndroid);
+ }
+
+ @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);
+ }
+
+ @Override
+ public void clearSslPreferences() {
+ if (mNativeNavigationControllerAndroid != 0) {
+ nativeClearSslPreferences(mNativeNavigationControllerAndroid);
+ }
+ }
+
+ @Override
+ public boolean getUseDesktopUserAgent() {
+ if (mNativeNavigationControllerAndroid == 0) return false;
+ return nativeGetUseDesktopUserAgent(mNativeNavigationControllerAndroid);
+ }
+
+ @Override
+ public void setUseDesktopUserAgent(boolean override, boolean reloadOnChange) {
+ if (mNativeNavigationControllerAndroid != 0) {
+ nativeSetUseDesktopUserAgent(mNativeNavigationControllerAndroid,
+ override, reloadOnChange);
+ }
+ }
+
private native boolean nativeCanGoBack(long nativeNavigationControllerAndroid);
private native boolean nativeCanGoForward(long nativeNavigationControllerAndroid);
private native void nativeLoadIfNecessary(long nativeNavigationControllerAndroid);
@@ -138,4 +223,29 @@ import org.chromium.content_public.browser.NavigationController;
boolean checkForRepost);
private native void nativeReloadIgnoringCache(long nativeNavigationControllerAndroid,
boolean checkForRepost);
+ private native void nativeLoadUrl(
+ long nativeNavigationControllerAndroid,
+ 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 void nativeClearHistory(long nativeNavigationControllerAndroid);
+ private native int nativeGetNavigationHistory(long nativeNavigationControllerAndroid,
+ Object history);
+ private native void nativeGetDirectedNavigationHistory(long nativeNavigationControllerAndroid,
+ NavigationHistory history, boolean isForward, int itemLimit);
+ private native String nativeGetOriginalUrlForVisibleNavigationEntry(
+ long nativeNavigationControllerAndroid);
+ private native void nativeClearSslPreferences(long nativeNavigationControllerAndroid);
+ private native boolean nativeGetUseDesktopUserAgent(long nativeNavigationControllerAndroid);
+ private native void nativeSetUseDesktopUserAgent(long nativeNavigationControllerAndroid,
+ boolean override, boolean reloadOnChange);
}

Powered by Google App Engine
This is Rietveld 408576698