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

Side by Side Diff: chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.js

Issue 542363002: Add search hint bubbles to Print Preview advanced options controls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 destination item in a destination list. 9 * Component that renders a destination item in a destination list.
10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection 10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 isModified: function() { 102 isModified: function() {
103 return !!this.selectedValue_; 103 return !!this.selectedValue_;
104 }, 104 },
105 105
106 /** @param {RegExp} query Query to update the filter with. */ 106 /** @param {RegExp} query Query to update the filter with. */
107 updateSearchQuery: function(query) { 107 updateSearchQuery: function(query) {
108 this.query_ = query; 108 this.query_ = query;
109 this.renderCapability_(); 109 this.renderCapability_();
110 }, 110 },
111 111
112 get searchBubbleShown() {
113 return getIsVisible(this.getElement()) && !!this.searchBubble_;
114 },
115
112 /** 116 /**
113 * @return {HTMLSelectElement} Select element. 117 * @return {HTMLSelectElement} Select element.
114 * @private 118 * @private
115 */ 119 */
116 get select_() { 120 get select_() {
117 return this.getChildElement( 121 return this.getChildElement(
118 '.advanced-settings-item-value-select-control'); 122 '.advanced-settings-item-value-select-control');
119 }, 123 },
120 124
121 /** 125 /**
(...skipping 26 matching lines...) Expand all
148 }, 152 },
149 153
150 /** 154 /**
151 * Renders capability properties according to the current state. 155 * Renders capability properties according to the current state.
152 * @private 156 * @private
153 */ 157 */
154 renderCapability_: function() { 158 renderCapability_: function() {
155 var textContent = this.capability_.display_name; 159 var textContent = this.capability_.display_name;
156 var nameMatches = this.query_ ? !!textContent.match(this.query_) : true; 160 var nameMatches = this.query_ ? !!textContent.match(this.query_) : true;
157 var optionMatches = null; 161 var optionMatches = null;
158 if (false && this.query_) { 162 if (this.query_) {
159 if (this.capability_.type == 'SELECT') { 163 if (this.capability_.type == 'SELECT') {
160 this.capability_.select_cap.option.some(function(option) { 164 this.capability_.select_cap.option.some(function(option) {
161 optionMatches = (option.display_name || '').match(this.query_); 165 optionMatches = (option.display_name || '').match(this.query_);
162 return !!optionMatches; 166 return !!optionMatches;
163 }.bind(this)); 167 }.bind(this));
164 } else { 168 } else {
165 optionMatches = (this.text_.value || '').match(this.query_); 169 optionMatches = (this.text_.value || '').match(this.query_);
166 } 170 }
167 } 171 }
168 var matches = nameMatches || optionMatches; 172 var matches = nameMatches || optionMatches;
(...skipping 10 matching lines...) Expand all
179 var nameEl = this.getChildElement('.advanced-settings-item-label'); 183 var nameEl = this.getChildElement('.advanced-settings-item-label');
180 if (this.query_) { 184 if (this.query_) {
181 nameEl.textContent = ''; 185 nameEl.textContent = '';
182 this.addTextWithHighlight_(nameEl, textContent); 186 this.addTextWithHighlight_(nameEl, textContent);
183 } else { 187 } else {
184 nameEl.textContent = textContent; 188 nameEl.textContent = textContent;
185 } 189 }
186 nameEl.title = textContent; 190 nameEl.title = textContent;
187 191
188 if (optionMatches) { 192 if (optionMatches) {
189 window.console.log(optionMatches[0]);
190 var element = 193 var element =
191 this.capability_.type == 'SELECT' ? this.select_ : this.text_; 194 this.capability_.type == 'SELECT' ? this.select_ : this.text_;
192 if (!this.searchBubble_) { 195 if (!this.searchBubble_) {
193 this.searchBubble_ = new print_preview.SearchBubble(optionMatches[0]); 196 this.searchBubble_ = new print_preview.SearchBubble(optionMatches[0]);
194 this.searchBubble_.attachTo(element); 197 this.searchBubble_.attachTo(element);
195 } else { 198 } else {
196 this.searchBubble_.content = optionMatches[0]; 199 this.searchBubble_.content = optionMatches[0];
197 } 200 }
198 } 201 }
199 }, 202 },
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 270 }
268 }); 271 });
269 } 272 }
270 }; 273 };
271 274
272 // Export 275 // Export
273 return { 276 return {
274 AdvancedSettingsItem: AdvancedSettingsItem 277 AdvancedSettingsItem: AdvancedSettingsItem
275 }; 278 };
276 }); 279 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698