| 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 /** Namespace that contains a method to parse local print destinations. */ | 8 /** Namespace that contains a method to parse local print destinations. */ |
| 9 function LocalDestinationParser() {}; | 9 function LocalDestinationParser() {}; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Parses a local print destination. | 12 * Parses a local print destination. |
| 13 * @param {!Object} destinationInfo Information describing a local print | 13 * @param {!Object} destinationInfo Information describing a local print |
| 14 * destination. | 14 * destination. |
| 15 * @return {!print_preview.Destination} Parsed local print destination. | 15 * @return {!print_preview.Destination} Parsed local print destination. |
| 16 */ | 16 */ |
| 17 LocalDestinationParser.parse = function(destinationInfo) { | 17 LocalDestinationParser.parse = function(destinationInfo) { |
| 18 var options = {'description': destinationInfo.printerDescription}; | 18 var options = {description: destinationInfo.printerDescription, |
| 19 isEnterprisePrinter: destinationInfo.cupsEnterprisePrinter}; |
| 19 if (destinationInfo.printerOptions) { | 20 if (destinationInfo.printerOptions) { |
| 20 // Convert options into cloud print tags format. | 21 // Convert options into cloud print tags format. |
| 21 options.tags = Object.keys(destinationInfo.printerOptions).map( | 22 options.tags = Object.keys(destinationInfo.printerOptions).map( |
| 22 function(key) {return '__cp__' + key + '=' + this[key];}, | 23 function(key) {return '__cp__' + key + '=' + this[key];}, |
| 23 destinationInfo.printerOptions); | 24 destinationInfo.printerOptions); |
| 24 } | 25 } |
| 25 return new print_preview.Destination( | 26 return new print_preview.Destination( |
| 26 destinationInfo.deviceName, | 27 destinationInfo.deviceName, |
| 27 print_preview.Destination.Type.LOCAL, | 28 print_preview.Destination.Type.LOCAL, |
| 28 cr.isChromeOS ? print_preview.Destination.Origin.CROS : | 29 cr.isChromeOS ? print_preview.Destination.Origin.CROS : |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 provisionalType: provisionalType}); | 95 provisionalType: provisionalType}); |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 // Export | 98 // Export |
| 98 return { | 99 return { |
| 99 LocalDestinationParser: LocalDestinationParser, | 100 LocalDestinationParser: LocalDestinationParser, |
| 100 PrivetDestinationParser: PrivetDestinationParser, | 101 PrivetDestinationParser: PrivetDestinationParser, |
| 101 ExtensionDestinationParser: ExtensionDestinationParser | 102 ExtensionDestinationParser: ExtensionDestinationParser |
| 102 }; | 103 }; |
| 103 }); | 104 }); |
| OLD | NEW |