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

Side by Side Diff: chrome/browser/resources/md_bookmarks/item.js

Issue 2639453002: [MD Bookmarks] Add Select for Bookmarks. (Closed)
Patch Set: clean up Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'bookmarks-item', 6 is: 'bookmarks-item',
7 7
8 properties: { 8 properties: {
9 /** @type {BookmarkTreeNode} */ 9 /** @type {BookmarkTreeNode} */
10 item: { 10 item: {
11 type: Object, 11 type: Object,
12 observer: 'onItemChanged_', 12 observer: 'onItemChanged_',
13 }, 13 },
14 14
15 isFolder_: Boolean, 15 isFolder_: Boolean,
16
17 isSelectedItem: {
18 type: Boolean,
19 reflectToAttribute: true,
20 },
16 }, 21 },
17 22
18 observers: [ 23 observers: [
19 'updateFavicon_(item.url)', 24 'updateFavicon_(item.url)',
20 ], 25 ],
21 26
27 listeners: {
28 'click': 'onClick_',
29 'dblclick': 'onDblClick_',
30 },
31
22 /** 32 /**
23 * @param {Event} e 33 * @param {Event} e
24 * @private 34 * @private
25 */ 35 */
26 onMenuButtonOpenTap_: function(e) { 36 onMenuButtonOpenClick_: function(e) {
37 e.stopPropagation();
27 this.fire('open-item-menu', { 38 this.fire('open-item-menu', {
28 target: e.target, 39 target: e.target,
29 item: this.item, 40 item: this.item,
30 }); 41 });
31 }, 42 },
32 43
33 /** @private */ 44 /** @private */
34 onItemChanged_: function() { 45 onItemChanged_: function() {
35 this.isFolder_ = !(this.item.url); 46 this.isFolder_ = !(this.item.url);
36 }, 47 },
37 48
38 /** @private */ 49 /**
50 * @param {Event} e
51 * @private
52 */
53 onClick_: function(e) {
54 if (e.shiftKey) {
55 this.fire('select-item', {
56 item: this.item,
57 range: true,
58 });
59 } else {
60 this.fire('select-item', {
61 item: this.item,
62 add: e.ctrlKey,
63 });
64 }
calamity 2017/01/31 05:05:15 Can this just be range: e.shiftKey, add: e.ctrlKey
jiaxi 2017/02/01 03:19:25 Done.
65 },
66
67 /**
68 * @param {Event} e
69 * @private
70 */
71 onDblClick_: function(e) {
72 /* TODO(jiaxi): Add double click later. */
73 },
74
75 /**
76 * @param {string} url
77 * @private
78 */
39 updateFavicon_: function(url) { 79 updateFavicon_: function(url) {
40 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); 80 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url);
41 }, 81 },
42 }); 82 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698