Index: chrome/browser/resources/print_preview/data/local_parsers.js |
diff --git a/chrome/browser/resources/print_preview/data/local_parsers.js b/chrome/browser/resources/print_preview/data/local_parsers.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1f88096e7d1e63a96af5c8e86a0d0c07571034c1 |
--- /dev/null |
+++ b/chrome/browser/resources/print_preview/data/local_parsers.js |
@@ -0,0 +1,63 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+cr.define('print_preview', function() { |
+ 'use strict'; |
+ |
+ function LocalDestinationParser() {}; |
+ |
+ /** |
+ * @param {object} destinationInfo Information describing a local print |
+ * destination. |
+ * @return {print_preview.Destination} Parsed local print destination. |
+ */ |
+ LocalDestinationParser.parse = function(destinationInfo) { |
+ return new print_preview.Destination( |
+ destinationInfo.deviceName, |
+ destinationInfo.printerName, |
+ false /*isRecent*/, |
+ true /*isLocal*/, |
+ // TODO Internationalize |
+ [print_preview.Destination.LOCATION_TAG_PREFIX + 'Local system']); |
+ }; |
+ |
+ function LocalCapabilitiesParser() {}; |
+ |
+ LocalCapabilitiesParser.parse = function(settingsInfo) { |
+ var caps = new print_preview.ChromiumCapabilities(); |
+ |
+ if (caps.hasColorCapability = !settingsInfo['disableColorOption']) { |
+ caps.defaultIsColorEnabled = settingsInfo['setColorAsDefault']; |
+ } |
+ |
+ if (caps.hasDuplexCapability = |
+ settingsInfo['printerDefaultDuplexValue'] != |
+ print_preview.ChromiumCapabilities.DuplexMode.UNKNOWN_DUPLEX_MODE) { |
+ caps.defaultIsDuplexEnabled = |
+ settingsInfo['printerDefaultDuplexValue'] == |
+ print_preview.ChromiumCapabilities.DuplexMode.LONG_EDGE; |
+ } |
+ |
+ caps.hasPageRangeCapability = true; |
+ caps.defaultPageRangeStr = ''; |
+ caps.hasCopiesCapability = true; |
+ caps.defaultCopiesStr = '1'; |
+ caps.hasCollateCapability = true; |
+ caps.defaultIsCollateEnabled = false; |
+ caps.hasOrientationCapability = true; |
+ caps.defaultIsLandscapeEnabled = false; |
+ caps.hasMarginsCapability = true; |
+ caps.defaultMarginsType = print_preview.Margins.Type.DEFAULT; |
+ caps.hasHeaderFooterCapability = true; |
+ caps.defaultIsHeaderFooterEnabled = true; |
+ |
+ return caps; |
+ }; |
+ |
+ // Export |
+ return { |
+ LocalCapabilitiesParser: LocalCapabilitiesParser, |
+ LocalDestinationParser: LocalDestinationParser |
+ }; |
+}); |