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

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

Issue 10836155: Upstream ContentView.getNavigationHistory() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address tedchoc's review comments. Created 8 years, 4 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/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 ebdadbf503f2e5d654450c444144406e93a385fd..82794b403bf70db550c268c95b02c19dce9173e9 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
@@ -6,6 +6,7 @@ package org.chromium.content.browser;
import android.content.Context;
import android.content.res.Configuration;
+import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.os.Build;
import android.os.Bundle;
@@ -1106,6 +1107,26 @@ public class ContentViewCore implements MotionEventDelegate {
mAccessibilityInjector.setScriptEnabled(state);
}
+ /**
+ * Callback factory method for nativeGetNavigationHistory().
+ */
+ @CalledByNative
+ private void addToNavigationHistory(Object history, String url, String virtualUrl,
+ String originalUrl, String title, Bitmap favicon) {
+ NavigationEntry entry = new NavigationEntry(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();
+ int currentIndex = nativeGetNavigationHistory(mNativeContentViewCore, history);
+ history.setCurrentEntryIndex(currentIndex);
+ return history;
+ }
+
// The following methods are implemented at native side.
/**
@@ -1202,4 +1223,6 @@ public class ContentViewCore implements MotionEventDelegate {
String name, boolean requireAnnotation);
private native void nativeRemoveJavascriptInterface(int nativeContentViewCoreImpl, String name);
+
+ private native int nativeGetNavigationHistory(int nativeContentViewCoreImpl, Object context);
}

Powered by Google App Engine
This is Rietveld 408576698