From 6c290c4f816f3ee35c1de10e2c0d5d1955d87414 Mon Sep 17 00:00:00 2001 From: fukino Date: Mon, 13 Jul 2015 23:42:07 -0700 Subject: [PATCH] Files.app: Dispatch 'drive-connection-changed' event on initialization of VolumeManagerWrapper. VolumeManagerWrapper.getDriveConnectionState() returns 'offline' until the instance of VolumeManagerWrapper is wired to background's VolumeManager. Since the return value can be changed when it is wired to VolumeManager, we need to notify foreground components so that they update themselves based on the latest connection status. BUG=509565 TEST=manually Review URL: https://codereview.chromium.org/1240583002 Cr-Commit-Position: refs/heads/master@{#338648} --- ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js b/ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js index 7b4f53a3fb3c..c2bb574d7715 100644 --- a/ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js +++ b/ui/file_manager/file_manager/foreground/js/volume_manager_wrapper.js @@ -87,6 +87,11 @@ VolumeManagerWrapper.prototype.onReady_ = function(volumeManager) { this.volumeManager_.addEventListener( 'externally-unmounted', this.onEventBound_); + // Dispatch 'drive-connection-changed' to listeners, since the return value of + // VolumeManagerWrapper.getDriveConnectionState() can be changed by setting + // this.volumeManager_. + cr.dispatchSimpleEvent(this, 'drive-connection-changed'); + // Cache volumeInfoList. var volumeInfoList = []; for (var i = 0; i < this.volumeManager_.volumeInfoList.length; i++) { -- 2.11.4.GIT