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

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

Issue 2869273011: [MD Bookmarks] Convert bookmark list to iron-list. (Closed)
Patch Set: rebase Created 3 years, 7 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 behaviors: [ 8 behaviors: [
9 bookmarks.StoreClient, 9 bookmarks.StoreClient,
10 ], 10 ],
11 11
12 properties: { 12 properties: {
13 itemId: { 13 itemId: {
14 type: String, 14 type: String,
15 observer: 'onItemIdChanged_', 15 observer: 'onItemIdChanged_',
16 }, 16 },
17 17
18 ironListTabIndex: String,
19
18 /** @private {BookmarkNode} */ 20 /** @private {BookmarkNode} */
19 item_: { 21 item_: {
20 type: Object, 22 type: Object,
21 observer: 'onItemChanged_', 23 observer: 'onItemChanged_',
22 }, 24 },
23 25
24 /** @private */ 26 /** @private */
25 isSelectedItem_: { 27 isSelectedItem_: {
26 type: Boolean, 28 type: Boolean,
27 reflectToAttribute: true, 29 reflectToAttribute: true,
28 }, 30 },
29 31
30 /** @private */ 32 /** @private */
33 mouseFocus_: {
34 type: Boolean,
35 reflectToAttribute: true,
36 },
37
38 /** @private */
31 isFolder_: Boolean, 39 isFolder_: Boolean,
32 }, 40 },
33 41
34 observers: [ 42 observers: [
35 'updateFavicon_(item_.url)', 43 'updateFavicon_(item_.url)',
36 ], 44 ],
37 45
38 listeners: { 46 listeners: {
47 'mousedown': 'onMousedown_',
48 'blur': 'onBlur_',
39 'click': 'onClick_', 49 'click': 'onClick_',
40 'dblclick': 'onDblClick_', 50 'dblclick': 'onDblClick_',
41 'contextmenu': 'onContextMenu_', 51 'contextmenu': 'onContextMenu_',
42 }, 52 },
43 53
44 /** @override */ 54 /** @override */
45 attached: function() { 55 attached: function() {
46 this.watch('item_', function(store) { 56 this.watch('item_', function(store) {
47 return store.nodes[this.itemId]; 57 return store.nodes[this.itemId];
48 }.bind(this)); 58 }.bind(this));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 assert(this.getState().nodes[this.itemId]); 112 assert(this.getState().nodes[this.itemId]);
103 this.updateFromStore(); 113 this.updateFromStore();
104 }, 114 },
105 115
106 /** @private */ 116 /** @private */
107 onItemChanged_: function() { 117 onItemChanged_: function() {
108 this.isFolder_ = !this.item_.url; 118 this.isFolder_ = !this.item_.url;
109 }, 119 },
110 120
111 /** 121 /**
122 * @private
123 */
124 onMousedown_: function() {
125 this.mouseFocus_ = true;
tsergeant 2017/05/15 01:14:27 I think this is going to be buggy. For example, I
calamity 2017/05/16 02:54:15 Added the focus handler to the button as discussed
126 },
127
128 /**
129 * @private
130 */
131 onBlur_: function() {
132 this.mouseFocus_ = false;
133 },
134
135 /**
112 * @param {Event} e 136 * @param {Event} e
113 * @private 137 * @private
114 */ 138 */
115 onClick_: function(e) { 139 onClick_: function(e) {
116 this.dispatch(bookmarks.actions.selectItem( 140 this.dispatch(bookmarks.actions.selectItem(
117 this.itemId, e.ctrlKey, e.shiftKey, this.getState())); 141 this.itemId, e.ctrlKey, e.shiftKey, this.getState()));
118 e.stopPropagation(); 142 e.stopPropagation();
119 }, 143 },
120 144
121 /** 145 /**
(...skipping 10 matching lines...) Expand all
132 }, 156 },
133 157
134 /** 158 /**
135 * @param {string} url 159 * @param {string} url
136 * @private 160 * @private
137 */ 161 */
138 updateFavicon_: function(url) { 162 updateFavicon_: function(url) {
139 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); 163 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url);
140 }, 164 },
141 }); 165 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/item.html ('k') | chrome/browser/resources/md_bookmarks/list.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698