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 * A data store that stores destinations and dispatches events when the data | 9 * A data store that stores destinations and dispatches events when the data |
10 * store changes. | 10 * store changes. |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 * Called when capabilities for a privet printer are set. | 673 * Called when capabilities for a privet printer are set. |
674 * @param {object} event Contains the capabilities and printer ID. | 674 * @param {object} event Contains the capabilities and printer ID. |
675 * @private | 675 * @private |
676 */ | 676 */ |
677 onPrivetCapabilitiesSet_: function(event) { | 677 onPrivetCapabilitiesSet_: function(event) { |
678 var destinationId = event.printerId; | 678 var destinationId = event.printerId; |
679 var dest = print_preview.PrivetDestinationParser.parse(event.printer); | 679 var dest = print_preview.PrivetDestinationParser.parse(event.printer); |
680 dest.capabilities = event.capabilities; | 680 dest.capabilities = event.capabilities; |
681 | 681 |
682 this.updateDestination(dest); | 682 this.updateDestination(dest); |
683 if (this.selectedDestination_ == dest) { | 683 if (this.selectedDestination_.isPrivet && |
| 684 this.selectedDestination_.id == dest.id) { |
684 cr.dispatchSimpleEvent( | 685 cr.dispatchSimpleEvent( |
685 this, | 686 this, |
686 DestinationStore.EventType.SELECTED_DESTINATION_CAPABILITIES_READY); | 687 DestinationStore.EventType.SELECTED_DESTINATION_CAPABILITIES_READY); |
687 } | 688 } |
688 }, | 689 }, |
689 | 690 |
690 /** | 691 /** |
691 * Called when the search for Privet printers is done. | 692 * Called when the search for Privet printers is done. |
692 * @private | 693 * @private |
693 */ | 694 */ |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 return id == this.initialDestinationId_ && | 756 return id == this.initialDestinationId_ && |
756 origin == this.initialDestinationOrigin_; | 757 origin == this.initialDestinationOrigin_; |
757 } | 758 } |
758 }; | 759 }; |
759 | 760 |
760 // Export | 761 // Export |
761 return { | 762 return { |
762 DestinationStore: DestinationStore | 763 DestinationStore: DestinationStore |
763 }; | 764 }; |
764 }); | 765 }); |
OLD | NEW |