OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Component used for searching for a print destination. | 9 * Component used for searching for a print destination. |
10 * This is a modal dialog that allows the user to search and select a | 10 * This is a modal dialog that allows the user to search and select a |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 var elStyle = window.getComputedStyle(this.getElement()); | 257 var elStyle = window.getComputedStyle(this.getElement()); |
258 return this.getElement().offsetHeight - | 258 return this.getElement().offsetHeight - |
259 parseInt(elStyle.getPropertyValue('padding-top')) - | 259 parseInt(elStyle.getPropertyValue('padding-top')) - |
260 parseInt(elStyle.getPropertyValue('padding-bottom')) - | 260 parseInt(elStyle.getPropertyValue('padding-bottom')) - |
261 this.getChildElement('.lists').offsetTop - | 261 this.getChildElement('.lists').offsetTop - |
262 this.getChildElement('.cloudprint-promo').offsetHeight; | 262 this.getChildElement('.cloudprint-promo').offsetHeight; |
263 }, | 263 }, |
264 | 264 |
265 /** | 265 /** |
266 * Filters all destination lists with the given query. | 266 * Filters all destination lists with the given query. |
267 * @param {?string} query Query to filter destination lists by. | 267 * @param {RegExp} query Query to filter destination lists by. |
268 * @private | 268 * @private |
269 */ | 269 */ |
270 filterLists_: function(query) { | 270 filterLists_: function(query) { |
271 this.recentList_.updateSearchQuery(query); | 271 this.recentList_.updateSearchQuery(query); |
272 this.localList_.updateSearchQuery(query); | 272 this.localList_.updateSearchQuery(query); |
273 this.cloudList_.updateSearchQuery(query); | 273 this.cloudList_.updateSearchQuery(query); |
274 }, | 274 }, |
275 | 275 |
276 /** | 276 /** |
277 * Resets the search query. | 277 * Resets the search query. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 this.reflowLists_(); | 443 this.reflowLists_(); |
444 }, | 444 }, |
445 | 445 |
446 /** | 446 /** |
447 * Called when a destination search should be executed. Filters the | 447 * Called when a destination search should be executed. Filters the |
448 * destination lists with the given query. | 448 * destination lists with the given query. |
449 * @param {Event} evt Contains the search query. | 449 * @param {Event} evt Contains the search query. |
450 * @private | 450 * @private |
451 */ | 451 */ |
452 onSearch_: function(evt) { | 452 onSearch_: function(evt) { |
453 this.filterLists_(evt.query); | 453 this.filterLists_(evt.queryRegExp); |
454 }, | 454 }, |
455 | 455 |
456 /** | 456 /** |
457 * Called when a destination is selected. Clears the search and hides the | 457 * Called when a destination is selected. Clears the search and hides the |
458 * widget. | 458 * widget. |
459 * @param {Event} evt Contains the selected destination. | 459 * @param {Event} evt Contains the selected destination. |
460 * @private | 460 * @private |
461 */ | 461 */ |
462 onDestinationSelect_: function(evt) { | 462 onDestinationSelect_: function(evt) { |
463 this.setIsVisible(false); | 463 this.setIsVisible(false); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 onWindowResize_: function() { | 580 onWindowResize_: function() { |
581 this.reflowLists_(); | 581 this.reflowLists_(); |
582 } | 582 } |
583 }; | 583 }; |
584 | 584 |
585 // Export | 585 // Export |
586 return { | 586 return { |
587 DestinationSearch: DestinationSearch | 587 DestinationSearch: DestinationSearch |
588 }; | 588 }; |
589 }); | 589 }); |
OLD | NEW |