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