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

Side by Side Diff: chrome/browser/resources/print_preview/data/local_parsers.js

Issue 2606043004: Perform printer setup on Chrome OS before selecting printer. (Closed)
Patch Set: fix nits Created 3 years, 11 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
OLDNEW
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 {!Object} destinationInfo Information describing a local print
14 * destination. 14 * 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 if (destinationInfo.printerOptions) { 19 if (destinationInfo.printerOptions) {
20 // Convert options into cloud print tags format. 20 // Convert options into cloud print tags format.
21 options.tags = Object.keys(destinationInfo.printerOptions).map( 21 options.tags = Object.keys(destinationInfo.printerOptions).map(
22 function(key) {return '__cp__' + key + '=' + this[key];}, 22 function(key) {return '__cp__' + key + '=' + this[key];},
23 destinationInfo.printerOptions); 23 destinationInfo.printerOptions);
24 } 24 }
25 return new print_preview.Destination( 25 return new print_preview.Destination(
26 destinationInfo.deviceName, 26 destinationInfo.deviceName,
27 print_preview.Destination.Type.LOCAL, 27 print_preview.Destination.Type.LOCAL,
28 print_preview.Destination.Origin.LOCAL, 28 cr.isChromeOS ? print_preview.Destination.Origin.CROS :
29 print_preview.Destination.Origin.LOCAL,
29 destinationInfo.printerName, 30 destinationInfo.printerName,
30 false /*isRecent*/, 31 false /*isRecent*/,
31 print_preview.Destination.ConnectionStatus.ONLINE, 32 print_preview.Destination.ConnectionStatus.ONLINE,
32 options); 33 options);
33 }; 34 };
34 35
35 function PrivetDestinationParser() {} 36 function PrivetDestinationParser() {}
36 37
37 /** 38 /**
38 * Parses a privet destination as one or more local printers. 39 * Parses a privet destination as one or more local printers.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 provisionalType: provisionalType}); 94 provisionalType: provisionalType});
94 }; 95 };
95 96
96 // Export 97 // Export
97 return { 98 return {
98 LocalDestinationParser: LocalDestinationParser, 99 LocalDestinationParser: LocalDestinationParser,
99 PrivetDestinationParser: PrivetDestinationParser, 100 PrivetDestinationParser: PrivetDestinationParser,
100 ExtensionDestinationParser: ExtensionDestinationParser 101 ExtensionDestinationParser: ExtensionDestinationParser
101 }; 102 };
102 }); 103 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698