Only edit existing bookmark when bookmarking from the title bar.
Bug:3425178
Change-Id: I32341270440231a870dad5b007d218654760548b
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index ad4d836..745a0f4 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1522,7 +1522,7 @@
break;
case R.id.add_bookmark_menu_id:
- bookmarkCurrentPage(AddBookmarkPage.DEFAULT_FOLDER_ID);
+ bookmarkCurrentPage(AddBookmarkPage.DEFAULT_FOLDER_ID, false);
break;
case R.id.stop_reload_menu_id:
@@ -1854,9 +1854,13 @@
/**
* add the current page as a bookmark to the given folder id
* @param folderId use -1 for the default folder
+ * @param canBeAnEdit If true, check to see whether the site is already
+ * bookmarked, and if it is, edit that bookmark. If false, and
+ * the site is already bookmarked, do not attempt to edit the
+ * existing bookmark.
*/
@Override
- public void bookmarkCurrentPage(long folderId) {
+ public void bookmarkCurrentPage(long folderId, boolean canBeAnEdit) {
Intent i = new Intent(mActivity,
AddBookmarkPage.class);
WebView w = getCurrentTopWebView();
@@ -1877,6 +1881,9 @@
i.putExtra(BrowserContract.Bookmarks.FAVICON, w.getFavicon());
i.putExtra(BrowserContract.Bookmarks.PARENT,
folderId);
+ if (canBeAnEdit) {
+ i.putExtra(AddBookmarkPage.CHECK_FOR_DUPE, true);
+ }
// Put the dialog at the upper right of the screen, covering the
// star on the title bar.
i.putExtra("gravity", Gravity.RIGHT | Gravity.TOP);