| 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 ], |
| 11 | 11 |
| 12 properties: { | 12 properties: { |
| 13 itemId: { | 13 itemId: { |
| 14 type: String, | 14 type: String, |
| 15 observer: 'updateFromStore', | 15 observer: 'onItemIdChanged_', |
| 16 }, | 16 }, |
| 17 | 17 |
| 18 /** @private {BookmarkNode} */ | 18 /** @private {BookmarkNode} */ |
| 19 item_: { | 19 item_: { |
| 20 type: Object, | 20 type: Object, |
| 21 observer: 'onItemChanged_', | 21 observer: 'onItemChanged_', |
| 22 }, | 22 }, |
| 23 | 23 |
| 24 /** @private */ | 24 /** @private */ |
| 25 isSelectedItem_: { | 25 isSelectedItem_: { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 54 */ | 54 */ |
| 55 onMenuButtonOpenClick_: function(e) { | 55 onMenuButtonOpenClick_: function(e) { |
| 56 e.stopPropagation(); | 56 e.stopPropagation(); |
| 57 this.fire('open-item-menu', { | 57 this.fire('open-item-menu', { |
| 58 target: e.target, | 58 target: e.target, |
| 59 item: this.item_, | 59 item: this.item_, |
| 60 }); | 60 }); |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 /** @private */ | 63 /** @private */ |
| 64 onItemIdChanged_: function() { |
| 65 // TODO(tsergeant): Add a histogram to measure whether this assertion fails |
| 66 // for real users. |
| 67 assert(this.getState().nodes[this.itemId]); |
| 68 this.updateFromStore(); |
| 69 }, |
| 70 |
| 71 /** @private */ |
| 64 onItemChanged_: function() { | 72 onItemChanged_: function() { |
| 65 this.isFolder_ = !(this.item_.url); | 73 this.isFolder_ = !(this.item_.url); |
| 66 }, | 74 }, |
| 67 | 75 |
| 68 /** | 76 /** |
| 69 * @param {Event} e | 77 * @param {Event} e |
| 70 * @private | 78 * @private |
| 71 */ | 79 */ |
| 72 onClick_: function(e) { | 80 onClick_: function(e) { |
| 73 this.fire('select-item', { | 81 this.fire('select-item', { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 89 }, | 97 }, |
| 90 | 98 |
| 91 /** | 99 /** |
| 92 * @param {string} url | 100 * @param {string} url |
| 93 * @private | 101 * @private |
| 94 */ | 102 */ |
| 95 updateFavicon_: function(url) { | 103 updateFavicon_: function(url) { |
| 96 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); | 104 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); |
| 97 }, | 105 }, |
| 98 }); | 106 }); |
| OLD | NEW |