| 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 * VolumeManager is responsible for tracking list of mounted volumes. | 6 * VolumeManager is responsible for tracking list of mounted volumes. |
| 7 * | 7 * |
| 8 * @constructor | 8 * @constructor |
| 9 * @extends {cr.EventTarget} | 9 * @extends {cr.EventTarget} |
| 10 */ | 10 */ |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 * drive ready to operate. | 246 * drive ready to operate. |
| 247 * | 247 * |
| 248 * @param {string} mountPath Drive mount path. | 248 * @param {string} mountPath Drive mount path. |
| 249 * @param {function(boolean, FileError=)} callback To be called when waiting | 249 * @param {function(boolean, FileError=)} callback To be called when waiting |
| 250 * finishes. If the case of error, there may be a FileError parameter. | 250 * finishes. If the case of error, there may be a FileError parameter. |
| 251 * @private | 251 * @private |
| 252 */ | 252 */ |
| 253 VolumeManager.prototype.waitDriveLoaded_ = function(mountPath, callback) { | 253 VolumeManager.prototype.waitDriveLoaded_ = function(mountPath, callback) { |
| 254 chrome.fileBrowserPrivate.requestLocalFileSystem(function(filesystem) { | 254 chrome.fileBrowserPrivate.requestLocalFileSystem(function(filesystem) { |
| 255 filesystem.root.getDirectory(mountPath, {}, | 255 filesystem.root.getDirectory(mountPath, {}, |
| 256 callback.bind(null, true), | 256 function(entry) { |
| 257 // After introducion of the 'fast-fetch' feature, getting the root |
| 258 // entry does not start fetching data. Rather, it starts when the |
| 259 // entry is read. |
| 260 entry.createReader().readEntries( |
| 261 callback.bind(null, true), |
| 262 callback.bind(null, false)); |
| 263 }, |
| 257 callback.bind(null, false)); | 264 callback.bind(null, false)); |
| 258 }); | 265 }); |
| 259 }; | 266 }; |
| 260 | 267 |
| 261 /** | 268 /** |
| 262 * @param {string} mountPath Path to the volume. | 269 * @param {string} mountPath Path to the volume. |
| 263 * @param {VolumeManager?} error Mounting error if any. | 270 * @param {VolumeManager?} error Mounting error if any. |
| 264 * @param {function(Object)} callback Result acceptor. | 271 * @param {function(Object)} callback Result acceptor. |
| 265 * @private | 272 * @private |
| 266 */ | 273 */ |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 /** | 525 /** |
| 519 * @param {string} mountPath Mount path. | 526 * @param {string} mountPath Mount path. |
| 520 * @private | 527 * @private |
| 521 */ | 528 */ |
| 522 VolumeManager.prototype.validateMountPath_ = function(mountPath) { | 529 VolumeManager.prototype.validateMountPath_ = function(mountPath) { |
| 523 console.log(mountPath); | 530 console.log(mountPath); |
| 524 if (!/^\/(drive|drive_offline|Downloads)$/.test(mountPath) && | 531 if (!/^\/(drive|drive_offline|Downloads)$/.test(mountPath) && |
| 525 !/^\/((archive|removable|drive)\/[^\/]+)$/.test(mountPath)) | 532 !/^\/((archive|removable|drive)\/[^\/]+)$/.test(mountPath)) |
| 526 throw new Error('Invalid mount path: ', mountPath); | 533 throw new Error('Invalid mount path: ', mountPath); |
| 527 }; | 534 }; |
| OLD | NEW |