| 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 /** | 5 /** |
| 6 * @fileoverview PromiseResolver is a helper class that allows creating a | 6 * @fileoverview PromiseResolver is a helper class that allows creating a |
| 7 * Promise that will be fulfilled (resolved or rejected) some time later. | 7 * Promise that will be fulfilled (resolved or rejected) some time later. |
| 8 * | 8 * |
| 9 * Example: | 9 * Example: |
| 10 * var resolver = new PromiseResolver(); | 10 * var resolver = new PromiseResolver(); |
| (...skipping 14416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14427 lastVisitTime, maxResults | 14427 lastVisitTime, maxResults |
| 14428 ]); | 14428 ]); |
| 14429 }, | 14429 }, |
| 14430 | 14430 |
| 14431 /** @return {number} */ | 14431 /** @return {number} */ |
| 14432 getSelectedItemCount: function() { | 14432 getSelectedItemCount: function() { |
| 14433 return this.getSelectedList_().selectedPaths.size; | 14433 return this.getSelectedList_().selectedPaths.size; |
| 14434 }, | 14434 }, |
| 14435 | 14435 |
| 14436 unselectAllItems: function(count) { | 14436 unselectAllItems: function(count) { |
| 14437 this.getSelectedList_().unselectAllItems(count); | 14437 if (this.getSelectedList_()) |
| 14438 this.getSelectedList_().unselectAllItems(count); |
| 14438 }, | 14439 }, |
| 14439 | 14440 |
| 14440 /** | 14441 /** |
| 14441 * Delete all the currently selected history items. Will prompt the user with | 14442 * Delete all the currently selected history items. Will prompt the user with |
| 14442 * a dialog to confirm that the deletion should be performed. | 14443 * a dialog to confirm that the deletion should be performed. |
| 14443 */ | 14444 */ |
| 14444 deleteSelectedWithPrompt: function() { | 14445 deleteSelectedWithPrompt: function() { |
| 14445 if (!loadTimeData.getBoolean('allowDeletingHistory')) | 14446 if (!loadTimeData.getBoolean('allowDeletingHistory')) |
| 14446 return; | 14447 return; |
| 14447 this.$.dialog.get().then(function(dialog) { | 14448 this.$.dialog.get().then(function(dialog) { |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15080 } | 15081 } |
| 15081 }, | 15082 }, |
| 15082 | 15083 |
| 15083 // Route data for the current page. | 15084 // Route data for the current page. |
| 15084 routeData_: Object, | 15085 routeData_: Object, |
| 15085 | 15086 |
| 15086 // The query params for the page. | 15087 // The query params for the page. |
| 15087 queryParams_: Object, | 15088 queryParams_: Object, |
| 15088 | 15089 |
| 15089 // True if the window is narrow enough for the page to have a drawer. | 15090 // True if the window is narrow enough for the page to have a drawer. |
| 15090 hasDrawer_: Boolean, | 15091 hasDrawer: Boolean, |
| 15091 }, | 15092 }, |
| 15092 | 15093 |
| 15093 observers: [ | 15094 observers: [ |
| 15094 // routeData_.page <=> selectedPage | 15095 // routeData_.page <=> selectedPage |
| 15095 'routeDataChanged_(routeData_.page)', | 15096 'routeDataChanged_(routeData_.page)', |
| 15096 'selectedPageChanged_(selectedPage_)', | 15097 'selectedPageChanged_(selectedPage_)', |
| 15097 | 15098 |
| 15098 // queryParams_.q <=> queryState.searchTerm | 15099 // queryParams_.q <=> queryState.searchTerm |
| 15099 'searchTermChanged_(queryState_.searchTerm)', | 15100 'searchTermChanged_(queryState_.searchTerm)', |
| 15100 'searchQueryParamChanged_(queryParams_.q)', | 15101 'searchQueryParamChanged_(queryParams_.q)', |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15169 historyResult: function(info, results) { | 15170 historyResult: function(info, results) { |
| 15170 this.set('queryState_.querying', false); | 15171 this.set('queryState_.querying', false); |
| 15171 this.set('queryResult_.info', info); | 15172 this.set('queryResult_.info', info); |
| 15172 this.set('queryResult_.results', results); | 15173 this.set('queryResult_.results', results); |
| 15173 var listContainer = | 15174 var listContainer = |
| 15174 /** @type {HistoryListContainerElement} */ (this.$['history']); | 15175 /** @type {HistoryListContainerElement} */ (this.$['history']); |
| 15175 listContainer.historyResult(info, results); | 15176 listContainer.historyResult(info, results); |
| 15176 }, | 15177 }, |
| 15177 | 15178 |
| 15178 /** | 15179 /** |
| 15180 * Focuses the search bar in the toolbar. |
| 15181 */ |
| 15182 focusToolbarSearchField: function() { |
| 15183 this.$.toolbar.showSearchField(); |
| 15184 }, |
| 15185 |
| 15186 /** |
| 15179 * Fired when the user presses 'More from this site'. | 15187 * Fired when the user presses 'More from this site'. |
| 15180 * @param {{detail: {domain: string}}} e | 15188 * @param {{detail: {domain: string}}} e |
| 15181 */ | 15189 */ |
| 15182 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, | 15190 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, |
| 15183 | 15191 |
| 15184 /** | 15192 /** |
| 15185 * @param {Event} e | 15193 * @param {Event} e |
| 15186 * @private | 15194 * @private |
| 15187 */ | 15195 */ |
| 15188 onCanExecute_: function(e) { | 15196 onCanExecute_: function(e) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 15216 searchQueryParamChanged_: function(searchQuery) { | 15224 searchQueryParamChanged_: function(searchQuery) { |
| 15217 this.$.toolbar.setSearchTerm(searchQuery || ''); | 15225 this.$.toolbar.setSearchTerm(searchQuery || ''); |
| 15218 }, | 15226 }, |
| 15219 | 15227 |
| 15220 /** | 15228 /** |
| 15221 * @param {Event} e | 15229 * @param {Event} e |
| 15222 * @private | 15230 * @private |
| 15223 */ | 15231 */ |
| 15224 onCommand_: function(e) { | 15232 onCommand_: function(e) { |
| 15225 if (e.command.id == 'find-command' || e.command.id == 'slash-command') | 15233 if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
| 15226 this.$.toolbar.showSearchField(); | 15234 this.focusToolbarSearchField(); |
| 15227 if (e.command.id == 'delete-command') | 15235 if (e.command.id == 'delete-command') |
| 15228 this.deleteSelected(); | 15236 this.deleteSelected(); |
| 15229 }, | 15237 }, |
| 15230 | 15238 |
| 15231 /** | 15239 /** |
| 15232 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 15240 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
| 15233 * the sessions from other devices. | 15241 * the sessions from other devices. |
| 15234 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 15242 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
| 15235 */ | 15243 */ |
| 15236 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 15244 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15309 return selectedPage; | 15317 return selectedPage; |
| 15310 }, | 15318 }, |
| 15311 | 15319 |
| 15312 /** @private */ | 15320 /** @private */ |
| 15313 closeDrawer_: function() { | 15321 closeDrawer_: function() { |
| 15314 var drawer = this.$$('#drawer'); | 15322 var drawer = this.$$('#drawer'); |
| 15315 if (drawer) | 15323 if (drawer) |
| 15316 drawer.close(); | 15324 drawer.close(); |
| 15317 }, | 15325 }, |
| 15318 }); | 15326 }); |
| OLD | NEW |