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 /** | 5 /** |
6 * Represents each volume, such as "drive", "download directory", each "USB | 6 * Represents each volume, such as "drive", "download directory", each "USB |
7 * flush storage", or "mounted zip archive" etc. | 7 * flush storage", or "mounted zip archive" etc. |
8 * | 8 * |
9 * @constructor | 9 * @constructor |
10 * @struct | 10 * @struct |
(...skipping 24 matching lines...) Expand all Loading... |
35 fileSystem, | 35 fileSystem, |
36 error, | 36 error, |
37 deviceType, | 37 deviceType, |
38 devicePath, | 38 devicePath, |
39 isReadOnly, | 39 isReadOnly, |
40 profile, | 40 profile, |
41 label, | 41 label, |
42 extensionId, | 42 extensionId, |
43 hasMedia, | 43 hasMedia, |
44 configurable, | 44 configurable, |
| 45 watchable, |
45 source) { | 46 source) { |
46 this.volumeType_ = volumeType; | 47 this.volumeType_ = volumeType; |
47 this.volumeId_ = volumeId; | 48 this.volumeId_ = volumeId; |
48 this.fileSystem_ = fileSystem; | 49 this.fileSystem_ = fileSystem; |
49 this.label_ = label; | 50 this.label_ = label; |
50 this.displayRoot_ = null; | 51 this.displayRoot_ = null; |
51 | 52 |
52 /** @type {Object<!FakeEntry>} */ | 53 /** @type {Object<!FakeEntry>} */ |
53 this.fakeEntries_ = {}; | 54 this.fakeEntries_ = {}; |
54 | 55 |
(...skipping 23 matching lines...) Expand all Loading... |
78 // or not. (If error is empty string, the mount is successfully done). | 79 // or not. (If error is empty string, the mount is successfully done). |
79 // TODO(hidehiko): Rename to make this more understandable. | 80 // TODO(hidehiko): Rename to make this more understandable. |
80 this.error_ = error; | 81 this.error_ = error; |
81 this.deviceType_ = deviceType; | 82 this.deviceType_ = deviceType; |
82 this.devicePath_ = devicePath; | 83 this.devicePath_ = devicePath; |
83 this.isReadOnly_ = isReadOnly; | 84 this.isReadOnly_ = isReadOnly; |
84 this.profile_ = Object.freeze(profile); | 85 this.profile_ = Object.freeze(profile); |
85 this.extensionId_ = extensionId; | 86 this.extensionId_ = extensionId; |
86 this.hasMedia_ = hasMedia; | 87 this.hasMedia_ = hasMedia; |
87 this.configurable_ = configurable; | 88 this.configurable_ = configurable; |
| 89 this.watchable_ = watchable; |
88 this.source_ = source; | 90 this.source_ = source; |
89 } | 91 } |
90 | 92 |
91 VolumeInfo.prototype = /** @struct */ { | 93 VolumeInfo.prototype = /** @struct */ { |
92 /** | 94 /** |
93 * @return {VolumeManagerCommon.VolumeType} Volume type. | 95 * @return {VolumeManagerCommon.VolumeType} Volume type. |
94 */ | 96 */ |
95 get volumeType() { | 97 get volumeType() { |
96 return this.volumeType_; | 98 return this.volumeType_; |
97 }, | 99 }, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 get hasMedia() { | 170 get hasMedia() { |
169 return this.hasMedia_; | 171 return this.hasMedia_; |
170 }, | 172 }, |
171 /** | 173 /** |
172 * @return {boolean} True if the volume is configurable. | 174 * @return {boolean} True if the volume is configurable. |
173 */ | 175 */ |
174 get configurable() { | 176 get configurable() { |
175 return this.configurable_; | 177 return this.configurable_; |
176 }, | 178 }, |
177 /** | 179 /** |
| 180 * @return {boolean} True if the volume is watchable. |
| 181 */ |
| 182 get watchable() { |
| 183 return this.watchable_; |
| 184 }, |
| 185 /** |
178 * @return {VolumeManagerCommon.Source} Source of the volume's data. | 186 * @return {VolumeManagerCommon.Source} Source of the volume's data. |
179 */ | 187 */ |
180 get source() { | 188 get source() { |
181 return this.source_; | 189 return this.source_; |
182 } | 190 } |
183 }; | 191 }; |
184 | 192 |
185 /** | 193 /** |
186 * Starts resolving the display root and obtains it. It may take long time for | 194 * Starts resolving the display root and obtains it. It may take long time for |
187 * Drive. Once resolved, it is cached. | 195 * Drive. Once resolved, it is cached. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 fileSystem, | 334 fileSystem, |
327 volumeMetadata.mountCondition, | 335 volumeMetadata.mountCondition, |
328 volumeMetadata.deviceType, | 336 volumeMetadata.deviceType, |
329 volumeMetadata.devicePath, | 337 volumeMetadata.devicePath, |
330 volumeMetadata.isReadOnly, | 338 volumeMetadata.isReadOnly, |
331 volumeMetadata.profile, | 339 volumeMetadata.profile, |
332 localizedLabel, | 340 localizedLabel, |
333 volumeMetadata.extensionId, | 341 volumeMetadata.extensionId, |
334 volumeMetadata.hasMedia, | 342 volumeMetadata.hasMedia, |
335 volumeMetadata.configurable, | 343 volumeMetadata.configurable, |
| 344 volumeMetadata.watchable, |
336 /** @type {VolumeManagerCommon.Source} */ | 345 /** @type {VolumeManagerCommon.Source} */ |
337 (volumeMetadata.source)); | 346 (volumeMetadata.source)); |
338 }) | 347 }) |
339 .catch( | 348 .catch( |
340 /** | 349 /** |
341 * @param {*} error | 350 * @param {*} error |
342 */ | 351 */ |
343 function(error) { | 352 function(error) { |
344 console.error('Failed to mount a file system: ' + | 353 console.error('Failed to mount a file system: ' + |
345 volumeMetadata.volumeId + ' because of: ' + | 354 volumeMetadata.volumeId + ' because of: ' + |
346 (error.stack || error)); | 355 (error.stack || error)); |
347 return new VolumeInfo( | 356 return new VolumeInfo( |
348 /** @type {VolumeManagerCommon.VolumeType} */ | 357 /** @type {VolumeManagerCommon.VolumeType} */ |
349 (volumeMetadata.volumeType), | 358 (volumeMetadata.volumeType), |
350 volumeMetadata.volumeId, | 359 volumeMetadata.volumeId, |
351 null, // File system is not found. | 360 null, // File system is not found. |
352 volumeMetadata.mountCondition, | 361 volumeMetadata.mountCondition, |
353 volumeMetadata.deviceType, | 362 volumeMetadata.deviceType, |
354 volumeMetadata.devicePath, | 363 volumeMetadata.devicePath, |
355 volumeMetadata.isReadOnly, | 364 volumeMetadata.isReadOnly, |
356 volumeMetadata.profile, | 365 volumeMetadata.profile, |
357 localizedLabel, | 366 localizedLabel, |
358 volumeMetadata.extensionId, | 367 volumeMetadata.extensionId, |
359 volumeMetadata.hasMedia, | 368 volumeMetadata.hasMedia, |
360 volumeMetadata.configurable, | 369 volumeMetadata.configurable, |
| 370 volumeMetadata.watchable, |
361 /** @type {VolumeManagerCommon.Source} */ | 371 /** @type {VolumeManagerCommon.Source} */ |
362 (volumeMetadata.source)); | 372 (volumeMetadata.source)); |
363 }); | 373 }); |
364 }; | 374 }; |
365 | 375 |
366 /** | 376 /** |
367 * The order of the volume list based on root type. | 377 * The order of the volume list based on root type. |
368 * @type {Array<VolumeManagerCommon.VolumeType>} | 378 * @type {Array<VolumeManagerCommon.VolumeType>} |
369 * @const | 379 * @const |
370 * @private | 380 * @private |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 this.isDriveBased; | 1130 this.isDriveBased; |
1121 | 1131 |
1122 /** | 1132 /** |
1123 * Whether the entry is read only or not. | 1133 * Whether the entry is read only or not. |
1124 * @type {boolean} | 1134 * @type {boolean} |
1125 */ | 1135 */ |
1126 this.isReadOnly = isReadOnly; | 1136 this.isReadOnly = isReadOnly; |
1127 | 1137 |
1128 Object.freeze(this); | 1138 Object.freeze(this); |
1129 } | 1139 } |
OLD | NEW |