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

Unified Diff: chrome/browser/resources/print_preview/data/local_parsers.js

Issue 10108001: Refactor print preview web ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
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..310ea0b60644531107bf0a174c319f650b1e32ca
--- /dev/null
+++ b/chrome/browser/resources/print_preview/data/local_parsers.js
@@ -0,0 +1,62 @@
+// 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 hasColorCapability = false;
+ var defaultIsColorEnabled = false;
+ if (hasColorCapability = !settingsInfo['disableColorOption']) {
+ defaultIsColorEnabled = settingsInfo['setColorAsDefault'];
+ }
+
+ var hasDuplexCapability = false;
+ var defaultIsDuplexEnabled = false;
+ if (hasDuplexCapability =
+ settingsInfo['printerDefaultDuplexValue'] !=
+ print_preview.NativeLayer.DuplexMode.UNKNOWN_DUPLEX_MODE) {
+ defaultIsDuplexEnabled =
+ settingsInfo['printerDefaultDuplexValue'] ==
+ print_preview.NativeLayer.DuplexMode.LONG_EDGE;
+ }
+
+ return new print_preview.ChromiumCapabilities(
+ true /*hasCopiesCapability*/,
+ '1' /*defaultCopiesStr*/,
+ true /*hasCollateCapability*/,
+ true /*defaultIsCollateEnabled*/,
+ hasDuplexCapability,
+ defaultIsDuplexEnabled,
+ true /*hasOrientationCapability*/,
+ false /*defaultIsLandscapeEnabled*/,
+ hasColorCapability,
+ defaultIsColorEnabled);
+ };
+
+ // Export
+ return {
+ LocalCapabilitiesParser: LocalCapabilitiesParser,
+ LocalDestinationParser: LocalDestinationParser
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698