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

Unified Diff: chrome/browser/resources/md_history/history_list.js

Issue 2097003002: MD History: Remove bookmark when clicking bookmark star (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add event listener to remove all bookmark stars Created 4 years, 6 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/browser/resources/md_history/history_list.js
diff --git a/chrome/browser/resources/md_history/history_list.js b/chrome/browser/resources/md_history/history_list.js
index d0718e23b3160ab99de107e6eb7b55d65cebec98..8c5a9bd88874e50849eef095f832f92eb6be1104 100644
--- a/chrome/browser/resources/md_history/history_list.js
+++ b/chrome/browser/resources/md_history/history_list.js
@@ -29,6 +29,7 @@ Polymer({
'infinite-list.scroll': 'closeMenu_',
'tap': 'closeMenu_',
'toggle-menu': 'toggleMenu_',
+ 'remove-bookmark-stars': 'removeBookmarkStars_',
},
/**
@@ -51,6 +52,24 @@ Polymer({
target, e.detail.item);
},
+ /**
+ * Remove bookmark star of an url's all history items.
calamity 2016/06/29 07:36:05 nit: Remove bookmark star for history items with m
lshang 2016/07/01 01:15:16 Done.
+ * @param {{detail: !string}} e
+ * @private
+ */
+ removeBookmarkStars_: function(e) {
+ var url = e.detail;
+
+ if (this.historyData_ === undefined)
+ return;
+
+ for (var i = 0; i < this.historyData_.length; i++) {
+ if (this.historyData_[i].url == url) {
calamity 2016/06/29 07:36:05 nit: No braces needed for single line if.
lshang 2016/07/01 01:15:16 Done.
+ this.set('historyData_.' + i + '.starred', false);
+ }
+ }
+ },
+
/** @private */
onMoreFromSiteTap_: function() {
var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu);

Powered by Google App Engine
This is Rietveld 408576698