Commit aa185c51 authored by François Degros's avatar François Degros Committed by Commit Bot

Replaced ExternallyUnmountedEvent with CustomEvent<!VolumeInfo>

Change-Id: I0199eb2d1e573ac1ca6a368380f2c8dd08cf5b93
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1616705Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Auto-Submit: François Degros <fdegros@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660730}
parent bbce3cdc
...@@ -268,8 +268,8 @@ AudioPlayer.prototype.onExternallyUnmounted_ = function(event) { ...@@ -268,8 +268,8 @@ AudioPlayer.prototype.onExternallyUnmounted_ = function(event) {
return; return;
} }
if (this.volumeManager_.getVolumeInfo(this.selectedEntry_) === event = /** @type {!ExternallyUnmountedEvent} */ (event);
event.volumeInfo) { if (this.volumeManager_.getVolumeInfo(this.selectedEntry_) === event.detail) {
window.close(); window.close();
} }
}; };
......
...@@ -232,7 +232,7 @@ class FilteredVolumeManager extends cr.EventTarget { ...@@ -232,7 +232,7 @@ class FilteredVolumeManager extends cr.EventTarget {
break; break;
case 'externally-unmounted': case 'externally-unmounted':
event = /** @type {!ExternallyUnmountedEvent} */ (event); event = /** @type {!ExternallyUnmountedEvent} */ (event);
if (this.isAllowedVolume_(event.volumeInfo)) { if (this.isAllowedVolume_(event.detail)) {
this.dispatchEvent(event); this.dispatchEvent(event);
} }
break; break;
......
...@@ -122,12 +122,7 @@ VolumeManager.prototype.getDefaultDisplayRoot = function(callback) {}; ...@@ -122,12 +122,7 @@ VolumeManager.prototype.getDefaultDisplayRoot = function(callback) {};
/** /**
* Event object which is dispached with 'externally-unmounted' event. * Event object which is dispached with 'externally-unmounted' event.
* @constructor * @typedef {!CustomEvent<!VolumeInfo>}
* @extends {Event}
*/ */
function ExternallyUnmountedEvent() {} let ExternallyUnmountedEvent;
/**
* @type {!VolumeInfo}
*/
ExternallyUnmountedEvent.prototype.volumeInfo;
...@@ -206,9 +206,8 @@ class VolumeManagerImpl extends cr.EventTarget { ...@@ -206,9 +206,8 @@ class VolumeManagerImpl extends cr.EventTarget {
null; null;
if (event.status === 'success' && !requested && volumeInfo) { if (event.status === 'success' && !requested && volumeInfo) {
console.warn('Unmounted volume without a request: ' + volumeId); console.warn('Unmounted volume without a request: ' + volumeId);
const e = new Event('externally-unmounted'); this.dispatchEvent(
e.volumeInfo = volumeInfo; new CustomEvent('externally-unmounted', {detail: volumeInfo}));
this.dispatchEvent(e);
} }
this.finishRequest_(requestKey, status); this.finishRequest_(requestKey, status);
......
...@@ -266,8 +266,8 @@ Gallery.prototype.onExternallyUnmounted_ = function(event) { ...@@ -266,8 +266,8 @@ Gallery.prototype.onExternallyUnmounted_ = function(event) {
return; return;
} }
if (this.volumeManager_.getVolumeInfo(this.selectedEntry_) === event = /** @type {!ExternallyUnmountedEvent} */ (event);
event.volumeInfo) { if (this.volumeManager_.getVolumeInfo(this.selectedEntry_) === event.detail) {
window.close(); window.close();
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment