| 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 showSidebarFooter: Boolean, | 9 showSidebarFooter: Boolean, |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 // Route data for the current page. | 50 // Route data for the current page. |
| 51 routeData_: Object, | 51 routeData_: Object, |
| 52 | 52 |
| 53 // The query params for the page. | 53 // The query params for the page. |
| 54 queryParams_: Object, | 54 queryParams_: Object, |
| 55 | 55 |
| 56 // True if the window is narrow enough for the page to have a drawer. | 56 // True if the window is narrow enough for the page to have a drawer. |
| 57 hasDrawer_: Boolean, | 57 hasDrawer: Boolean, |
| 58 }, | 58 }, |
| 59 | 59 |
| 60 observers: [ | 60 observers: [ |
| 61 // routeData_.page <=> selectedPage | 61 // routeData_.page <=> selectedPage |
| 62 'routeDataChanged_(routeData_.page)', | 62 'routeDataChanged_(routeData_.page)', |
| 63 'selectedPageChanged_(selectedPage_)', | 63 'selectedPageChanged_(selectedPage_)', |
| 64 | 64 |
| 65 // queryParams_.q <=> queryState.searchTerm | 65 // queryParams_.q <=> queryState.searchTerm |
| 66 'searchTermChanged_(queryState_.searchTerm)', | 66 'searchTermChanged_(queryState_.searchTerm)', |
| 67 'searchQueryParamChanged_(queryParams_.q)', | 67 'searchQueryParamChanged_(queryParams_.q)', |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 historyResult: function(info, results) { | 136 historyResult: function(info, results) { |
| 137 this.set('queryState_.querying', false); | 137 this.set('queryState_.querying', false); |
| 138 this.set('queryResult_.info', info); | 138 this.set('queryResult_.info', info); |
| 139 this.set('queryResult_.results', results); | 139 this.set('queryResult_.results', results); |
| 140 var listContainer = | 140 var listContainer = |
| 141 /** @type {HistoryListContainerElement} */ (this.$['history']); | 141 /** @type {HistoryListContainerElement} */ (this.$['history']); |
| 142 listContainer.historyResult(info, results); | 142 listContainer.historyResult(info, results); |
| 143 }, | 143 }, |
| 144 | 144 |
| 145 /** | 145 /** |
| 146 * Focuses the search bar in the toolbar. |
| 147 */ |
| 148 focusToolbarSearchField: function() { |
| 149 this.$.toolbar.showSearchField(); |
| 150 }, |
| 151 |
| 152 /** |
| 146 * Fired when the user presses 'More from this site'. | 153 * Fired when the user presses 'More from this site'. |
| 147 * @param {{detail: {domain: string}}} e | 154 * @param {{detail: {domain: string}}} e |
| 148 */ | 155 */ |
| 149 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, | 156 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, |
| 150 | 157 |
| 151 /** | 158 /** |
| 152 * @param {Event} e | 159 * @param {Event} e |
| 153 * @private | 160 * @private |
| 154 */ | 161 */ |
| 155 onCanExecute_: function(e) { | 162 onCanExecute_: function(e) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 183 searchQueryParamChanged_: function(searchQuery) { | 190 searchQueryParamChanged_: function(searchQuery) { |
| 184 this.$.toolbar.setSearchTerm(searchQuery || ''); | 191 this.$.toolbar.setSearchTerm(searchQuery || ''); |
| 185 }, | 192 }, |
| 186 | 193 |
| 187 /** | 194 /** |
| 188 * @param {Event} e | 195 * @param {Event} e |
| 189 * @private | 196 * @private |
| 190 */ | 197 */ |
| 191 onCommand_: function(e) { | 198 onCommand_: function(e) { |
| 192 if (e.command.id == 'find-command' || e.command.id == 'slash-command') | 199 if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
| 193 this.$.toolbar.showSearchField(); | 200 this.focusToolbarSearchField(); |
| 194 if (e.command.id == 'delete-command') | 201 if (e.command.id == 'delete-command') |
| 195 this.deleteSelected(); | 202 this.deleteSelected(); |
| 196 }, | 203 }, |
| 197 | 204 |
| 198 /** | 205 /** |
| 199 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 206 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
| 200 * the sessions from other devices. | 207 * the sessions from other devices. |
| 201 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 208 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
| 202 */ | 209 */ |
| 203 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 210 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 return selectedPage; | 283 return selectedPage; |
| 277 }, | 284 }, |
| 278 | 285 |
| 279 /** @private */ | 286 /** @private */ |
| 280 closeDrawer_: function() { | 287 closeDrawer_: function() { |
| 281 var drawer = this.$$('#drawer'); | 288 var drawer = this.$$('#drawer'); |
| 282 if (drawer) | 289 if (drawer) |
| 283 drawer.close(); | 290 drawer.close(); |
| 284 }, | 291 }, |
| 285 }); | 292 }); |
| OLD | NEW |