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 used for searching for a print destination. | 9 * Component used for searching for a print destination. |
| 10 * This is a modal dialog that allows the user to search and select a | 10 * This is a modal dialog that allows the user to search and select a |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 /** | 578 /** |
| 579 * Handler for {@code print_preview.DestinationListItem.EventType. | 579 * Handler for {@code print_preview.DestinationListItem.EventType. |
| 580 * CONFIGURE_REQUEST} event, which is called to check a destination list | 580 * CONFIGURE_REQUEST} event, which is called to check a destination list |
| 581 * item needs to be setup on Chrome OS before being selected. Note we do not | 581 * item needs to be setup on Chrome OS before being selected. Note we do not |
| 582 * allow configuring more than one destination at the same time. | 582 * allow configuring more than one destination at the same time. |
| 583 * @param {!CustomEvent} event Contains the destination needs to be setup. | 583 * @param {!CustomEvent} event Contains the destination needs to be setup. |
| 584 * @private | 584 * @private |
| 585 */ | 585 */ |
| 586 onDestinationConfigureRequest_: function(event) { | 586 onDestinationConfigureRequest_: function(event) { |
| 587 var destination = event.detail.destination; | 587 var destination = event.detail.destination; |
| 588 var destinationItem = destination.isLocal ? | 588 var destinationItem; |
|
Lei Zhang
2017/04/25 00:42:36
Looking at renderDestinations_() above, should thi
skau
2017/04/25 00:58:05
Hmm. Looks like somebody needs to think about how
| |
| 589 this.localList_.getDestinationItem(destination.id) : | 589 if (!destination.isLocal) { |
| 590 this.cloudList_.getDestinationItem(destination.id); | 590 destinationItem = this.cloudList_.getDestinationItem(destination.id); |
| 591 } | |
| 592 // Non-local destinations can be in the local list for Cloud Printers | |
| 593 // in Kiosk apps. crbug.com/713831 | |
| 594 if (destinationItem == null) { | |
| 595 destinationItem = this.localList_.getDestinationItem(destination.id); | |
| 596 } | |
| 591 assert(destinationItem != null, | 597 assert(destinationItem != null, |
| 592 'User does not select a valid destination item.'); | 598 'User does not select a valid destination item.'); |
| 593 | 599 |
| 594 // Another printer setup is in process or the printer doesn't need to be | 600 // Another printer setup is in process or the printer doesn't need to be |
| 595 // set up. Reject the setup request directly. | 601 // set up. Reject the setup request directly. |
| 596 if (this.destinationInConfiguring_ != null || | 602 if (this.destinationInConfiguring_ != null || |
| 597 destination.origin != print_preview.Destination.Origin.CROS || | 603 destination.origin != print_preview.Destination.Origin.CROS || |
| 598 destination.capabilities != null) { | 604 destination.capabilities != null) { |
| 599 destinationItem.onConfigureRequestRejected( | 605 destinationItem.onConfigureRequestRejected( |
| 600 this.destinationInConfiguring_ != null); | 606 this.destinationInConfiguring_ != null); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 onWindowResize_: function() { | 836 onWindowResize_: function() { |
| 831 this.reflowLists_(); | 837 this.reflowLists_(); |
| 832 } | 838 } |
| 833 }; | 839 }; |
| 834 | 840 |
| 835 // Export | 841 // Export |
| 836 return { | 842 return { |
| 837 DestinationSearch: DestinationSearch | 843 DestinationSearch: DestinationSearch |
| 838 }; | 844 }; |
| 839 }); | 845 }); |
| OLD | NEW |