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

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

Issue 1641983002: Handle ADDBOOKMARK intent with enhanced bookmarks UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ian's comments Created 4 years, 11 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/enhancedbookmarks/EnhancedBookmarkUtils.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java
index 8dbc3c2a74c6b48b4dc334a653e123085f09caab..405a9fa094be719c4a903be5adf74be138e52ca9 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java
@@ -80,6 +80,23 @@ public class EnhancedBookmarkUtils {
}
/**
+ * Adds a bookmark with the given title and url to the last used parent folder. Provides
+ * no visual feedback that a bookmark has been added.
+ *
+ * @param title The title of the bookmark.
+ * @param url The URL of the new bookmark.
+ */
+ public static BookmarkId addBookmarkSilently(Context context,
+ EnhancedBookmarksModel bookmarkModel, String title, String url) {
+ BookmarkId parent = getLastUsedParent(context);
+ if (parent == null || !bookmarkModel.doesBookmarkExist(parent)) {
+ parent = bookmarkModel.getDefaultFolder();
+ }
+
+ return bookmarkModel.addBookmark(parent, bookmarkModel.getChildCount(parent), title, url);
+ }
+
+ /**
* Saves an offline copy for the specified tab that is bookmarked. A snackbar will be shown to
* notify the user.
* @param id The bookmark ID for the tab.

Powered by Google App Engine
This is Rietveld 408576698