summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/provider/BrowserProvider2.java
diff options
context:
space:
mode:
authorJeff Hamilton <jham@android.com>2010-08-17 13:44:42 -0500
committerJeff Hamilton <jham@android.com>2010-08-17 14:04:36 -0500
commitb0de9ba4fe3acdcd0766eb07175044c12a54bd82 (patch)
treeda2ad41310acc75e650f351f53a36dce40ea55a9 /src/com/android/browser/provider/BrowserProvider2.java
parent69bd7077becb42438513fa80c98d0b48c8a23a41 (diff)
downloadpackages_apps_Browser-b0de9ba4fe3acdcd0766eb07175044c12a54bd82.zip
packages_apps_Browser-b0de9ba4fe3acdcd0766eb07175044c12a54bd82.tar.gz
packages_apps_Browser-b0de9ba4fe3acdcd0766eb07175044c12a54bd82.tar.bz2
Store the server unique values for the default folders.
Change-Id: I62173b733bb189b3d7af6aa64f986c7a98249ccf
Diffstat (limited to 'src/com/android/browser/provider/BrowserProvider2.java')
-rw-r--r--src/com/android/browser/provider/BrowserProvider2.java36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index a9f9aca..0aae911 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -32,6 +32,7 @@ import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.provider.BrowserContract;
import android.provider.BrowserContract.Bookmarks;
+import android.provider.BrowserContract.ChromeSyncColumns;
import android.provider.BrowserContract.History;
import android.provider.BrowserContract.Searches;
import android.provider.BrowserContract.SyncState;
@@ -67,9 +68,10 @@ public class BrowserProvider2 extends SQLiteContentProvider {
static final int SYNCSTATE = 4000;
static final int SYNCSTATE_ID = 4001;
- static final long FIXED_ID_BOOKMARKS = 1;
- static final long FIXED_ID_BOOKMARKS_BAR = 2;
- static final long FIXED_ID_OTHER_BOOKMARKS = 3;
+ static final long FIXED_ID_CHROME_ROOT = 1;
+ static final long FIXED_ID_BOOKMARKS = 2;
+ static final long FIXED_ID_BOOKMARKS_BAR = 3;
+ static final long FIXED_ID_OTHER_BOOKMARKS = 4;
static final String DEFAULT_BOOKMARKS_SORT_ORDER = "position ASC, _id ASC";
@@ -147,7 +149,7 @@ public class BrowserProvider2 extends SQLiteContentProvider {
final class DatabaseHelper extends SQLiteOpenHelper {
static final String DATABASE_NAME = "browser2.db";
- static final int DATABASE_VERSION = 10;
+ static final int DATABASE_VERSION = 11;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@@ -216,22 +218,34 @@ public class BrowserProvider2 extends SQLiteContentProvider {
private void createDefaultBookmarks(SQLiteDatabase db) {
ContentValues values = new ContentValues();
// TODO figure out how to deal with localization for the defaults
- // TODO fill in the server unique tags for the sync adapter
+
+ // Chrome sync root folder
+ values.put(Bookmarks._ID, FIXED_ID_CHROME_ROOT);
+ values.put(ChromeSyncColumns.SERVER_UNIQUE, ChromeSyncColumns.FOLDER_NAME_ROOT);
+ values.put(Bookmarks.TITLE, "Google Chrome");
+ values.put(Bookmarks.PARENT, 0);
+ values.put(Bookmarks.POSITION, 0);
+ values.put(Bookmarks.IS_FOLDER, true);
+ values.put(Bookmarks.DIRTY, true);
+ db.insertOrThrow(TABLE_BOOKMARKS, null, values);
// Bookmarks folder
values.put(Bookmarks._ID, FIXED_ID_BOOKMARKS);
+ values.put(ChromeSyncColumns.SERVER_UNIQUE, ChromeSyncColumns.FOLDER_NAME_BOOKMARKS);
values.put(Bookmarks.TITLE, "Bookmarks");
- values.put(Bookmarks.PARENT, 0);
+ values.put(Bookmarks.PARENT, FIXED_ID_CHROME_ROOT);
values.put(Bookmarks.POSITION, 0);
values.put(Bookmarks.IS_FOLDER, true);
values.put(Bookmarks.DIRTY, true);
- long bookmarksId = db.insertOrThrow(TABLE_BOOKMARKS, null, values);
+ db.insertOrThrow(TABLE_BOOKMARKS, null, values);
// Bookmarks Bar folder
values.clear();
values.put(Bookmarks._ID, FIXED_ID_BOOKMARKS_BAR);
+ values.put(ChromeSyncColumns.SERVER_UNIQUE,
+ ChromeSyncColumns.FOLDER_NAME_BOOKMARKS_BAR);
values.put(Bookmarks.TITLE, "Bookmarks Bar");
- values.put(Bookmarks.PARENT, bookmarksId);
+ values.put(Bookmarks.PARENT, FIXED_ID_BOOKMARKS);
values.put(Bookmarks.POSITION, 0);
values.put(Bookmarks.IS_FOLDER, true);
values.put(Bookmarks.DIRTY, true);
@@ -240,13 +254,15 @@ public class BrowserProvider2 extends SQLiteContentProvider {
// Other Bookmarks folder
values.clear();
values.put(Bookmarks._ID, FIXED_ID_OTHER_BOOKMARKS);
+ values.put(ChromeSyncColumns.SERVER_UNIQUE,
+ ChromeSyncColumns.FOLDER_NAME_OTHER_BOOKMARKS);
values.put(Bookmarks.TITLE, "Other Bookmarks");
- values.put(Bookmarks.PARENT, bookmarksId);
+ values.put(Bookmarks.PARENT, FIXED_ID_BOOKMARKS);
values.put(Bookmarks.POSITION, 1000);
values.put(Bookmarks.IS_FOLDER, true);
values.put(Bookmarks.DIRTY, true);
db.insertOrThrow(TABLE_BOOKMARKS, null, values);
-
+
addDefaultBookmarks(db, FIXED_ID_BOOKMARKS_BAR);
// TODO remove this testing code