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

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

Issue 2452223002: It2Me Host changes to better support Confirmation Dialog (Closed)
Patch Set: Reordering enum Created 4 years, 1 month 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 | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/it2me/it2me_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/it2me/it2me_host.cc
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc
index e1c7a5fea255bad73b86a8744c0a7c2cdc33a559..56eb65c937a7d4d2de91e6141166b2febdd652a1 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -345,7 +345,7 @@ void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) {
// When transitioning from enabled to disabled, force disconnect any
// existing session.
- if (nat_traversal_enabled_ && !nat_traversal_enabled && IsConnected()) {
+ if (nat_traversal_enabled_ && !nat_traversal_enabled && IsRunning()) {
DisconnectOnNetworkThread();
}
@@ -363,7 +363,7 @@ void It2MeHost::UpdateHostDomainPolicy(const std::string& host_domain) {
VLOG(2) << "UpdateHostDomainPolicy: " << host_domain;
// When setting a host domain policy, force disconnect any existing session.
- if (!host_domain.empty() && IsConnected()) {
+ if (!host_domain.empty() && IsRunning()) {
DisconnectOnNetworkThread();
}
@@ -376,7 +376,7 @@ void It2MeHost::UpdateClientDomainPolicy(const std::string& client_domain) {
VLOG(2) << "UpdateClientDomainPolicy: " << client_domain;
// When setting a client domain policy, disconnect any existing session.
- if (!client_domain.empty() && IsConnected()) {
+ if (!client_domain.empty() && IsRunning()) {
DisconnectOnNetworkThread();
}
@@ -404,6 +404,11 @@ void It2MeHost::SetState(It2MeHostState state,
state == kError) << state;
break;
case kReceivedAccessCode:
+ DCHECK(state == kConnecting ||
+ state == kDisconnected ||
+ state == kError) << state;
+ break;
+ case kConnecting:
DCHECK(state == kConnected ||
state == kDisconnected ||
state == kError) << state;
@@ -428,9 +433,9 @@ void It2MeHost::SetState(It2MeHostState state,
state, error_message));
}
-bool It2MeHost::IsConnected() const {
+bool It2MeHost::IsRunning() const {
return state_ == kRequestedAccessCode || state_ == kReceivedAccessCode ||
- state_ == kConnected;
+ state_ == kConnected || state_ == kConnecting;
}
void It2MeHost::OnReceivedSupportID(
@@ -511,6 +516,9 @@ void It2MeHost::ValidateConnectionDetails(
}
}
+ HOST_LOG << "Client " << client_username << " connecting.";
+ 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_)));
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/it2me/it2me_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698