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

Side by Side Diff: chrome/browser/resources/print_preview/search/destination_list.js

Issue 2760753002: [CUPS] Implement the local CUPS printer setup waiting UI. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
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
11 * activated. 11 * activated.
12 * @param {!cr.EventTarget} eventTarget Event target to pass to destination 12 * @param {!cr.EventTarget} eventTarget Event target to pass to destination
13 * items for dispatching SELECT events. 13 * items for dispatching SELECT events.
14 * @param {!print_preview.DestinationStore} destinationStore Data store
15 * containing the destinations to search through.
14 * @param {string} title Title of the destination list. 16 * @param {string} title Title of the destination list.
15 * @param {?string} actionLinkLabel Optional label of the action link. If 17 * @param {?string} actionLinkLabel Optional label of the action link. If
16 * {@code null} is provided, the action link will not be shown. 18 * {@code null} is provided, the action link will not be shown.
17 * @param {boolean=} opt_showAll Whether to initially show all destinations or 19 * @param {boolean=} opt_showAll Whether to initially show all destinations or
18 * only the first few ones. 20 * only the first few ones.
19 * @constructor 21 * @constructor
20 * @extends {print_preview.Component} 22 * @extends {print_preview.Component}
21 */ 23 */
22 function DestinationList(eventTarget, title, actionLinkLabel, opt_showAll) { 24 function DestinationList(
25 eventTarget, destinationStore, title, actionLinkLabel, opt_showAll) {
23 print_preview.Component.call(this); 26 print_preview.Component.call(this);
24 27
25 /** 28 /**
26 * Event target to pass to destination items for dispatching SELECT events. 29 * Event target to pass to destination items for dispatching SELECT events.
27 * @type {!cr.EventTarget} 30 * @type {!cr.EventTarget}
28 * @private 31 * @private
29 */ 32 */
30 this.eventTarget_ = eventTarget; 33 this.eventTarget_ = eventTarget;
31 34
32 /** 35 /**
36 * Data store containing all the destinations.
37 * @type {!print_preview.DestinationStore}
38 * @private
39 */
40 this.destinationStore_ = destinationStore;
41
42 /**
33 * Title of the destination list. 43 * Title of the destination list.
34 * @type {string} 44 * @type {string}
35 * @private 45 * @private
36 */ 46 */
37 this.title_ = title; 47 this.title_ = title;
38 48
39 /** 49 /**
40 * Label of the action link. 50 * Label of the action link.
41 * @type {?string} 51 * @type {?string}
42 * @private 52 * @private
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } 343 }
334 }, 344 },
335 345
336 /** 346 /**
337 * @param {Element} listEl List element. 347 * @param {Element} listEl List element.
338 * @param {!print_preview.Destination} destination Destination to render. 348 * @param {!print_preview.Destination} destination Destination to render.
339 * @private 349 * @private
340 */ 350 */
341 renderListItem_: function(listEl, destination) { 351 renderListItem_: function(listEl, destination) {
342 var listItem = new print_preview.DestinationListItem( 352 var listItem = new print_preview.DestinationListItem(
343 this.eventTarget_, destination, this.query_); 353 this.eventTarget_, this.destinationStore_, destination, this.query_);
344 this.addChild(listItem); 354 this.addChild(listItem);
345 listItem.render(listEl); 355 listItem.render(listEl);
346 this.listItems_.push(listItem); 356 this.listItems_.push(listItem);
347 }, 357 },
348 358
349 /** 359 /**
350 * Called when the action link is clicked. Dispatches an 360 * Called when the action link is clicked. Dispatches an
351 * ACTION_LINK_ACTIVATED event. 361 * ACTION_LINK_ACTIVATED event.
352 * @private 362 * @private
353 */ 363 */
354 onActionLinkClick_: function() { 364 onActionLinkClick_: function() {
355 cr.dispatchSimpleEvent(this, 365 cr.dispatchSimpleEvent(this,
356 DestinationList.EventType.ACTION_LINK_ACTIVATED); 366 DestinationList.EventType.ACTION_LINK_ACTIVATED);
357 } 367 }
358 }; 368 };
359 369
360 // Export 370 // Export
361 return { 371 return {
362 DestinationList: DestinationList 372 DestinationList: DestinationList
363 }; 373 };
364 }); 374 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698