OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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: 'history-list', | 6 is: 'history-list', |
7 | 7 |
8 properties: { | 8 properties: { |
9 // The search term for the current query. Set when the query returns. | 9 // The search term for the current query. Set when the query returns. |
10 searchedTerm: { | 10 searchedTerm: { |
(...skipping 11 matching lines...) Expand all Loading... |
22 resultLoadingDisabled_: { | 22 resultLoadingDisabled_: { |
23 type: Boolean, | 23 type: Boolean, |
24 value: false, | 24 value: false, |
25 }, | 25 }, |
26 }, | 26 }, |
27 | 27 |
28 listeners: { | 28 listeners: { |
29 'infinite-list.scroll': 'closeMenu_', | 29 'infinite-list.scroll': 'closeMenu_', |
30 'tap': 'closeMenu_', | 30 'tap': 'closeMenu_', |
31 'toggle-menu': 'toggleMenu_', | 31 'toggle-menu': 'toggleMenu_', |
| 32 'remove-bookmark-stars': 'removeBookmarkStars_', |
32 }, | 33 }, |
33 | 34 |
34 /** | 35 /** |
35 * Closes the overflow menu. | 36 * Closes the overflow menu. |
36 * @private | 37 * @private |
37 */ | 38 */ |
38 closeMenu_: function() { | 39 closeMenu_: function() { |
39 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).closeMenu(); | 40 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).closeMenu(); |
40 }, | 41 }, |
41 | 42 |
42 /** | 43 /** |
43 * Opens the overflow menu unless the menu is already open and the same button | 44 * Opens the overflow menu unless the menu is already open and the same button |
44 * is pressed. | 45 * is pressed. |
45 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e | 46 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e |
46 * @private | 47 * @private |
47 */ | 48 */ |
48 toggleMenu_: function(e) { | 49 toggleMenu_: function(e) { |
49 var target = e.detail.target; | 50 var target = e.detail.target; |
50 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).toggleMenu( | 51 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).toggleMenu( |
51 target, e.detail.item); | 52 target, e.detail.item); |
52 }, | 53 }, |
53 | 54 |
| 55 /** |
| 56 * Remove bookmark star for history items with matching URLs. |
| 57 * @param {{detail: !string}} e |
| 58 * @private |
| 59 */ |
| 60 removeBookmarkStars_: function(e) { |
| 61 var url = e.detail; |
| 62 |
| 63 if (this.historyData_ === undefined) |
| 64 return; |
| 65 |
| 66 for (var i = 0; i < this.historyData_.length; i++) { |
| 67 if (this.historyData_[i].url == url) |
| 68 this.set('historyData_.' + i + '.starred', false); |
| 69 } |
| 70 }, |
| 71 |
54 /** @private */ | 72 /** @private */ |
55 onMoreFromSiteTap_: function() { | 73 onMoreFromSiteTap_: function() { |
56 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); | 74 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); |
57 this.fire('search-domain', {domain: menu.itemData.domain}); | 75 this.fire('search-domain', {domain: menu.itemData.domain}); |
58 menu.closeMenu(); | 76 menu.closeMenu(); |
59 }, | 77 }, |
60 | 78 |
61 /** @private */ | 79 /** @private */ |
62 onRemoveFromHistoryTap_: function() { | 80 onRemoveFromHistoryTap_: function() { |
63 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); | 81 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 265 |
248 /** | 266 /** |
249 * @param {number} index | 267 * @param {number} index |
250 * @return {boolean} | 268 * @return {boolean} |
251 * @private | 269 * @private |
252 */ | 270 */ |
253 isFirstItem_: function(index) { | 271 isFirstItem_: function(index) { |
254 return index == 0; | 272 return index == 0; |
255 } | 273 } |
256 }); | 274 }); |
OLD | NEW |