Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2391)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java

Issue 695493005: Add local search API to Enhanced Bookmark Bridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8bcb147a356a0c9f14fd88b95d2716d381dffa89..199fec57637a390c1d95e1422ab6bf323341b6ba 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java
@@ -373,6 +373,19 @@ public class BookmarksBridge {
}
/**
+ * Get a list of bookmarks as the result of a search query for the local bookmark model. This
+ * method uses the same logic with omnibox to fetch related bookmarks and is thus synchronous.
Ted C 2014/10/31 20:53:07 Don't describe the logic behavior as you should be
Ian Wen 2014/10/31 21:28:23 Done.
+ * Please refer to BookmarkIndex#GetBookmarksMatching() in Chromium for implementation details.
+ * @param query Keyword used to find related bookmarks.
+ * @param maxNumberOfResult Maximum number of result to fetch in case the user searches for
Ted C 2014/10/31 20:53:06 I wouldn't add the stuff after fetch [in case the
Ian Wen 2014/10/31 21:28:23 Done.
+ * something really common.
+ * @return List of bookmarks that are related to the given query.
+ */
+ public List<BookmarkId> getLocalSearchResults(String query, int maxNumberOfResult) {
Ted C 2014/10/31 20:53:06 I think this should just be called getSearchResult
Ian Wen 2014/10/31 21:28:23 We have a server search counterpart in EnhancedBoo
Ian Wen 2014/10/31 22:06:28 Done.
+ return nativeSearchLocalResults(mNativeBookmarksBridge, query, maxNumberOfResult);
+ }
+
+ /**
* Set title of the given bookmark.
*/
public void setBookmarkTitle(BookmarkId id, String title) {
@@ -620,6 +633,11 @@ public class BookmarksBridge {
}
@CalledByNative
+ private static List<BookmarkId> createBookmarkIdList() {
Ted C 2014/10/31 20:53:07 all other places pass in a newed list, so either d
Ian Wen 2014/10/31 21:28:23 Yes you are right. It was initially wrote in a dif
+ return new ArrayList<BookmarkId>();
+ }
+
+ @CalledByNative
private static BookmarkItem createBookmarkItem(long id, int type, String title, String url,
boolean isFolder, long parentId, int parentIdType, boolean isEditable,
boolean isManaged) {
@@ -681,6 +699,8 @@ public class BookmarksBridge {
private native void nativeDeleteBookmark(long nativeBookmarksBridge, BookmarkId bookmarkId);
private native void nativeMoveBookmark(long nativeBookmarksBridge, BookmarkId bookmarkId,
BookmarkId newParentId, int index);
+ private native List<BookmarkId> nativeSearchLocalResults(long nativeBookmarksBridge,
+ String query, int maxNumber);
private native BookmarkId nativeAddBookmark(long nativeBookmarksBridge, BookmarkId parent,
int index, String title, String url);
private native void nativeUndo(long nativeBookmarksBridge);

Powered by Google App Engine
This is Rietveld 408576698