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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 hasColorCapability = false;
29 var defaultIsColorEnabled = false;
30 if (hasColorCapability = !settingsInfo['disableColorOption']) {
31 defaultIsColorEnabled = settingsInfo['setColorAsDefault'];
32 }
33
34 var hasDuplexCapability = false;
35 var defaultIsDuplexEnabled = false;
36 if (hasDuplexCapability =
37 settingsInfo['printerDefaultDuplexValue'] !=
38 print_preview.NativeLayer.DuplexMode.UNKNOWN_DUPLEX_MODE) {
39 defaultIsDuplexEnabled =
40 settingsInfo['printerDefaultDuplexValue'] ==
41 print_preview.NativeLayer.DuplexMode.LONG_EDGE;
42 }
43
44 return new print_preview.ChromiumCapabilities(
45 true /*hasCopiesCapability*/,
46 '1' /*defaultCopiesStr*/,
47 true /*hasCollateCapability*/,
48 true /*defaultIsCollateEnabled*/,
49 hasDuplexCapability,
50 defaultIsDuplexEnabled,
51 true /*hasOrientationCapability*/,
52 false /*defaultIsLandscapeEnabled*/,
53 hasColorCapability,
54 defaultIsColorEnabled);
55 };
56
57 // Export
58 return {
59 LocalCapabilitiesParser: LocalCapabilitiesParser,
60 LocalDestinationParser: LocalDestinationParser
61 };
62 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698