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 /** | 8 /** |
9 * Print destination data object that holds data for both local and cloud | 9 * Print destination data object that holds data for both local and cloud |
10 * destinations. | 10 * destinations. |
11 * @param {string} id ID of the destination. | 11 * @param {string} id ID of the destination. |
12 * @param {!print_preview.Destination.Type} type Type of the destination. | 12 * @param {!print_preview.Destination.Type} type Type of the destination. |
13 * @param {!print_preview.Destination.AuthType} authType Type of the | 13 * @param {!print_preview.Destination.Origin} origin Origin of the |
14 * authentication used to access the destination. | 14 * destination. |
15 * @param {string} displayName Display name of the destination. | 15 * @param {string} displayName Display name of the destination. |
16 * @param {boolean} isRecent Whether the destination has been used recently. | 16 * @param {boolean} isRecent Whether the destination has been used recently. |
17 * @param {!print_preview.Destination.ConnectionStatus} connectionStatus | 17 * @param {!print_preview.Destination.ConnectionStatus} connectionStatus |
18 * Connection status of the print destination. | 18 * Connection status of the print destination. |
19 * @param {{tags: Array.<string>, | 19 * @param {{tags: Array.<string>, |
20 * isOwned: ?boolean, | 20 * isOwned: ?boolean, |
21 * lastAccessTime: ?number, | 21 * lastAccessTime: ?number, |
22 * isTosAccepted: ?boolean}=} opt_params Optional parameters for the | 22 * isTosAccepted: ?boolean}=} opt_params Optional parameters for the |
23 * destination. | 23 * destination. |
24 * @constructor | 24 * @constructor |
25 */ | 25 */ |
26 function Destination(id, type, authType, displayName, isRecent, | 26 function Destination(id, type, origin, displayName, isRecent, |
27 connectionStatus, opt_params) { | 27 connectionStatus, opt_params) { |
28 /** | 28 /** |
29 * ID of the destination. | 29 * ID of the destination. |
30 * @type {string} | 30 * @type {string} |
31 * @private | 31 * @private |
32 */ | 32 */ |
33 this.id_ = id; | 33 this.id_ = id; |
34 | 34 |
35 /** | 35 /** |
36 * Type of the destination. | 36 * Type of the destination. |
37 * @type {!print_preview.Destination.Type} | 37 * @type {!print_preview.Destination.Type} |
38 * @private | 38 * @private |
39 */ | 39 */ |
40 this.type_ = type; | 40 this.type_ = type; |
41 | 41 |
42 /** | 42 /** |
43 * Type of authentication for the destination. | 43 * Origin of the destination. |
44 * @type {!print_preview.Destination.AuthType} | 44 * @type {!print_preview.Destination.Origin} |
45 * @private | 45 * @private |
46 */ | 46 */ |
47 this.authType_ = authType; | 47 this.origin_ = origin; |
48 | 48 |
49 /** | 49 /** |
50 * Display name of the destination. | 50 * Display name of the destination. |
51 * @type {string} | 51 * @type {string} |
52 * @private | 52 * @private |
53 */ | 53 */ |
54 this.displayName_ = displayName; | 54 this.displayName_ = displayName; |
55 | 55 |
56 /** | 56 /** |
57 * Whether the destination has been used recently. | 57 * Whether the destination has been used recently. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 * Enumeration of the types of destinations. | 135 * Enumeration of the types of destinations. |
136 * @enum {string} | 136 * @enum {string} |
137 */ | 137 */ |
138 Destination.Type = { | 138 Destination.Type = { |
139 GOOGLE: 'google', | 139 GOOGLE: 'google', |
140 LOCAL: 'local', | 140 LOCAL: 'local', |
141 MOBILE: 'mobile' | 141 MOBILE: 'mobile' |
142 }; | 142 }; |
143 | 143 |
144 /** | 144 /** |
145 * Enumeration of the authentication types for cloud destinations. | 145 * Enumeration of the origin types for cloud destinations. |
146 * @enum {string} | 146 * @enum {string} |
147 */ | 147 */ |
148 Destination.AuthType = { | 148 Destination.Origin = { |
149 LOCAL: 'local', | 149 LOCAL: 'local', |
150 COOKIES: 'cookies', | 150 COOKIES: 'cookies', |
151 PROFILE: 'profile', | 151 PROFILE: 'profile', |
152 DEVICE: 'device' | 152 DEVICE: 'device' |
153 }; | 153 }; |
154 | 154 |
155 /** | 155 /** |
156 * Enumeration of the connection statuses of printer destinations. | 156 * Enumeration of the connection statuses of printer destinations. |
157 * @enum {string} | 157 * @enum {string} |
158 */ | 158 */ |
(...skipping 26 matching lines...) Expand all Loading... |
185 get id() { | 185 get id() { |
186 return this.id_; | 186 return this.id_; |
187 }, | 187 }, |
188 | 188 |
189 /** @return {!print_preview.Destination.Type} Type of the destination. */ | 189 /** @return {!print_preview.Destination.Type} Type of the destination. */ |
190 get type() { | 190 get type() { |
191 return this.type_; | 191 return this.type_; |
192 }, | 192 }, |
193 | 193 |
194 /** | 194 /** |
195 * @return {!print_preview.Destination.AuthType} Type of authentication for | 195 * @return {!print_preview.Destination.Origin} Origin of the destination. |
196 * the destination. | |
197 */ | 196 */ |
198 get authType() { | 197 get origin() { |
199 return this.authType_; | 198 return this.origin_; |
200 }, | 199 }, |
201 | 200 |
202 /** @return {string} Display name of the destination. */ | 201 /** @return {string} Display name of the destination. */ |
203 get displayName() { | 202 get displayName() { |
204 return this.displayName_; | 203 return this.displayName_; |
205 }, | 204 }, |
206 | 205 |
207 /** @return {boolean} Whether the destination has been used recently. */ | 206 /** @return {boolean} Whether the destination has been used recently. */ |
208 get isRecent() { | 207 get isRecent() { |
209 return this.isRecent_; | 208 return this.isRecent_; |
210 }, | 209 }, |
211 | 210 |
212 /** | 211 /** |
213 * @param {boolean} isRecent Whether the destination has been used recently. | 212 * @param {boolean} isRecent Whether the destination has been used recently. |
214 */ | 213 */ |
215 set isRecent(isRecent) { | 214 set isRecent(isRecent) { |
216 this.isRecent_ = isRecent; | 215 this.isRecent_ = isRecent; |
217 }, | 216 }, |
218 | 217 |
219 /** | 218 /** |
220 * @return {boolean} Whether the user owns the destination. Only applies to | 219 * @return {boolean} Whether the user owns the destination. Only applies to |
221 * cloud-based destinations. | 220 * cloud-based destinations. |
222 */ | 221 */ |
223 get isOwned() { | 222 get isOwned() { |
224 return this.isOwned_; | 223 return this.isOwned_; |
225 }, | 224 }, |
226 | 225 |
227 /** @return {boolean} Whether the destination is local or cloud-based. */ | 226 /** @return {boolean} Whether the destination is local or cloud-based. */ |
228 get isLocal() { | 227 get isLocal() { |
229 return this.type_ == Destination.Type.LOCAL; | 228 return this.origin_ == Destination.Origin.LOCAL; |
230 }, | 229 }, |
231 | 230 |
232 /** | 231 /** |
233 * @return {string} The location of the destination, or an empty string if | 232 * @return {string} The location of the destination, or an empty string if |
234 * the location is unknown. | 233 * the location is unknown. |
235 */ | 234 */ |
236 get location() { | 235 get location() { |
237 if (this.location_ == null) { | 236 if (this.location_ == null) { |
238 for (var tag, i = 0; tag = this.tags_[i]; i++) { | 237 for (var tag, i = 0; tag = this.tags_[i]; i++) { |
239 if (tag.indexOf(Destination.LOCATION_TAG_PREFIX) == 0) { | 238 if (tag.indexOf(Destination.LOCATION_TAG_PREFIX) == 0) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 * }} | 364 * }} |
366 */ | 365 */ |
367 var Cdd = Object; | 366 var Cdd = Object; |
368 | 367 |
369 // Export | 368 // Export |
370 return { | 369 return { |
371 Destination: Destination, | 370 Destination: Destination, |
372 Cdd: Cdd | 371 Cdd: Cdd |
373 }; | 372 }; |
374 }); | 373 }); |
OLD | NEW |