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

Side by Side Diff: chrome/browser/resources/print_preview/data/destination_store.js

Issue 313723002: Convert local printer capabilites to CDD format to unify with cloud printers and PDF printer. This … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang reported errors. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/local_parsers.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 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
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
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 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/local_parsers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698