OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('print_preview', function() { |
| 6 'use strict'; |
| 7 |
| 8 function LocalDestinationParser() {}; |
| 9 |
| 10 /** |
| 11 * @param {object} destinationInfo Information describing a local print |
| 12 * destination. |
| 13 * @return {print_preview.Destination} Parsed local print destination. |
| 14 */ |
| 15 LocalDestinationParser.parse = function(destinationInfo) { |
| 16 return new print_preview.Destination( |
| 17 destinationInfo.deviceName, |
| 18 destinationInfo.printerName, |
| 19 false /*isRecent*/, |
| 20 true /*isLocal*/, |
| 21 // TODO Internationalize |
| 22 [print_preview.Destination.LOCATION_TAG_PREFIX + 'Local system']); |
| 23 }; |
| 24 |
| 25 function LocalCapabilitiesParser() {}; |
| 26 |
| 27 LocalCapabilitiesParser.parse = function(settingsInfo) { |
| 28 var caps = new print_preview.ChromiumCapabilities(); |
| 29 |
| 30 if (caps.hasColorCapability = !settingsInfo['disableColorOption']) { |
| 31 caps.defaultIsColorEnabled = settingsInfo['setColorAsDefault']; |
| 32 } |
| 33 |
| 34 if (caps.hasDuplexCapability = |
| 35 settingsInfo['printerDefaultDuplexValue'] != |
| 36 print_preview.ChromiumCapabilities.DuplexMode.UNKNOWN_DUPLEX_MODE) { |
| 37 caps.defaultIsDuplexEnabled = |
| 38 settingsInfo['printerDefaultDuplexValue'] == |
| 39 print_preview.ChromiumCapabilities.DuplexMode.LONG_EDGE; |
| 40 } |
| 41 |
| 42 caps.hasPageRangeCapability = true; |
| 43 caps.defaultPageRangeStr = ''; |
| 44 caps.hasCopiesCapability = true; |
| 45 caps.defaultCopiesStr = '1'; |
| 46 caps.hasCollateCapability = true; |
| 47 caps.defaultIsCollateEnabled = false; |
| 48 caps.hasOrientationCapability = true; |
| 49 caps.defaultIsLandscapeEnabled = false; |
| 50 caps.hasMarginsCapability = true; |
| 51 caps.defaultMarginsType = print_preview.Margins.Type.DEFAULT; |
| 52 caps.hasHeaderFooterCapability = true; |
| 53 caps.defaultIsHeaderFooterEnabled = true; |
| 54 |
| 55 return caps; |
| 56 }; |
| 57 |
| 58 // Export |
| 59 return { |
| 60 LocalCapabilitiesParser: LocalCapabilitiesParser, |
| 61 LocalDestinationParser: LocalDestinationParser |
| 62 }; |
| 63 }); |
OLD | NEW |