OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * Thin wrapper for VolumeManager. This should be an interface proxy to talk | 6 * Thin wrapper for VolumeManager. This should be an interface proxy to talk |
7 * to VolumeManager. This class also filters Drive related data/events if | 7 * to VolumeManager. This class also filters Drive related data/events if |
8 * driveEnabled is set to false. | 8 * driveEnabled is set to false. |
9 * | 9 * |
10 * @param {VolumeManagerWrapper.DriveEnabledStatus} driveEnabled DRIVE_ENABLED | 10 * @param {VolumeManagerWrapper.DriveEnabledStatus} driveEnabled DRIVE_ENABLED |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 * Called on events sent from VolumeManager. This has responsibility to | 130 * Called on events sent from VolumeManager. This has responsibility to |
131 * re-dispatch the event to the listeners. | 131 * re-dispatch the event to the listeners. |
132 * @param {Event} event Event object sent from VolumeManager. | 132 * @param {Event} event Event object sent from VolumeManager. |
133 * @private | 133 * @private |
134 */ | 134 */ |
135 VolumeManagerWrapper.prototype.onEvent_ = function(event) { | 135 VolumeManagerWrapper.prototype.onEvent_ = function(event) { |
136 if (!this.driveEnabled_) { | 136 if (!this.driveEnabled_) { |
137 // If the drive is disabled, ignore all drive related events. | 137 // If the drive is disabled, ignore all drive related events. |
138 if (event.type === 'drive-connection-changed' || | 138 if (event.type === 'drive-connection-changed' || |
139 (event.type === 'externally-unmounted' && | 139 (event.type === 'externally-unmounted' && |
140 event.volumeType === util.VolumeType.DRIVE)) | 140 event.volumeInfo.volumeType === util.VolumeType.DRIVE)) |
141 return; | 141 return; |
142 } | 142 } |
143 | 143 |
144 this.dispatchEvent(event); | 144 this.dispatchEvent(event); |
145 }; | 145 }; |
146 | 146 |
147 /** | 147 /** |
148 * Called on events of modifying VolumeInfoList. | 148 * Called on events of modifying VolumeInfoList. |
149 * @param {Event} event Event object sent from VolumeInfoList. | 149 * @param {Event} event Event object sent from VolumeInfoList. |
150 * @private | 150 * @private |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 * @param {VolumeInfo} volumeInfo Volume info. | 325 * @param {VolumeInfo} volumeInfo Volume info. |
326 * @return {VolumeInfo} Null if the drive is disabled and the given volume is | 326 * @return {VolumeInfo} Null if the drive is disabled and the given volume is |
327 * drive. Otherwise just returns the volume. | 327 * drive. Otherwise just returns the volume. |
328 * @private | 328 * @private |
329 */ | 329 */ |
330 VolumeManagerWrapper.prototype.filterDisabledDriveVolume_ = | 330 VolumeManagerWrapper.prototype.filterDisabledDriveVolume_ = |
331 function(volumeInfo) { | 331 function(volumeInfo) { |
332 var isDrive = volumeInfo && volumeInfo.volumeType === util.VolumeType.DRIVE; | 332 var isDrive = volumeInfo && volumeInfo.volumeType === util.VolumeType.DRIVE; |
333 return this.driveEnabled_ || !isDrive ? volumeInfo : null; | 333 return this.driveEnabled_ || !isDrive ? volumeInfo : null; |
334 }; | 334 }; |
OLD | NEW |