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

Unified Diff: chrome/browser/resources/md_bookmarks/item.js

Issue 2639453002: [MD Bookmarks] Add Select for Bookmarks. (Closed)
Patch Set: selection after deletion Created 3 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/browser/resources/md_bookmarks/item.js
diff --git a/chrome/browser/resources/md_bookmarks/item.js b/chrome/browser/resources/md_bookmarks/item.js
index 13e698245beb96e9f96eee2344a157b7aadb109e..5b660c715cdeef038104f5ae7a88ec85b0a0caac 100644
--- a/chrome/browser/resources/md_bookmarks/item.js
+++ b/chrome/browser/resources/md_bookmarks/item.js
@@ -13,20 +13,31 @@ Polymer({
},
isFolder_: Boolean,
+
+ isSelectedItem: {
+ type: Boolean,
+ reflectToAttribute: true,
+ },
},
observers: [
'updateFavicon_(item.url)',
],
+ listeners: {
+ 'click': 'onClick_',
+ 'dblclick': 'onDblClick_',
+ },
+
/**
* @param {Event} e
* @private
*/
- onMenuButtonOpenTap_: function(e) {
+ onMenuButtonOpenClick_: function(e) {
+ e.stopPropagation();
this.fire('open-item-menu', {
target: e.target,
- item: this.item
+ item: this.item,
});
},
@@ -35,7 +46,30 @@ Polymer({
this.isFolder_ = !(this.item.url);
},
- /** @private */
+ /**
+ * @param {Event} e
+ * @private
+ */
+ onClick_: function(e) {
+ this.fire('select-item', {
+ id: this.item.id,
+ shiftKey: e.shiftKey,
+ ctrlKey: e.ctrlKey,
+ });
+ },
+
+ /**
+ * @param {Event} e
+ * @private
+ */
+ onDblClick_: function(e) {
+ /* TODO(jiaxi): Add double click later. */
+ },
+
+ /**
+ * @param {Event} e
+ * @private
+ */
updateFavicon_: function(url) {
this.$.icon.style.backgroundImage = cr.icon.getFavicon(url);
},

Powered by Google App Engine
This is Rietveld 408576698