| OLD | NEW |
| 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.MouseFocusBehavior, | 9 bookmarks.MouseFocusBehavior, |
| 10 bookmarks.StoreClient, | 10 bookmarks.StoreClient, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 /** @private */ | 27 /** @private */ |
| 28 isSelectedItem_: { | 28 isSelectedItem_: { |
| 29 type: Boolean, | 29 type: Boolean, |
| 30 reflectToAttribute: true, | 30 reflectToAttribute: true, |
| 31 }, | 31 }, |
| 32 | 32 |
| 33 /** @private */ | 33 /** @private */ |
| 34 isFolder_: Boolean, | 34 isFolder_: Boolean, |
| 35 }, | 35 }, |
| 36 | 36 |
| 37 hostAttributes: { |
| 38 'role': 'listitem', |
| 39 }, |
| 40 |
| 37 observers: [ | 41 observers: [ |
| 38 'updateFavicon_(item_.url)', | 42 'updateFavicon_(item_.url)', |
| 39 ], | 43 ], |
| 40 | 44 |
| 41 listeners: { | 45 listeners: { |
| 42 'click': 'onClick_', | 46 'click': 'onClick_', |
| 43 'dblclick': 'onDblClick_', | 47 'dblclick': 'onDblClick_', |
| 44 'contextmenu': 'onContextMenu_', | 48 'contextmenu': 'onContextMenu_', |
| 45 }, | 49 }, |
| 46 | 50 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 onItemIdChanged_: function() { | 114 onItemIdChanged_: function() { |
| 111 // TODO(tsergeant): Add a histogram to measure whether this assertion fails | 115 // TODO(tsergeant): Add a histogram to measure whether this assertion fails |
| 112 // for real users. | 116 // for real users. |
| 113 assert(this.getState().nodes[this.itemId]); | 117 assert(this.getState().nodes[this.itemId]); |
| 114 this.updateFromStore(); | 118 this.updateFromStore(); |
| 115 }, | 119 }, |
| 116 | 120 |
| 117 /** @private */ | 121 /** @private */ |
| 118 onItemChanged_: function() { | 122 onItemChanged_: function() { |
| 119 this.isFolder_ = !this.item_.url; | 123 this.isFolder_ = !this.item_.url; |
| 124 this.setAttribute('aria-label', this.item_.title); |
| 120 }, | 125 }, |
| 121 | 126 |
| 122 /** | 127 /** |
| 123 * @param {MouseEvent} e | 128 * @param {MouseEvent} e |
| 124 * @private | 129 * @private |
| 125 */ | 130 */ |
| 126 onClick_: function(e) { | 131 onClick_: function(e) { |
| 127 // Ignore double clicks so that Ctrl double-clicking an item won't deselect | 132 // Ignore double clicks so that Ctrl double-clicking an item won't deselect |
| 128 // the item before opening. | 133 // the item before opening. |
| 129 if (e.detail != 2) { | 134 if (e.detail != 2) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 149 }, | 154 }, |
| 150 | 155 |
| 151 /** | 156 /** |
| 152 * @param {string} url | 157 * @param {string} url |
| 153 * @private | 158 * @private |
| 154 */ | 159 */ |
| 155 updateFavicon_: function(url) { | 160 updateFavicon_: function(url) { |
| 156 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); | 161 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); |
| 157 }, | 162 }, |
| 158 }); | 163 }); |
| OLD | NEW |