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

Unified Diff: ui/file_manager/file_manager/foreground/js/import_controller.js

Issue 869783005: Files.app: Unobserve media scanner observer when foreground window is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/import_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/import_controller.js b/ui/file_manager/file_manager/foreground/js/import_controller.js
index 11060845a7f583511a4663d85b94e826668b1b4f..b6f99d4d09ac9c18fe272a07b5e45f4f7f58179c 100644
--- a/ui/file_manager/file_manager/foreground/js/import_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/import_controller.js
@@ -59,7 +59,12 @@ importer.ImportController =
*/
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.onVolumeUnmounted_.bind(this));
};
« 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