| 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: 'history-list-container', | 6 is: 'history-list-container', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // The path of the currently selected page. | 9 // The path of the currently selected page. |
| 10 selectedPage_: String, | 10 selectedPage_: String, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 * a dialog to confirm that the deletion should be performed. | 116 * a dialog to confirm that the deletion should be performed. |
| 117 */ | 117 */ |
| 118 deleteSelectedWithPrompt: function() { | 118 deleteSelectedWithPrompt: function() { |
| 119 if (!loadTimeData.getBoolean('allowDeletingHistory')) | 119 if (!loadTimeData.getBoolean('allowDeletingHistory')) |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 var browserService = md_history.BrowserService.getInstance(); | 122 var browserService = md_history.BrowserService.getInstance(); |
| 123 browserService.recordAction('RemoveSelected'); | 123 browserService.recordAction('RemoveSelected'); |
| 124 if (this.queryState.searchTerm != '') | 124 if (this.queryState.searchTerm != '') |
| 125 browserService.recordAction('SearchResultRemove'); | 125 browserService.recordAction('SearchResultRemove'); |
| 126 this.$.dialog.get().then(function(dialog) { | 126 this.$.dialog.get().showModal(); |
| 127 dialog.showModal(); | |
| 128 }); | |
| 129 }, | 127 }, |
| 130 | 128 |
| 131 /** | 129 /** |
| 132 * @param {HistoryRange} range | 130 * @param {HistoryRange} range |
| 133 * @private | 131 * @private |
| 134 */ | 132 */ |
| 135 groupedRangeChanged_: function(range, oldRange) { | 133 groupedRangeChanged_: function(range, oldRange) { |
| 136 this.selectedPage_ = range == HistoryRange.ALL_TIME ? | 134 this.selectedPage_ = range == HistoryRange.ALL_TIME ? |
| 137 'infinite-list' : 'grouped-list'; | 135 'infinite-list' : 'grouped-list'; |
| 138 | 136 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 closeMenu_: function() { | 193 closeMenu_: function() { |
| 196 var menu = this.$.sharedMenu.getIfExists(); | 194 var menu = this.$.sharedMenu.getIfExists(); |
| 197 if (menu) | 195 if (menu) |
| 198 menu.closeMenu(); | 196 menu.closeMenu(); |
| 199 }, | 197 }, |
| 200 | 198 |
| 201 /** | 199 /** |
| 202 * Opens the overflow menu unless the menu is already open and the same button | 200 * Opens the overflow menu unless the menu is already open and the same button |
| 203 * is pressed. | 201 * is pressed. |
| 204 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e | 202 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e |
| 205 * @return {Promise<Element>} | |
| 206 * @private | 203 * @private |
| 207 */ | 204 */ |
| 208 toggleMenu_: function(e) { | 205 toggleMenu_: function(e) { |
| 209 var target = e.detail.target; | 206 var target = e.detail.target; |
| 210 return this.$.sharedMenu.get().then(function(menu) { | 207 var menu = /** @type {CrSharedMenuElement} */this.$.sharedMenu.get(); |
| 211 /** @type {CrSharedMenuElement} */(menu).toggleMenu( | 208 menu.toggleMenu(target, e.detail); |
| 212 target, e.detail); | |
| 213 }); | |
| 214 }, | 209 }, |
| 215 | 210 |
| 216 /** @private */ | 211 /** @private */ |
| 217 onMoreFromSiteTap_: function() { | 212 onMoreFromSiteTap_: function() { |
| 218 md_history.BrowserService.getInstance().recordAction( | 213 md_history.BrowserService.getInstance().recordAction( |
| 219 'EntryMenuShowMoreFromSite'); | 214 'EntryMenuShowMoreFromSite'); |
| 220 | 215 |
| 221 var menu = assert(this.$.sharedMenu.getIfExists()); | 216 var menu = assert(this.$.sharedMenu.getIfExists()); |
| 222 this.fire('search-domain', {domain: menu.itemData.item.domain}); | 217 this.fire('search-domain', {domain: menu.itemData.item.domain}); |
| 223 menu.closeMenu(); | 218 menu.closeMenu(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 253 }.bind(this)); | 248 }.bind(this)); |
| 254 menu.closeMenu(); | 249 menu.closeMenu(); |
| 255 }, | 250 }, |
| 256 | 251 |
| 257 /** | 252 /** |
| 258 * @return {HTMLElement} | 253 * @return {HTMLElement} |
| 259 * @private | 254 * @private |
| 260 */ | 255 */ |
| 261 getSelectedList_: function() { return this.$.content.selectedItem; }, | 256 getSelectedList_: function() { return this.$.content.selectedItem; }, |
| 262 }); | 257 }); |
| OLD | NEW |