Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java |
| index 110c3e521b350a4a675e847cb959b944e07b02c0..0663bbf6d8aba6f6d7133ff7839b0c7bcb9be03e 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java |
| @@ -162,6 +162,13 @@ public class BookmarksBridge { |
| } |
| /** |
| + * Load |
|
Ted C
2014/09/16 02:03:51
missing description
Ian Wen
2014/09/16 20:31:34
Done.
|
| + */ |
| + public void loadEmptyPartnerBookmarkShimForTesting() { |
|
Ted C
2014/09/16 02:03:52
Add @VisibleForTesting
Ian Wen
2014/09/16 20:31:33
Done.
|
| + nativeLoadEmptyPartnerBookmarkShimForTesting(mNativeBookmarksBridge); |
| + } |
| + |
| + /** |
| * Add an observer to bookmark model changes. |
| * @param observer The observer to be added. |
| */ |
| @@ -263,6 +270,22 @@ public class BookmarksBridge { |
| } |
| /** |
| + * @return The BookmarkId for Mobile folder node |
|
Ted C
2014/09/16 02:03:51
invalid javadoc ... same for below
Ian Wen
2014/09/16 20:31:33
Done.
|
| + */ |
| + BookmarkId getOtherFolderId() { |
|
Ted C
2014/09/16 02:03:51
Add @VisibleForTesting to both of these as well.
Ian Wen
2014/09/16 20:31:33
Done.
|
| + assert mIsNativeBookmarkModelLoaded; |
| + return nativeGetOtherFolderId(mNativeBookmarksBridge); |
| + } |
| + |
| + /** |
| + * @return The BookmarkId for Mobile folder node |
| + */ |
| + BookmarkId getDesktopFolderId() { |
| + assert mIsNativeBookmarkModelLoaded; |
| + return nativeGetDesktopFolderId(mNativeBookmarksBridge); |
| + } |
| + |
| + /** |
| * Reads sub-folder IDs, sub-bookmark IDs, or both of the given folder. |
| * |
| * @param getFolders Whether sub-folders should be returned. |
| @@ -382,6 +405,31 @@ public class BookmarksBridge { |
| } |
| /** |
| + * Add a new folder to the given parent folder |
| + * |
| + * @param parent The folder to add this new folder |
| + * @param index The position to locate the new folder |
| + * @param title The title text of the new folder |
| + * @return Id of the added node. If adding failed (index is invalid, string is null, parent is |
| + * not editable), returns null. |
| + */ |
| + public BookmarkId addFolder(BookmarkId parent, int index, String title) { |
|
Ted C
2014/09/16 02:03:52
How are you going to find out the index to add nod
Ian Wen
2014/09/16 20:31:33
Currently every folder/ bookmark is inserted at th
|
| + return nativeAddFolder(mNativeBookmarksBridge, parent, index, title); |
| + } |
| + |
| + /** |
| + * Add a new bookmark to a specific position below parent |
| + * @param parent Folder where to add |
| + * @param index Position the bookmark will be placed in parent folder |
|
Ted C
2014/09/16 02:03:51
The position where the bookmark will be placed in
Ian Wen
2014/09/16 20:31:33
Done.
|
| + * @param title Title string of the new bookmark |
|
Ted C
2014/09/16 02:03:52
string is unnecessary here and below
Ian Wen
2014/09/16 20:31:33
Done.
|
| + * @param url Url string of the new bookmark |
| + * @return Id of the added node. If adding failed, returns null. |
| + */ |
| + public BookmarkId addBookmark(BookmarkId parent, int index, String title, String url) { |
| + return nativeAddBookmark(mNativeBookmarksBridge, parent, index, title, url); |
| + } |
| + |
| + /** |
| * A bridge function to BookmarkModelFactory::GetForProfile. |
| */ |
| public static long getNativeBookmarkModel(Profile profile) { |
| @@ -525,6 +573,8 @@ public class BookmarksBridge { |
| private native void nativeGetAllFoldersWithDepths(long nativeBookmarksBridge, |
| List<BookmarkId> folderList, List<Integer> depthList); |
| private native BookmarkId nativeGetMobileFolderId(long nativeBookmarksBridge); |
| + private native BookmarkId nativeGetOtherFolderId(long nativeBookmarksBridge); |
| + private native BookmarkId nativeGetDesktopFolderId(long nativeBookmarksBridge); |
| private native void nativeGetChildIDs(long nativeBookmarksBridge, long id, int type, |
| boolean getFolders, boolean getBookmarks, List<BookmarkId> bookmarksList); |
| private native void nativeGetAllBookmarkIDsOrderedByCreationDate(long nativeBookmarksBridge, |
| @@ -540,11 +590,16 @@ public class BookmarksBridge { |
| private native void nativeGetCurrentFolderHierarchy(long nativeBookmarksBridge, |
| BookmarkId folderId, BookmarksCallback callback, |
| List<BookmarkItem> bookmarksList); |
| + private native BookmarkId nativeAddFolder(long nativeBookmarksBridge, BookmarkId parent, |
| + int index, String title); |
| private native void nativeDeleteBookmark(long nativeBookmarksBridge, BookmarkId bookmarkId); |
| private native void nativeMoveBookmark(long nativeBookmarksBridge, BookmarkId bookmarkId, |
| BookmarkId newParentId, int index); |
| + private native BookmarkId nativeAddBookmark(long nativeBookmarksBridge, BookmarkId parent, |
| + int index, String title, String url); |
| private static native long nativeGetNativeBookmarkModel(Profile profile); |
| private static native boolean nativeIsEnhancedBookmarksFeatureEnabled(Profile profile); |
| + private native void nativeLoadEmptyPartnerBookmarkShimForTesting(long nativeBookmarksBridge); |
| private native long nativeInit(Profile profile); |
| private native boolean nativeIsDoingExtensiveChanges(long nativeBookmarksBridge); |
| private native void nativeDestroy(long nativeBookmarksBridge); |