diff --git a/mobile/android/base/db/BrowserContract.java b/mobile/android/base/db/BrowserContract.java index e921573366a..3549288faa9 100644 --- a/mobile/android/base/db/BrowserContract.java +++ b/mobile/android/base/db/BrowserContract.java @@ -93,6 +93,13 @@ public class BrowserContract { public static final class Bookmarks implements CommonColumns, URLColumns, ImageColumns, SyncColumns { private Bookmarks() {} + public static final String MOBILE_FOLDER_GUID = "mobile"; + public static final String PLACES_FOLDER_GUID = "places"; + public static final String MENU_FOLDER_GUID = "menu"; + public static final String TAGS_FOLDER_GUID = "tags"; + public static final String TOOLBAR_FOLDER_GUID = "toolbar"; + public static final String UNFILED_FOLDER_GUID = "unfiled"; + public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "bookmarks"); public static final String CONTENT_TYPE = "vnd.android.cursor.dir/bookmark"; @@ -133,4 +140,4 @@ public class BrowserContract { public static final String VERSION = "version"; } -} +} \ No newline at end of file diff --git a/mobile/android/base/db/BrowserProvider.java b/mobile/android/base/db/BrowserProvider.java index f15817380b0..45baf23162a 100644 --- a/mobile/android/base/db/BrowserProvider.java +++ b/mobile/android/base/db/BrowserProvider.java @@ -341,9 +341,24 @@ public class BrowserProvider extends ContentProvider { ", " + Images.FAVICON + ", " + Images.THUMBNAIL + " FROM " + TABLE_HISTORY_JOIN_IMAGES); + createMobileBookmarksFolder(db); + // FIXME: Create default bookmarks here } + private void createMobileBookmarksFolder(SQLiteDatabase db) { + ContentValues values = new ContentValues(); + values.put(Bookmarks.GUID, Bookmarks.MOBILE_FOLDER_GUID); + values.put(Bookmarks.IS_FOLDER, 1); + values.put(Bookmarks.POSITION, 0); + + long now = System.currentTimeMillis(); + values.put(Bookmarks.DATE_CREATED, now); + values.put(Bookmarks.DATE_MODIFIED, now); + + db.insertOrThrow(TABLE_BOOKMARKS, Bookmarks.GUID, values); + } + @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.d(LOGTAG, "Upgrading browser.db: " + db.getPath() + " from " +