| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 onItemIdChanged_: function() { | 115 onItemIdChanged_: function() { |
| 112 // TODO(tsergeant): Add a histogram to measure whether this assertion fails | 116 // TODO(tsergeant): Add a histogram to measure whether this assertion fails |
| 113 // for real users. | 117 // for real users. |
| 114 assert(this.getState().nodes[this.itemId]); | 118 assert(this.getState().nodes[this.itemId]); |
| 115 this.updateFromStore(); | 119 this.updateFromStore(); |
| 116 }, | 120 }, |
| 117 | 121 |
| 118 /** @private */ | 122 /** @private */ |
| 119 onItemChanged_: function() { | 123 onItemChanged_: function() { |
| 120 this.isFolder_ = !this.item_.url; | 124 this.isFolder_ = !this.item_.url; |
| 125 this.setAttribute('aria-label', this.item_.title); |
| 121 }, | 126 }, |
| 122 | 127 |
| 123 /** | 128 /** |
| 124 * @param {MouseEvent} e | 129 * @param {MouseEvent} e |
| 125 * @private | 130 * @private |
| 126 */ | 131 */ |
| 127 onClick_: function(e) { | 132 onClick_: function(e) { |
| 128 // Ignore double clicks so that Ctrl double-clicking an item won't deselect | 133 // Ignore double clicks so that Ctrl double-clicking an item won't deselect |
| 129 // the item before opening. | 134 // the item before opening. |
| 130 if (e.detail != 2) { | 135 if (e.detail != 2) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 150 }, | 155 }, |
| 151 | 156 |
| 152 /** | 157 /** |
| 153 * @param {string} url | 158 * @param {string} url |
| 154 * @private | 159 * @private |
| 155 */ | 160 */ |
| 156 updateFavicon_: function(url) { | 161 updateFavicon_: function(url) { |
| 157 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); | 162 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); |
| 158 }, | 163 }, |
| 159 }); | 164 }); |
| OLD | NEW |