summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/Bookmarks.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-03-02 16:01:49 -0500
committerLeon Scroggins <scroggo@google.com>2010-03-02 17:21:38 -0500
commitda3e030722f8703a27595e31a87428ca5df1f213 (patch)
tree205e12c449a8d009738c43af8ac171ae1d8007d5 /src/com/android/browser/Bookmarks.java
parent698dd4b994a4581b82d85cc417f46be014bdf5f0 (diff)
downloadpackages_apps_Browser-da3e030722f8703a27595e31a87428ca5df1f213.tar.gz
packages_apps_Browser-da3e030722f8703a27595e31a87428ca5df1f213.tar.bz2
packages_apps_Browser-da3e030722f8703a27595e31a87428ca5df1f213.zip
Do not insert duplicate urls into the browser database.
Move the logic for finding similar URLs to frameworks/base, and use it in addBookmark. In BrowserActivity, call smartUrlFilter before calling updateVisitedHistory, so the '/' will be appended before adding to the database. Part of fix for http://b/issue?id=2442391 Depends on a change to frameworks/base
Diffstat (limited to 'src/com/android/browser/Bookmarks.java')
-rw-r--r--src/com/android/browser/Bookmarks.java38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/com/android/browser/Bookmarks.java b/src/com/android/browser/Bookmarks.java
index 8d98f8995..2cbd85122 100644
--- a/src/com/android/browser/Bookmarks.java
+++ b/src/com/android/browser/Bookmarks.java
@@ -35,12 +35,6 @@ import java.util.Date;
* This class is purely to have a common place for adding/deleting bookmarks.
*/
/* package */ class Bookmarks {
- private static final String WHERE_CLAUSE
- = "url = ? OR url = ? OR url = ? OR url = ?";
- private static final String WHERE_CLAUSE_SECURE = "url = ? OR url = ?";
-
- private static String[] SELECTION_ARGS;
-
// We only want the user to be able to bookmark content that
// the browser can handle directly.
private static final String acceptableBookmarkSchemes[] = {
@@ -71,38 +65,8 @@ import java.util.Date;
Bitmap thumbnail, boolean retainIcon) {
// Want to append to the beginning of the list
long creationTime = new Date().getTime();
- // First we check to see if the user has already visited this
- // site. They may have bookmarked it in a different way from
- // how it's stored in the database, so allow different combos
- // to map to the same url.
- boolean secure = false;
- String compareString = url;
- if (compareString.startsWith("http://")) {
- compareString = compareString.substring(7);
- } else if (compareString.startsWith("https://")) {
- compareString = compareString.substring(8);
- secure = true;
- }
- if (compareString.startsWith("www.")) {
- compareString = compareString.substring(4);
- }
- if (secure) {
- SELECTION_ARGS = new String[2];
- SELECTION_ARGS[0] = "https://" + compareString;
- SELECTION_ARGS[1] = "https://www." + compareString;
- } else {
- SELECTION_ARGS = new String[4];
- SELECTION_ARGS[0] = compareString;
- SELECTION_ARGS[1] = "www." + compareString;
- SELECTION_ARGS[2] = "http://" + compareString;
- SELECTION_ARGS[3] = "http://" + SELECTION_ARGS[1];
- }
- Cursor cursor = cr.query(Browser.BOOKMARKS_URI,
- Browser.HISTORY_PROJECTION,
- secure ? WHERE_CLAUSE_SECURE : WHERE_CLAUSE,
- SELECTION_ARGS,
- null);
ContentValues map = new ContentValues();
+ Cursor cursor = Browser.getVisitedLike(cr, url);
if (cursor.moveToFirst() && cursor.getInt(
Browser.HISTORY_PROJECTION_BOOKMARK_INDEX) == 0) {
// This means we have been to this site but not bookmarked