Index: remoting/host/chromoting_host.cc |
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc |
index 7f3cadd24de9411605b8446be262038672ef696e..44b2281a24675b3cee335237ecfc5ddcf88fbc00 100644 |
--- a/remoting/host/chromoting_host.cc |
+++ b/remoting/host/chromoting_host.cc |
@@ -372,7 +372,7 @@ void ChromotingHost::OnClientDisconnected(ConnectionToClient* connection) { |
if (!HasAuthenticatedClients()) { |
EnableCurtainMode(false); |
if (is_me2mom_) |
- desktop_environment_->disconnect_window()->Hide(); |
+ ShowDisconnectWindow(false, std::string()); |
} |
} |
@@ -471,7 +471,7 @@ void ChromotingHost::LocalLoginSucceeded( |
size_t pos = username.find('/'); |
if (pos != std::string::npos) |
username.replace(pos, std::string::npos, ""); |
- desktop_environment_->disconnect_window()->Show(this, username); |
+ ShowDisconnectWindow(true, username); |
} |
} |
@@ -503,4 +503,21 @@ void ChromotingHost::ProcessPreAuthentication( |
client->get()->OnAuthorizationComplete(true); |
} |
+void ChromotingHost::ShowDisconnectWindow(bool show, |
+ const std::string& username) { |
+ if (context_->ui_message_loop() != MessageLoop::current()) { |
+ context_->ui_message_loop()->PostTask( |
+ FROM_HERE, |
+ NewRunnableMethod(this, &ChromotingHost::ShowDisconnectWindow, |
+ show, username)); |
+ return; |
+ } |
+ |
+ if (show) { |
+ desktop_environment_->disconnect_window()->Show(this, username); |
+ } else { |
+ desktop_environment_->disconnect_window()->Hide(); |
+ } |
+} |
+ |
} // namespace remoting |