Index: chrome/browser/resources/file_manager/js/volume_manager.js |
diff --git a/chrome/browser/resources/file_manager/js/volume_manager.js b/chrome/browser/resources/file_manager/js/volume_manager.js |
index 0a95574cc48fa4a95d090a5f3cec4728fd0fccec..fd9f0a94191215bd3f163913f491049779f493dc 100644 |
--- a/chrome/browser/resources/file_manager/js/volume_manager.js |
+++ b/chrome/browser/resources/file_manager/js/volume_manager.js |
@@ -115,6 +115,7 @@ VolumeManager.prototype.initMountPoints_ = function() { |
var mountedVolumes = []; |
var self = this; |
var index = 0; |
+ this.deferredQueue_ = []; |
function step(mountPoints) { |
if (index < mountPoints.length) { |
var info = mountPoints[index]; |
@@ -137,6 +138,12 @@ VolumeManager.prototype.initMountPoints_ = function() { |
chrome.fileBrowserPrivate.onMountCompleted.addListener( |
self.onMountCompleted_.bind(self)); |
+ var deferredQueue = self.deferredQueue_; |
+ self.deferredQueue_ = null; |
+ for (var i = 0; i < deferredQueue.length; i++) { |
+ deferredQueue[i](); |
+ } |
+ |
if (mountedVolumes.length > 0) |
cr.dispatchSimpleEvent(self, 'change'); |
} |
@@ -302,6 +309,12 @@ VolumeManager.prototype.unmount = function(mountPath, |
successCallback, |
errorCallback) { |
this.validateMountPath_(mountPath); |
+ if (this.deferredQueue_) { |
+ this.deferredQueue_.push(this.unmount.bind(this, |
+ mountPath, successCallback, errorCallback)); |
+ return; |
+ } |
+ |
var volumeInfo = this.mountedVolumes_[mountPath]; |
if (!volumeInfo) { |
errorCallback(VolumeManager.Error.NOT_MOUNTED); |
@@ -370,6 +383,12 @@ VolumeManager.prototype.getVolumeInfo_ = function(mountPath) { |
*/ |
VolumeManager.prototype.mount_ = function(url, mountType, |
successCallback, errorCallback) { |
+ if (this.deferredQueue_) { |
+ this.deferredQueue_.push(this.mount_.bind(this, |
+ url, mountType, successCallback, errorCallback)); |
+ return; |
+ } |
+ |
chrome.fileBrowserPrivate.addMount(url, mountType, {}, |
function(sourcePath) { |
console.log('Mount request: url=' + url + '; mountType=' + mountType + |