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

Unified Diff: ui/file_manager/gallery/js/gallery.js

Issue 816603002: Gallery: Register unload handler to 'pagehide' event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | ui/file_manager/gallery/js/gallery_scripts.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/gallery.js
diff --git a/ui/file_manager/gallery/js/gallery.js b/ui/file_manager/gallery/js/gallery.js
index 61176466beb8cac90801067a8958c1b392c39885..34a66b97d03bf62a41fb4083231a686e755a6a5c 100644
--- a/ui/file_manager/gallery/js/gallery.js
+++ b/ui/file_manager/gallery/js/gallery.js
@@ -3,12 +3,6 @@
// found in the LICENSE file.
/**
- * Called from the main frame when unloading.
- * @param {boolean=} opt_exiting True if the app is exiting.
- */
-function unload(opt_exiting) { gallery.onUnload(opt_exiting); }
-
-/**
* Overrided metadata worker's path.
* @type {string}
*/
@@ -368,6 +362,8 @@ function Gallery(volumeManager) {
}
this.volumeManager_.addEventListener(
'externally-unmounted', this.onExternallyUnmountedBound_);
+ // The 'pagehide' event is called when the app window is closed.
+ window.addEventListener('pagehide', this.onPageHide_.bind(this));
}
/**
@@ -421,9 +417,9 @@ Gallery.prototype.onExternallyUnmounted_ = function(event) {
/**
* Unloads the Gallery.
- * @param {boolean=} opt_exiting True if the app is exiting.
+ * @private
*/
-Gallery.prototype.onUnload = function(opt_exiting) {
+Gallery.prototype.onPageHide_ = function() {
if (this.metadataCacheObserverId_ !== null)
this.metadataCache_.removeObserver(this.metadataCacheObserverId_);
this.volumeManager_.removeEventListener(
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/gallery_scripts.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698