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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 * destination. | 726 * destination. |
727 * @private | 727 * @private |
728 */ | 728 */ |
729 onLocalDestinationCapabilitiesSet_: function(event) { | 729 onLocalDestinationCapabilitiesSet_: function(event) { |
730 var destinationId = event.settingsInfo['printerId']; | 730 var destinationId = event.settingsInfo['printerId']; |
731 var key = this.getDestinationKey_( | 731 var key = this.getDestinationKey_( |
732 print_preview.Destination.Origin.LOCAL, | 732 print_preview.Destination.Origin.LOCAL, |
733 destinationId, | 733 destinationId, |
734 ''); | 734 ''); |
735 var destination = this.destinationMap_[key]; | 735 var destination = this.destinationMap_[key]; |
| 736 var capabilities = DestinationStore.localizeCapabilities_( |
| 737 event.settingsInfo.capabilities); |
736 // Special case for PDF printer (until local printers capabilities are | 738 // Special case for PDF printer (until local printers capabilities are |
737 // reported in CDD format too). | 739 // reported in CDD format too). |
738 if (destinationId == | 740 if (destinationId == |
739 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) { | 741 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF) { |
740 if (destination) { | 742 if (destination) { |
741 destination.capabilities = DestinationStore.localizeCapabilities_( | 743 destination.capabilities = capabilities; |
742 event.settingsInfo.capabilities); | |
743 } | 744 } |
744 } else { | 745 } else { |
745 var capabilities = print_preview.LocalCapabilitiesParser.parse( | |
746 event.settingsInfo); | |
747 if (destination) { | 746 if (destination) { |
748 // In case there were multiple capabilities request for this local | 747 // In case there were multiple capabilities request for this local |
749 // destination, just ignore the later ones. | 748 // destination, just ignore the later ones. |
750 if (destination.capabilities != null) { | 749 if (destination.capabilities != null) { |
751 return; | 750 return; |
752 } | 751 } |
753 destination.capabilities = capabilities; | 752 destination.capabilities = capabilities; |
754 } else { | 753 } else { |
755 // TODO(rltoscano): This makes the assumption that the "deviceName" is | 754 // TODO(rltoscano): This makes the assumption that the "deviceName" is |
756 // the same as "printerName". We should include the "printerName" in | 755 // the same as "printerName". We should include the "printerName" in |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 return id == this.appState_.selectedDestinationId && | 933 return id == this.appState_.selectedDestinationId && |
935 origin == this.appState_.selectedDestinationOrigin; | 934 origin == this.appState_.selectedDestinationOrigin; |
936 } | 935 } |
937 }; | 936 }; |
938 | 937 |
939 // Export | 938 // Export |
940 return { | 939 return { |
941 DestinationStore: DestinationStore | 940 DestinationStore: DestinationStore |
942 }; | 941 }; |
943 }); | 942 }); |
OLD | NEW |