Chromium Code Reviews| 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 that displays a list of destinations with a heading, action link, | 9 * Component that displays a list of destinations with a heading, action link, |
| 10 * and "Show All..." button. An event is dispatched when the action link is | 10 * and "Show All..." button. An event is dispatched when the action link is |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 this.renderDestinations_(); | 218 this.renderDestinations_(); |
| 219 }, | 219 }, |
| 220 | 220 |
| 221 /** @param {RegExp} query Query to update the filter with. */ | 221 /** @param {RegExp} query Query to update the filter with. */ |
| 222 updateSearchQuery: function(query) { | 222 updateSearchQuery: function(query) { |
| 223 this.query_ = query; | 223 this.query_ = query; |
| 224 this.renderDestinations_(); | 224 this.renderDestinations_(); |
| 225 }, | 225 }, |
| 226 | 226 |
| 227 /** | 227 /** |
| 228 * @param {string} destinationId The ID of the destination. | |
| 229 * @return {?print_preview.DestinationListItem} The found destination list | |
| 230 * item or null if not found. | |
| 231 */ | |
| 232 getDestinationItem: function(destinationId) { | |
| 233 return this.listItems_.find(function(listItem) { | |
| 234 return listItem.destination.id == destinationId; | |
| 235 }); | |
|
dpapad
2017/03/30 20:56:23
find() returns undefined, if nothing is found, see
xdai1
2017/03/30 23:18:43
Thanks. Done.
| |
| 236 }, | |
| 237 | |
| 238 /** | |
| 228 * @param {string} text Text to set the action link to. | 239 * @param {string} text Text to set the action link to. |
| 229 * @protected | 240 * @protected |
| 230 */ | 241 */ |
| 231 setActionLinkTextInternal: function(text) { | 242 setActionLinkTextInternal: function(text) { |
| 232 this.actionLinkLabel_ = text; | 243 this.actionLinkLabel_ = text; |
| 233 this.getChildElement('.action-link').textContent = text; | 244 this.getChildElement('.action-link').textContent = text; |
| 234 }, | 245 }, |
| 235 | 246 |
| 236 /** | 247 /** |
| 237 * Sets the short list size without constraints. | 248 * Sets the short list size without constraints. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 cr.dispatchSimpleEvent(this, | 366 cr.dispatchSimpleEvent(this, |
| 356 DestinationList.EventType.ACTION_LINK_ACTIVATED); | 367 DestinationList.EventType.ACTION_LINK_ACTIVATED); |
| 357 } | 368 } |
| 358 }; | 369 }; |
| 359 | 370 |
| 360 // Export | 371 // Export |
| 361 return { | 372 return { |
| 362 DestinationList: DestinationList | 373 DestinationList: DestinationList |
| 363 }; | 374 }; |
| 364 }); | 375 }); |
| OLD | NEW |