| 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-app', | 6 is: 'history-app', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // The id of the currently selected page. | 9 // The id of the currently selected page. |
| 10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'}, | 10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'}, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 'cr-menu-tap': 'onMenuTap_', | 50 'cr-menu-tap': 'onMenuTap_', |
| 51 'history-checkbox-select': 'checkboxSelected', | 51 'history-checkbox-select': 'checkboxSelected', |
| 52 'unselect-all': 'unselectAll', | 52 'unselect-all': 'unselectAll', |
| 53 'delete-selected': 'deleteSelected', | 53 'delete-selected': 'deleteSelected', |
| 54 'search-domain': 'searchDomain_', | 54 'search-domain': 'searchDomain_', |
| 55 }, | 55 }, |
| 56 | 56 |
| 57 /** @override */ | 57 /** @override */ |
| 58 ready: function() { | 58 ready: function() { |
| 59 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); | 59 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); |
| 60 |
| 61 cr.ui.decorate('command', cr.ui.Command); |
| 62 document.addEventListener('canExecute', this.onCanExecute_.bind(this)); |
| 63 document.addEventListener('command', this.onCommand_.bind(this)); |
| 60 }, | 64 }, |
| 61 | 65 |
| 62 /** @private */ | 66 /** @private */ |
| 63 onMenuTap_: function() { this.$['side-bar'].toggle(); }, | 67 onMenuTap_: function() { this.$['side-bar'].toggle(); }, |
| 64 | 68 |
| 65 /** | 69 /** |
| 66 * Listens for history-item being selected or deselected (through checkbox) | 70 * Listens for history-item being selected or deselected (through checkbox) |
| 67 * and changes the view of the top toolbar. | 71 * and changes the view of the top toolbar. |
| 68 * @param {{detail: {countAddition: number}}} e | 72 * @param {{detail: {countAddition: number}}} e |
| 69 */ | 73 */ |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 listContainer.historyResult(info, results); | 117 listContainer.historyResult(info, results); |
| 114 }, | 118 }, |
| 115 | 119 |
| 116 /** | 120 /** |
| 117 * Fired when the user presses 'More from this site'. | 121 * Fired when the user presses 'More from this site'. |
| 118 * @param {{detail: {domain: string}}} e | 122 * @param {{detail: {domain: string}}} e |
| 119 */ | 123 */ |
| 120 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, | 124 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, |
| 121 | 125 |
| 122 /** | 126 /** |
| 127 * @param {Event} e |
| 128 * @private |
| 129 */ |
| 130 onCanExecute_: function(e) { |
| 131 e.canExecute = true; |
| 132 }, |
| 133 |
| 134 /** |
| 135 * @param {Event} e |
| 136 * @private |
| 137 */ |
| 138 onCommand_: function(e) { |
| 139 if (e.command.id == 'find-command') |
| 140 this.$.toolbar.showSearchField(); |
| 141 }, |
| 142 |
| 143 /** |
| 123 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 144 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
| 124 * the sessions from other devices. | 145 * the sessions from other devices. |
| 125 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 146 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
| 126 */ | 147 */ |
| 127 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 148 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
| 128 if (!isTabSyncEnabled) | 149 if (!isTabSyncEnabled) |
| 129 return; | 150 return; |
| 130 | 151 |
| 131 this.set('queryResult_.sessionList', sessionList); | 152 this.set('queryResult_.sessionList', sessionList); |
| 132 }, | 153 }, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 156 * @param {boolean} incremental | 177 * @param {boolean} incremental |
| 157 * @param {string} searchTerm | 178 * @param {string} searchTerm |
| 158 * @return {boolean} Whether a loading spinner should be shown (implies the | 179 * @return {boolean} Whether a loading spinner should be shown (implies the |
| 159 * backend is querying a new search term). | 180 * backend is querying a new search term). |
| 160 * @private | 181 * @private |
| 161 */ | 182 */ |
| 162 shouldShowSpinner_: function(querying, incremental, searchTerm) { | 183 shouldShowSpinner_: function(querying, incremental, searchTerm) { |
| 163 return querying && !incremental && searchTerm != ''; | 184 return querying && !incremental && searchTerm != ''; |
| 164 }, | 185 }, |
| 165 }); | 186 }); |
| OLD | NEW |