OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 return returnedPrinters; | 69 return returnedPrinters; |
70 }; | 70 }; |
71 | 71 |
72 function ExtensionDestinationParser() {} | 72 function ExtensionDestinationParser() {} |
73 | 73 |
74 /** | 74 /** |
75 * Parses an extension destination from an extension supplied printer | 75 * Parses an extension destination from an extension supplied printer |
76 * description. | 76 * description. |
77 * @param {!Object} destinationInfo Object describing an extension printer. | 77 * @param {!print_preview.ProvisionalDestinationInfo} destinationInfo Object |
| 78 * describing an extension printer. |
78 * @return {!print_preview.Destination} Parsed destination. | 79 * @return {!print_preview.Destination} Parsed destination. |
79 */ | 80 */ |
80 ExtensionDestinationParser.parse = function(destinationInfo) { | 81 ExtensionDestinationParser.parse = function(destinationInfo) { |
81 var provisionalType = | 82 var provisionalType = |
82 destinationInfo.provisional ? | 83 destinationInfo.provisional ? |
83 print_preview.DestinationProvisionalType.NEEDS_USB_PERMISSION : | 84 print_preview.DestinationProvisionalType.NEEDS_USB_PERMISSION : |
84 print_preview.DestinationProvisionalType.NONE; | 85 print_preview.DestinationProvisionalType.NONE; |
85 | 86 |
86 return new print_preview.Destination( | 87 return new print_preview.Destination( |
87 destinationInfo.id, | 88 destinationInfo.id, |
88 print_preview.DestinationType.LOCAL, | 89 print_preview.DestinationType.LOCAL, |
89 print_preview.DestinationOrigin.EXTENSION, | 90 print_preview.DestinationOrigin.EXTENSION, |
90 destinationInfo.name, | 91 destinationInfo.name, |
91 false /* isRecent */, | 92 false /* isRecent */, |
92 print_preview.DestinationConnectionStatus.ONLINE, | 93 print_preview.DestinationConnectionStatus.ONLINE, |
93 {description: destinationInfo.description || '', | 94 {description: destinationInfo.description || '', |
94 extensionId: destinationInfo.extensionId, | 95 extensionId: destinationInfo.extensionId, |
95 extensionName: destinationInfo.extensionName || '', | 96 extensionName: destinationInfo.extensionName || '', |
96 provisionalType: provisionalType}); | 97 provisionalType: provisionalType}); |
97 }; | 98 }; |
98 | 99 |
99 // Export | 100 // Export |
100 return { | 101 return { |
101 LocalDestinationParser: LocalDestinationParser, | 102 LocalDestinationParser: LocalDestinationParser, |
102 PrivetDestinationParser: PrivetDestinationParser, | 103 PrivetDestinationParser: PrivetDestinationParser, |
103 ExtensionDestinationParser: ExtensionDestinationParser | 104 ExtensionDestinationParser: ExtensionDestinationParser |
104 }; | 105 }; |
105 }); | 106 }); |
OLD | NEW |