| 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 {!print_preview.LocalDestinationInfo} destinationInfo Information |
| 14 * destination. | 14 * describing a local print 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 isEnterprisePrinter: destinationInfo.cupsEnterprisePrinter}; |
| 20 if (destinationInfo.printerOptions) { | 20 if (destinationInfo.printerOptions) { |
| 21 // Convert options into cloud print tags format. | 21 // Convert options into cloud print tags format. |
| 22 options.tags = Object.keys(destinationInfo.printerOptions).map( | 22 options.tags = Object.keys(destinationInfo.printerOptions).map( |
| 23 function(key) {return '__cp__' + key + '=' + this[key];}, | 23 function(key) {return '__cp__' + key + '=' + this[key];}, |
| 24 destinationInfo.printerOptions); | 24 destinationInfo.printerOptions); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 provisionalType: provisionalType}); | 95 provisionalType: provisionalType}); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 // Export | 98 // Export |
| 99 return { | 99 return { |
| 100 LocalDestinationParser: LocalDestinationParser, | 100 LocalDestinationParser: LocalDestinationParser, |
| 101 PrivetDestinationParser: PrivetDestinationParser, | 101 PrivetDestinationParser: PrivetDestinationParser, |
| 102 ExtensionDestinationParser: ExtensionDestinationParser | 102 ExtensionDestinationParser: ExtensionDestinationParser |
| 103 }; | 103 }; |
| 104 }); | 104 }); |
| OLD | NEW |