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

Side by Side Diff: chrome/browser/resources/file_manager/js/volume_manager.js

Issue 10735031: Fixing bug with initialization volumes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 */
11 function VolumeManager() { 11 function VolumeManager() {
12 /** 12 /**
13 * The list of archives requested to mount. We will show contents once 13 * The list of archives requested to mount. We will show contents once
14 * archive is mounted, but only for mounts from within this filebrowser tab. 14 * archive is mounted, but only for mounts from within this filebrowser tab.
15 * @type {Object.<string, Object>} 15 * @type {Object.<string, Object>}
16 * @private 16 * @private
17 */ 17 */
18 this.requests_ = {}; 18 this.requests_ = {};
19 19
20 /** 20 /**
21 * @type {Object.<string, Object>} 21 * @type {Object.<string, Object>}
22 * @private 22 * @private
23 */ 23 */
24 this.mountedVolumes_ = {}; 24 this.mountedVolumes_ = {};
25 25
26 this.initMountPoints_(); 26 this.initMountPoints_();
27 chrome.fileBrowserPrivate.onMountCompleted.addListener(
28 this.onMountCompleted_.bind(this));
29 this.gDataStatus_ = VolumeManager.GDataStatus.UNMOUNTED; 27 this.gDataStatus_ = VolumeManager.GDataStatus.UNMOUNTED;
30 } 28 }
31 29
32 /** 30 /**
33 * VolumeManager extends cr.EventTarget. 31 * VolumeManager extends cr.EventTarget.
34 */ 32 */
35 VolumeManager.prototype.__proto__ = cr.EventTarget.prototype; 33 VolumeManager.prototype.__proto__ = cr.EventTarget.prototype;
36 34
37 /** 35 /**
38 * @enum 36 * @enum
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 mountedVolumes.push(volume); 125 mountedVolumes.push(volume);
128 index++; 126 index++;
129 step(mountPoints); 127 step(mountPoints);
130 } 128 }
131 self.makeVolumeInfo_('/' + info.mountPath, error, onVolumeInfo); 129 self.makeVolumeInfo_('/' + info.mountPath, error, onVolumeInfo);
132 } else { 130 } else {
133 for (var i = 0; i < mountedVolumes.length; i++) { 131 for (var i = 0; i < mountedVolumes.length; i++) {
134 var volume = mountedVolumes[i]; 132 var volume = mountedVolumes[i];
135 self.mountedVolumes_[volume.mountPath] = volume; 133 self.mountedVolumes_[volume.mountPath] = volume;
136 } 134 }
135
136 // Subscribe to the mount completed event when mount points initialized.
137 chrome.fileBrowserPrivate.onMountCompleted.addListener(
138 self.onMountCompleted_.bind(self));
139
137 if (mountedVolumes.length > 0) 140 if (mountedVolumes.length > 0)
138 cr.dispatchSimpleEvent(self, 'change'); 141 cr.dispatchSimpleEvent(self, 'change');
139 } 142 }
140 } 143 }
141 144
142 chrome.fileBrowserPrivate.getMountPoints(step); 145 chrome.fileBrowserPrivate.getMountPoints(step);
143 }; 146 };
144 147
145 /** 148 /**
146 * Event handler called when some volume was mounted or unmouted. 149 * Event handler called when some volume was mounted or unmouted.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 }; 465 };
463 466
464 /** 467 /**
465 * @param {string} mountPath Mount path. 468 * @param {string} mountPath Mount path.
466 * @private 469 * @private
467 */ 470 */
468 VolumeManager.prototype.validateMountPath_ = function(mountPath) { 471 VolumeManager.prototype.validateMountPath_ = function(mountPath) {
469 if (!/^\/(((archive|removable)\/[^\/]+)|drive|Downloads)$/.test(mountPath)) 472 if (!/^\/(((archive|removable)\/[^\/]+)|drive|Downloads)$/.test(mountPath))
470 throw new Error('Invalid mount path: ', mountPath); 473 throw new Error('Invalid mount path: ', mountPath);
471 }; 474 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698