am 331c7788: Store info in the bookmarks/history database on whether it was a manually entered url.
Merge commit '331c7788a84fc6f625ac1bafbb33cf7da1116407' into eclair-mr2-plus-aosp * commit '331c7788a84fc6f625ac1bafbb33cf7da1116407': Store info in the bookmarks/history database on whether it was a manually entered url.
This commit is contained in:
@@ -108,7 +108,7 @@ public class Browser {
|
|||||||
BookmarkColumns._ID, BookmarkColumns.URL, BookmarkColumns.VISITS,
|
BookmarkColumns._ID, BookmarkColumns.URL, BookmarkColumns.VISITS,
|
||||||
BookmarkColumns.DATE, BookmarkColumns.BOOKMARK, BookmarkColumns.TITLE,
|
BookmarkColumns.DATE, BookmarkColumns.BOOKMARK, BookmarkColumns.TITLE,
|
||||||
BookmarkColumns.FAVICON, BookmarkColumns.THUMBNAIL,
|
BookmarkColumns.FAVICON, BookmarkColumns.THUMBNAIL,
|
||||||
BookmarkColumns.TOUCH_ICON };
|
BookmarkColumns.TOUCH_ICON, BookmarkColumns.USER_ENTERED };
|
||||||
|
|
||||||
/* these indices dependent on HISTORY_PROJECTION */
|
/* these indices dependent on HISTORY_PROJECTION */
|
||||||
public static final int HISTORY_PROJECTION_ID_INDEX = 0;
|
public static final int HISTORY_PROJECTION_ID_INDEX = 0;
|
||||||
@@ -232,8 +232,8 @@ public class Browser {
|
|||||||
* Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
|
* Requires {@link android.Manifest.permission#WRITE_HISTORY_BOOKMARKS}
|
||||||
* @param cr The ContentResolver used to access the database.
|
* @param cr The ContentResolver used to access the database.
|
||||||
* @param url The site being visited.
|
* @param url The site being visited.
|
||||||
* @param real Whether this is an actual visit, and should be added to the
|
* @param real If true, this is an actual visit, and should add to the
|
||||||
* number of visits.
|
* number of visits. If false, the user entered it manually.
|
||||||
*/
|
*/
|
||||||
public static final void updateVisitedHistory(ContentResolver cr,
|
public static final void updateVisitedHistory(ContentResolver cr,
|
||||||
String url, boolean real) {
|
String url, boolean real) {
|
||||||
@@ -253,18 +253,30 @@ public class Browser {
|
|||||||
if (real) {
|
if (real) {
|
||||||
map.put(BookmarkColumns.VISITS, c
|
map.put(BookmarkColumns.VISITS, c
|
||||||
.getInt(HISTORY_PROJECTION_VISITS_INDEX) + 1);
|
.getInt(HISTORY_PROJECTION_VISITS_INDEX) + 1);
|
||||||
|
} else {
|
||||||
|
map.put(BookmarkColumns.USER_ENTERED, 1);
|
||||||
}
|
}
|
||||||
map.put(BookmarkColumns.DATE, now);
|
map.put(BookmarkColumns.DATE, now);
|
||||||
cr.update(BOOKMARKS_URI, map, "_id = " + c.getInt(0), null);
|
cr.update(BOOKMARKS_URI, map, "_id = " + c.getInt(0), null);
|
||||||
} else {
|
} else {
|
||||||
truncateHistory(cr);
|
truncateHistory(cr);
|
||||||
ContentValues map = new ContentValues();
|
ContentValues map = new ContentValues();
|
||||||
|
int visits;
|
||||||
|
int user_entered;
|
||||||
|
if (real) {
|
||||||
|
visits = 1;
|
||||||
|
user_entered = 0;
|
||||||
|
} else {
|
||||||
|
visits = 0;
|
||||||
|
user_entered = 1;
|
||||||
|
}
|
||||||
map.put(BookmarkColumns.URL, url);
|
map.put(BookmarkColumns.URL, url);
|
||||||
map.put(BookmarkColumns.VISITS, real ? 1 : 0);
|
map.put(BookmarkColumns.VISITS, visits);
|
||||||
map.put(BookmarkColumns.DATE, now);
|
map.put(BookmarkColumns.DATE, now);
|
||||||
map.put(BookmarkColumns.BOOKMARK, 0);
|
map.put(BookmarkColumns.BOOKMARK, 0);
|
||||||
map.put(BookmarkColumns.TITLE, url);
|
map.put(BookmarkColumns.TITLE, url);
|
||||||
map.put(BookmarkColumns.CREATED, 0);
|
map.put(BookmarkColumns.CREATED, 0);
|
||||||
|
map.put(BookmarkColumns.USER_ENTERED, user_entered);
|
||||||
cr.insert(BOOKMARKS_URI, map);
|
cr.insert(BOOKMARKS_URI, map);
|
||||||
}
|
}
|
||||||
c.deactivate();
|
c.deactivate();
|
||||||
@@ -572,6 +584,10 @@ public class Browser {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final String TOUCH_ICON = "touch_icon";
|
public static final String TOUCH_ICON = "touch_icon";
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String USER_ENTERED = "user_entered";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SearchColumns implements BaseColumns {
|
public static class SearchColumns implements BaseColumns {
|
||||||
|
|||||||
Reference in New Issue
Block a user