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

Unified Diff: remoting/host/it2me/it2me_host.cc

Issue 2650443002: Webapp share dialog is not closed when client end of the connection is closed (Closed)
Patch Set: Comment tweaks Created 3 years, 9 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
Index: remoting/host/it2me/it2me_host.cc
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc
index 1b52de5c809f4f0d43739b20d9a3801319794c9e..28f17dc16b3d422d54b41af1b8bc49ad64c3afd3 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -75,7 +75,7 @@ bool GetUsernameFromJid(const std::string& remote_jid,
It2MeHost::It2MeHost(
std::unique_ptr<ChromotingHostContext> host_context,
std::unique_ptr<PolicyWatcher> policy_watcher,
- std::unique_ptr<It2MeConfirmationDialog> confirmation_dialog,
+ std::unique_ptr<It2MeConfirmationDialogFactory> dialog_factory,
base::WeakPtr<It2MeHost::Observer> observer,
std::unique_ptr<SignalStrategy> signal_strategy,
const std::string& username,
@@ -86,7 +86,7 @@ It2MeHost::It2MeHost(
username_(username),
directory_bot_jid_(directory_bot_jid),
policy_watcher_(std::move(policy_watcher)),
- confirmation_dialog_(std::move(confirmation_dialog)) {
+ confirmation_dialog_factory_(std::move(dialog_factory)) {
DCHECK(host_context_->ui_task_runner()->BelongsToCurrentThread());
}
@@ -273,6 +273,10 @@ void It2MeHost::OnAccessDenied(const std::string& jid) {
++failed_login_attempts_;
if (failed_login_attempts_ == kMaxLoginAttempts) {
DisconnectOnNetworkThread();
+ } else if (connecting_jid_ == jid) {
+ DCHECK_EQ(state_, kConnecting);
+ confirmation_dialog_proxy_.reset();
+ SetState(kReceivedAccessCode, std::string());
}
}
@@ -552,11 +556,12 @@ void It2MeHost::ShowConfirmationDialog(
}
HOST_LOG << "Client " << client_username << " connecting.";
+ connecting_jid_ = remote_jid;
SetState(kConnecting, std::string());
// Show a confirmation dialog to the user to allow them to confirm/reject it.
confirmation_dialog_proxy_.reset(new It2MeConfirmationDialogProxy(
- host_context_->ui_task_runner(), std::move(confirmation_dialog_)));
+ host_context_->ui_task_runner(), confirmation_dialog_factory_->Create()));
confirmation_dialog_proxy_->Show(
client_username, base::Bind(&It2MeHost::OnConfirmationResult,
@@ -568,6 +573,7 @@ void It2MeHost::OnConfirmationResult(
It2MeConfirmationDialog::Result result) {
DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
+ connecting_jid_.clear();
switch (result) {
case It2MeConfirmationDialog::Result::OK:
result_callback.Run(ValidationResult::SUCCESS);
@@ -596,8 +602,9 @@ scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost(
std::unique_ptr<PolicyWatcher> policy_watcher =
PolicyWatcher::Create(policy_service, context->file_task_runner());
return new It2MeHost(std::move(context), std::move(policy_watcher),
- It2MeConfirmationDialog::Create(), observer,
- std::move(signal_strategy), username, directory_bot_jid);
+ base::MakeUnique<It2MeConfirmationDialogFactory>(),
+ observer, std::move(signal_strategy), username,
+ directory_bot_jid);
}
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698