Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1291)

Unified Diff: chrome/browser/resources/print_preview/common/search_box.js

Issue 399973004: Advanced printing destination settings modal dialog (non-functional yet, just the skeleton). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/common/search_box.js
diff --git a/chrome/browser/resources/print_preview/search/search_box.js b/chrome/browser/resources/print_preview/common/search_box.js
similarity index 79%
rename from chrome/browser/resources/print_preview/search/search_box.js
rename to chrome/browser/resources/print_preview/common/search_box.js
index dfdd466a0c0ebddc397c1d95c7d8d4d5934f4d0d..90c2f9c8124556fcbd798a71b4fad68a27d328d1 100644
--- a/chrome/browser/resources/print_preview/search/search_box.js
+++ b/chrome/browser/resources/print_preview/common/search_box.js
@@ -7,23 +7,28 @@ cr.define('print_preview', function() {
/**
* Component that renders a search box for searching through destinations.
+ * @param {string} searchBoxPlaceholderText Search box placeholder text.
* @constructor
* @extends {print_preview.Component}
*/
- function SearchBox() {
+ function SearchBox(searchBoxPlaceholderText) {
print_preview.Component.call(this);
/**
+ * Search box placeholder text.
+ * @private {string}
+ */
+ this.searchBoxPlaceholderText_ = searchBoxPlaceholderText;
+
+ /**
* Timeout used to control incremental search.
- * @type {?number}
- * @private
+ * @private {?number}
*/
this.timeout_ = null;
/**
* Input box where the query is entered.
- * @type {HTMLInputElement}
- * @private
+ * @private {HTMLInputElement}
*/
this.input_ = null;
};
@@ -37,19 +42,9 @@ cr.define('print_preview', function() {
};
/**
- * CSS classes used by the search box.
- * @enum {string}
- * @private
- */
- SearchBox.Classes_ = {
- INPUT: 'search-box-input'
- };
-
- /**
* Delay in milliseconds before dispatching a SEARCH event.
- * @type {number}
+ * @private {number}
* @const
- * @private
*/
SearchBox.SEARCH_DELAY_ = 150;
@@ -68,6 +63,14 @@ cr.define('print_preview', function() {
},
/** @override */
+ createDom: function() {
+ this.setElementInternal(this.cloneTemplateInternal(
+ 'search-box-template'));
+ this.input_ = this.getChildElement('.search-box-input');
+ this.input_.setAttribute('placeholder', this.searchBoxPlaceholderText_);
+ },
+
+ /** @override */
enterDocument: function() {
print_preview.Component.prototype.enterDocument.call(this);
this.tracker.add(this.input_, 'input', this.onInputInput_.bind(this));
@@ -79,12 +82,6 @@ cr.define('print_preview', function() {
this.input_ = null;
},
- /** @override */
- decorateInternal: function() {
- this.input_ = this.getElement().getElementsByClassName(
- SearchBox.Classes_.INPUT)[0];
- },
-
/**
* @return {string} The current query of the search box.
* @private
@@ -109,9 +106,8 @@ cr.define('print_preview', function() {
* @private
*/
onInputInput_: function() {
- if (this.timeout_) {
+ if (this.timeout_)
clearTimeout(this.timeout_);
- }
this.timeout_ = setTimeout(
this.dispatchSearchEvent_.bind(this), SearchBox.SEARCH_DELAY_);
}

Powered by Google App Engine
This is Rietveld 408576698