| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 that renders a search box for searching through destinations. | 9 * Component that renders a search box for searching through destinations. |
| 10 * @param {string} searchBoxPlaceholderText Search box placeholder text. | 10 * @param {string} searchBoxPlaceholderText Search box placeholder text. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 /** Sets the input element of the search box in focus. */ | 60 /** Sets the input element of the search box in focus. */ |
| 61 focus: function() { | 61 focus: function() { |
| 62 this.input_.focus(); | 62 this.input_.focus(); |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 /** @override */ | 65 /** @override */ |
| 66 createDom: function() { | 66 createDom: function() { |
| 67 this.setElementInternal(this.cloneTemplateInternal( | 67 this.setElementInternal(this.cloneTemplateInternal( |
| 68 'search-box-template')); | 68 'search-box-template')); |
| 69 this.input_ = this.getChildElement('.search-box-input'); | 69 this.input_ = assertInstanceof(this.getChildElement('.search-box-input'), |
| 70 HTMLInputElement); |
| 70 this.input_.setAttribute('placeholder', this.searchBoxPlaceholderText_); | 71 this.input_.setAttribute('placeholder', this.searchBoxPlaceholderText_); |
| 71 }, | 72 }, |
| 72 | 73 |
| 73 /** @override */ | 74 /** @override */ |
| 74 enterDocument: function() { | 75 enterDocument: function() { |
| 75 print_preview.Component.prototype.enterDocument.call(this); | 76 print_preview.Component.prototype.enterDocument.call(this); |
| 76 this.tracker.add(assert(this.input_), 'input', | 77 this.tracker.add(assert(this.input_), 'input', |
| 77 this.onInputInput_.bind(this)); | 78 this.onInputInput_.bind(this)); |
| 78 }, | 79 }, |
| 79 | 80 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 this.timeout_ = setTimeout( | 121 this.timeout_ = setTimeout( |
| 121 this.dispatchSearchEvent_.bind(this), SearchBox.SEARCH_DELAY_); | 122 this.dispatchSearchEvent_.bind(this), SearchBox.SEARCH_DELAY_); |
| 122 } | 123 } |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 // Export | 126 // Export |
| 126 return { | 127 return { |
| 127 SearchBox: SearchBox | 128 SearchBox: SearchBox |
| 128 }; | 129 }; |
| 129 }); | 130 }); |
| OLD | NEW |