Commit a3523bc7 authored by hirono's avatar hirono Committed by Commit bot

Files.app: Unobserve media scanner observer when foreground window is closed.

BUG=420680
TEST=NONE

Review URL: https://codereview.chromium.org/869783005

Cr-Commit-Position: refs/heads/master@{#312990}
parent 7246d8c0
...@@ -59,7 +59,12 @@ importer.ImportController = ...@@ -59,7 +59,12 @@ importer.ImportController =
*/ */
this.cachedScans_ = {}; this.cachedScans_ = {};
this.scanner_.addObserver(this.onScanEvent_.bind(this)); var listener = this.onScanEvent_.bind(this);
this.scanner_.addObserver(listener);
// Remove the observer when the foreground window is closed.
window.addEventListener('pagehide', function() {
this.scanner_.removeObserver(listener);
}.bind(this));
this.environment_.addVolumeUnmountListener( this.environment_.addVolumeUnmountListener(
this.onVolumeUnmounted_.bind(this)); this.onVolumeUnmounted_.bind(this));
}; };
......
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