Coloring clicked-on links
Following review comments
Merging in ben's change
Whitespace
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index 028d3d7..4600b49 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -274,6 +274,32 @@
}
/**
+ * Returns all the URLs in the history.
+ * Requires {@link android.Manifest.permission#READ_HISTORY_BOOKMARKS}
+ * @param cr The ContentResolver used to access the database.
+ * @hide pending API council approval
+ */
+ public static final String[] getVisitedHistory(ContentResolver cr) {
+ try {
+ String[] projection = new String[] { "url" };
+ Cursor c = cr.query(BOOKMARKS_URI,
+ projection,
+ "visits > 0",
+ null, null);
+ String[] str = new String[c.getCount()];
+ int i = 0;
+ while (c.moveToNext()) {
+ str[i] = c.getString(0);
+ i++;
+ }
+ c.deactivate();
+ return str;
+ } catch (IllegalStateException e) {
+ return new String[0];
+ }
+ }
+
+ /**
* If there are more than MAX_HISTORY_COUNT non-bookmark history
* items in the bookmark/history table, delete TRUNCATE_N_OLDEST
* of them. This is used to keep our history table to a
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index c87e5a5..f617401 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -30,6 +30,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.Process;
+import android.provider.Browser;
import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.KeyEvent;
@@ -310,6 +311,10 @@
});
}
+ protected String[] populateVisitedLinks() {
+ return Browser.getVisitedHistory(mContext.getContentResolver());
+ }
+
/**
* Shows a prompt to ask the user to set the Geolocation permission state
* for the given origin.