Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: chrome/browser/resources/file_manager/background/js/volume_manager.js

Issue 181203002: Get rid of mountPath dependency in Files app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased + cleaned up. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/background/js/volume_manager.js
diff --git a/chrome/browser/resources/file_manager/background/js/volume_manager.js b/chrome/browser/resources/file_manager/background/js/volume_manager.js
index 670349c35c46b6662d73b7bef1557f74f008631c..6b96849cd70cce84718d9c5710a068b5827e33b4 100644
--- a/chrome/browser/resources/file_manager/background/js/volume_manager.js
+++ b/chrome/browser/resources/file_manager/background/js/volume_manager.js
@@ -544,57 +544,60 @@ VolumeManager.prototype.initialize_ = function(callback) {
*/
VolumeManager.prototype.onMountCompleted_ = function(event) {
this.mountQueue_.run(function(callback) {
- if (event.eventType === 'mount') {
- var requestKey = this.makeRequestKey_(
- 'mount',
- event.volumeMetadata.sourcePath);
+ switch (event.eventType) {
+ case 'mount':
+ var requestKey = this.makeRequestKey_(
+ 'mount',
+ event.volumeMetadata.sourcePath);
- // TODO(mtomasz): Migrate to volumeId once possible.
- if (event.volumeMetadata.mountPath) {
var error = event.status === 'success' ? '' : event.status;
- volumeManagerUtil.createVolumeInfo(
- event.volumeMetadata,
- function(volumeInfo) {
- this.volumeInfoList.add(volumeInfo);
- this.finishRequest_(requestKey, event.status, volumeInfo);
- if (volumeInfo.volumeType === util.VolumeType.DRIVE) {
- // Update the network connection status, because until the
- // drive is initialized, the status is set to not ready.
- // TODO(hidehiko): The connection status should be migrated into
- // VolumeMetadata.
- this.onDriveConnectionStatusChanged_();
- }
- callback();
- }.bind(this));
- } else {
- console.warn('No mount path.');
- this.finishRequest_(requestKey, event.status);
- callback();
- }
- } else if (event.eventType === 'unmount') {
- var volumeId = event.volumeMetadata.volumeId;
- var status = event.status;
- if (status === util.VolumeError.PATH_UNMOUNTED) {
- console.warn('Volume already unmounted: ', volumeId);
- status = 'success';
- }
- var requestKey = this.makeRequestKey_('unmount', volumeId);
- var requested = requestKey in this.requests_;
- var volumeInfoIndex =
- this.volumeInfoList.findIndex(volumeId);
- var volumeInfo = volumeInfoIndex !== -1 ?
- this.volumeInfoList.item(volumeInfoIndex) : null;
- if (event.status === 'success' && !requested && volumeInfo) {
- console.warn('Mounted volume without a request: ', volumeId);
- var e = new Event('externally-unmounted');
- e.volumeInfo = volumeInfo;
- this.dispatchEvent(e);
- }
- this.finishRequest_(requestKey, status);
+ if (!error || event.status === 'error_unknown_filesystem') {
+ volumeManagerUtil.createVolumeInfo(
+ event.volumeMetadata,
+ function(volumeInfo) {
+ this.volumeInfoList.add(volumeInfo);
+ this.finishRequest_(requestKey, event.status, volumeInfo);
+
+ if (volumeInfo.volumeType === util.VolumeType.DRIVE) {
+ // Update the network connection status, because until the
+ // drive is initialized, the status is set to not ready.
+ // TODO(hidehiko): The connection status should be migrated into
hirono 2014/03/03 01:58:23 nit: Over 80 characters?
mtomasz 2014/03/03 02:18:54 Done.
+ // VolumeMetadata.
+ this.onDriveConnectionStatusChanged_();
+ }
+ callback();
+ }.bind(this));
+ } else {
+ console.warn('Failed to mount a volume: ' + event.status);
+ this.finishRequest_(requestKey, event.status);
+ callback();
+ }
+ break;
+ case 'unmount':
hirono 2014/03/03 01:58:23 nit: Please insert a line before #576.
mtomasz 2014/03/03 02:18:54 Done.
+ var volumeId = event.volumeMetadata.volumeId;
+ var status = event.status;
+ if (status === util.VolumeError.PATH_UNMOUNTED) {
+ console.warn('Volume already unmounted: ', volumeId);
+ status = 'success';
+ }
+ var requestKey = this.makeRequestKey_('unmount', volumeId);
+ var requested = requestKey in this.requests_;
+ var volumeInfoIndex =
+ this.volumeInfoList.findIndex(volumeId);
+ var volumeInfo = volumeInfoIndex !== -1 ?
+ this.volumeInfoList.item(volumeInfoIndex) : null;
+ if (event.status === 'success' && !requested && volumeInfo) {
+ console.warn('Mounted volume without a request: ' + volumeId);
+ var e = new Event('externally-unmounted');
+ e.volumeInfo = volumeInfo;
+ this.dispatchEvent(e);
+ }
- if (event.status === 'success')
- this.volumeInfoList.remove(event.volumeMetadata.volumeId);
- callback();
+ this.finishRequest_(requestKey, status);
+ if (event.status === 'success')
+ this.volumeInfoList.remove(event.volumeMetadata.volumeId);
+ callback();
+ break;
}
}.bind(this));
};
@@ -706,7 +709,6 @@ VolumeManager.prototype.getLocationInfo = function(entry) {
return null;
}
} else {
- // Otherwise, root path is same with a mount path of the volume.
switch (volumeInfo.volumeType) {
case util.VolumeType.DOWNLOADS:
rootType = RootType.DOWNLOADS;

Powered by Google App Engine
This is Rietveld 408576698