| 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.StoreClient, | 9 bookmarks.StoreClient, |
| 10 ], | 10 ], |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 }, | 30 }, |
| 31 | 31 |
| 32 /** @private */ | 32 /** @private */ |
| 33 mouseFocus_: { | 33 mouseFocus_: { |
| 34 type: Boolean, | 34 type: Boolean, |
| 35 reflectToAttribute: true, | 35 reflectToAttribute: true, |
| 36 }, | 36 }, |
| 37 | 37 |
| 38 /** @private */ | 38 /** @private */ |
| 39 isFolder_: Boolean, | 39 isFolder_: Boolean, |
| 40 | |
| 41 /** @private */ | |
| 42 openItemUrl_: String, | |
| 43 }, | 40 }, |
| 44 | 41 |
| 45 observers: [ | 42 observers: [ |
| 46 'updateFavicon_(item_.url)', | 43 'updateFavicon_(item_.url)', |
| 47 ], | 44 ], |
| 48 | 45 |
| 49 listeners: { | 46 listeners: { |
| 50 'mousedown': 'onMousedown_', | 47 'mousedown': 'onMousedown_', |
| 51 'blur': 'onItemBlur_', | 48 'blur': 'onItemBlur_', |
| 52 'click': 'onClick_', | 49 'click': 'onClick_', |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 onItemIdChanged_: function() { | 117 onItemIdChanged_: function() { |
| 121 // TODO(tsergeant): Add a histogram to measure whether this assertion fails | 118 // TODO(tsergeant): Add a histogram to measure whether this assertion fails |
| 122 // for real users. | 119 // for real users. |
| 123 assert(this.getState().nodes[this.itemId]); | 120 assert(this.getState().nodes[this.itemId]); |
| 124 this.updateFromStore(); | 121 this.updateFromStore(); |
| 125 }, | 122 }, |
| 126 | 123 |
| 127 /** @private */ | 124 /** @private */ |
| 128 onItemChanged_: function() { | 125 onItemChanged_: function() { |
| 129 this.isFolder_ = !this.item_.url; | 126 this.isFolder_ = !this.item_.url; |
| 130 if (this.item_.url) | |
| 131 this.openItemUrl_ = this.item_.url; | |
| 132 else | |
| 133 this.openItemUrl_ = 'chrome://bookmarks/?id=' + this.itemId; | |
| 134 }, | 127 }, |
| 135 | 128 |
| 136 /** | 129 /** |
| 137 * @private | 130 * @private |
| 138 */ | 131 */ |
| 139 onMousedown_: function() { | 132 onMousedown_: function() { |
| 140 this.mouseFocus_ = true; | 133 this.mouseFocus_ = true; |
| 141 }, | 134 }, |
| 142 | 135 |
| 143 /** | 136 /** |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 }, | 170 }, |
| 178 | 171 |
| 179 /** | 172 /** |
| 180 * @param {string} url | 173 * @param {string} url |
| 181 * @private | 174 * @private |
| 182 */ | 175 */ |
| 183 updateFavicon_: function(url) { | 176 updateFavicon_: function(url) { |
| 184 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); | 177 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); |
| 185 }, | 178 }, |
| 186 }); | 179 }); |
| OLD | NEW |