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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 print_preview.Destination.Type.GOOGLE, | 59 print_preview.Destination.Type.GOOGLE, |
60 print_preview.Destination.Origin.PRIVET, | 60 print_preview.Destination.Origin.PRIVET, |
61 destinationInfo.name, | 61 destinationInfo.name, |
62 false /*isRecent*/, | 62 false /*isRecent*/, |
63 print_preview.Destination.ConnectionStatus.UNREGISTERED)); | 63 print_preview.Destination.ConnectionStatus.UNREGISTERED)); |
64 } | 64 } |
65 | 65 |
66 return returnedPrinters; | 66 return returnedPrinters; |
67 }; | 67 }; |
68 | 68 |
| 69 function ExtensionDestinationParser() {} |
| 70 |
| 71 /** |
| 72 * Parses an extension destination from an extension supplied printer |
| 73 * description. |
| 74 * @param {!Object} destinationInfo Object describing an extension printer. |
| 75 * @return {!print_preview.Destination} Parsed destination. |
| 76 */ |
| 77 ExtensionDestinationParser.parse = function(destinationInfo) { |
| 78 return new print_preview.Destination( |
| 79 destinationInfo.id, |
| 80 print_preview.Destination.Type.LOCAL, |
| 81 print_preview.Destination.Origin.EXTENSION, |
| 82 destinationInfo.name, |
| 83 false /* isRecent */, |
| 84 print_preview.Destination.ConnectionStatus.ONLINE, |
| 85 {description: destinationInfo.description || '', |
| 86 extensionId: destinationInfo.extensionId}); |
| 87 }; |
| 88 |
69 // Export | 89 // Export |
70 return { | 90 return { |
71 LocalDestinationParser: LocalDestinationParser, | 91 LocalDestinationParser: LocalDestinationParser, |
72 PrivetDestinationParser: PrivetDestinationParser | 92 PrivetDestinationParser: PrivetDestinationParser, |
| 93 ExtensionDestinationParser: ExtensionDestinationParser |
73 }; | 94 }; |
74 }); | 95 }); |
OLD | NEW |