diff options
| author | Christopher Tate <ctate@android.com> | 2009-07-10 17:51:48 -0700 |
|---|---|---|
| committer | Christopher Tate <ctate@android.com> | 2009-07-27 16:35:27 -0700 |
| commit | 9c0dd8caacff99ba76bbb9dc2cab156cded505a8 (patch) | |
| tree | d3a4d257bf67f6529261df9a71e351ece9b89a6e /src/com/android/browser/Bookmarks.java | |
| parent | 09377c370181683273264d625784c7bc2415dedd (diff) | |
| download | packages_apps_Browser-9c0dd8caacff99ba76bbb9dc2cab156cded505a8.tar.gz packages_apps_Browser-9c0dd8caacff99ba76bbb9dc2cab156cded505a8.tar.bz2 packages_apps_Browser-9c0dd8caacff99ba76bbb9dc2cab156cded505a8.zip | |
First real cut of bookmarks backup agent
The agent now does backup/restore of the bookmarks table. Whether to back up is
determined by flattening the bookmark table, CRCing the flattened
representation, and comparing the CRC with the previous backup pass's version.
If they differ (or if the file size differs), the table is deemed to have
changed and we send the flattened file off to the server as a single key.
On restore, the bookmark records are read individually from the flattened
representation, the existing bookmarks table is queried for a matching URL, and
if none exists the bookmark is inserted into the table.
Bookmarks.addBookmark() now takes a boolean argument "retainIcon." When false,
the implementation will not call into the web icon database. This is necessary
during restore because the web icon database is only available from the Browser
app's main thread, but restore happens without the app proper being involved.
The other call points for addBookmark() have been updated to pass 'true,' i.e.
preserving the current behavior.
Diffstat (limited to 'src/com/android/browser/Bookmarks.java')
| -rw-r--r-- | src/com/android/browser/Bookmarks.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/browser/Bookmarks.java b/src/com/android/browser/Bookmarks.java index 97e6b2086..a3dc919ac 100644 --- a/src/com/android/browser/Bookmarks.java +++ b/src/com/android/browser/Bookmarks.java @@ -47,9 +47,13 @@ import java.util.Date; * @param cr The ContentResolver being used to add the bookmark to the db. * @param url URL of the website to be bookmarked. * @param name Provided name for the bookmark. + * @param retainIcon Whether to retain the page's icon in the icon database. + * This will usually be <code>true</code> except when bookmarks are + * added by a settings restore agent. */ /* package */ static void addBookmark(Context context, - ContentResolver cr, String url, String name) { + ContentResolver cr, String url, String name, + 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 @@ -137,7 +141,9 @@ import java.util.Date; cr.insert(Browser.BOOKMARKS_URI, map); } } - WebIconDatabase.getInstance().retainIconForPageUrl(url); + if (retainIcon) { + WebIconDatabase.getInstance().retainIconForPageUrl(url); + } cursor.deactivate(); if (context != null) { Toast.makeText(context, R.string.added_to_bookmarks, |
