| 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('cloudprint', function() { | 5 cr.define('cloudprint', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** Namespace which contains a method to parse cloud destinations directly. */ | 8 /** Namespace which contains a method to parse cloud destinations directly. */ |
| 9 function CloudDestinationParser() {}; | 9 function CloudDestinationParser() {}; |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 json[CloudDestinationParser.Field_.CONNECTION_STATUS] || | 72 json[CloudDestinationParser.Field_.CONNECTION_STATUS] || |
| 73 print_preview.Destination.ConnectionStatus.UNKNOWN; | 73 print_preview.Destination.ConnectionStatus.UNKNOWN; |
| 74 var optionalParams = { | 74 var optionalParams = { |
| 75 tags: tags, | 75 tags: tags, |
| 76 isOwned: arrayContains(tags, CloudDestinationParser.OWNED_TAG_), | 76 isOwned: arrayContains(tags, CloudDestinationParser.OWNED_TAG_), |
| 77 lastAccessTime: parseInt( | 77 lastAccessTime: parseInt( |
| 78 json[CloudDestinationParser.Field_.LAST_ACCESS], 10) || Date.now(), | 78 json[CloudDestinationParser.Field_.LAST_ACCESS], 10) || Date.now(), |
| 79 isTosAccepted: (id == print_preview.Destination.GooglePromotedId.FEDEX) ? | 79 isTosAccepted: (id == print_preview.Destination.GooglePromotedId.FEDEX) ? |
| 80 json[CloudDestinationParser.Field_.IS_TOS_ACCEPTED] : null | 80 json[CloudDestinationParser.Field_.IS_TOS_ACCEPTED] : null |
| 81 }; | 81 }; |
| 82 |
| 82 var cloudDest = new print_preview.Destination( | 83 var cloudDest = new print_preview.Destination( |
| 83 id, | 84 id, |
| 84 CloudDestinationParser.parseType_( | 85 print_preview.Destination.Type.LOCAL /*CloudDestinationParser.parseType_
( |
| 85 json[CloudDestinationParser.Field_.TYPE]), | 86 json[CloudDestinationParser.Field_.TYPE])*/, |
| 86 origin, | 87 origin, |
| 87 json[CloudDestinationParser.Field_.DISPLAY_NAME], | 88 json[CloudDestinationParser.Field_.DISPLAY_NAME], |
| 88 arrayContains(tags, CloudDestinationParser.RECENT_TAG_) /*isRecent*/, | 89 arrayContains(tags, CloudDestinationParser.RECENT_TAG_) /*isRecent*/, |
| 89 connectionStatus, | 90 connectionStatus, |
| 90 optionalParams); | 91 optionalParams); |
| 91 if (json.hasOwnProperty(CloudDestinationParser.Field_.CAPABILITIES)) { | 92 if (json.hasOwnProperty(CloudDestinationParser.Field_.CAPABILITIES)) { |
| 92 cloudDest.capabilities = /*@type {!print_preview.Cdd}*/ ( | 93 cloudDest.capabilities = /*@type {!print_preview.Cdd}*/ ( |
| 93 json[CloudDestinationParser.Field_.CAPABILITIES]); | 94 json[CloudDestinationParser.Field_.CAPABILITIES]); |
| 94 } | 95 } |
| 95 return cloudDest; | 96 return cloudDest; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 111 } else { | 112 } else { |
| 112 return print_preview.Destination.Type.GOOGLE; | 113 return print_preview.Destination.Type.GOOGLE; |
| 113 } | 114 } |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 // Export | 117 // Export |
| 117 return { | 118 return { |
| 118 CloudDestinationParser: CloudDestinationParser | 119 CloudDestinationParser: CloudDestinationParser |
| 119 }; | 120 }; |
| 120 }); | 121 }); |
| OLD | NEW |