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

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

Issue 1144983002: Introduce concept of provisional destinations to print preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 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
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 function ExtensionDestinationParser() {} 69 function ExtensionDestinationParser() {}
70 70
71 /** 71 /**
72 * Parses an extension destination from an extension supplied printer 72 * Parses an extension destination from an extension supplied printer
73 * description. 73 * description.
74 * @param {!Object} destinationInfo Object describing an extension printer. 74 * @param {!Object} destinationInfo Object describing an extension printer.
75 * @return {!print_preview.Destination} Parsed destination. 75 * @return {!print_preview.Destination} Parsed destination.
76 */ 76 */
77 ExtensionDestinationParser.parse = function(destinationInfo) { 77 ExtensionDestinationParser.parse = function(destinationInfo) {
78 var provisionalType =
79 destinationInfo.provisional ?
80 print_preview.Destination.ProvisionalType.NEEDS_USB_PERMISSION :
81 print_preview.Destination.ProvisionalType.NONE;
82
78 return new print_preview.Destination( 83 return new print_preview.Destination(
79 destinationInfo.id, 84 destinationInfo.id,
80 print_preview.Destination.Type.LOCAL, 85 print_preview.Destination.Type.LOCAL,
81 print_preview.Destination.Origin.EXTENSION, 86 print_preview.Destination.Origin.EXTENSION,
82 destinationInfo.name, 87 destinationInfo.name,
83 false /* isRecent */, 88 false /* isRecent */,
84 print_preview.Destination.ConnectionStatus.ONLINE, 89 print_preview.Destination.ConnectionStatus.ONLINE,
85 {description: destinationInfo.description || '', 90 {description: destinationInfo.description || '',
86 extensionId: destinationInfo.extensionId, 91 extensionId: destinationInfo.extensionId,
87 extensionName: destinationInfo.extensionName || ''}); 92 extensionName: destinationInfo.extensionName || '',
93 provisionalType: provisionalType});
88 }; 94 };
89 95
90 // Export 96 // Export
91 return { 97 return {
92 LocalDestinationParser: LocalDestinationParser, 98 LocalDestinationParser: LocalDestinationParser,
93 PrivetDestinationParser: PrivetDestinationParser, 99 PrivetDestinationParser: PrivetDestinationParser,
94 ExtensionDestinationParser: ExtensionDestinationParser 100 ExtensionDestinationParser: ExtensionDestinationParser
95 }; 101 };
96 }); 102 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698