Index: remoting/host/remoting_me2me_host.cc |
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc |
index e4aacabd86419eac6cc7f5ca08a295cc3c9e0d70..3f90b65ddcef0c03d0de8bc2864c0f21974aa3ec 100644 |
--- a/remoting/host/remoting_me2me_host.cc |
+++ b/remoting/host/remoting_me2me_host.cc |
@@ -17,6 +17,7 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop.h" |
#include "base/scoped_native_library.h" |
+#include "base/string_util.h" |
#include "base/synchronization/waitable_event.h" |
#include "base/threading/thread.h" |
#include "base/utf_string_conversions.h" |
@@ -308,12 +309,31 @@ class HostProcess |
} |
bool bool_value; |
+ std::string string_value; |
+ if (policies->GetString(policy_hack::PolicyWatcher::kHostDomainPolicyName, |
+ &string_value)) { |
+ OnHostDomainPolicyUpdate(string_value); |
+ } |
if (policies->GetBoolean(policy_hack::PolicyWatcher::kNatPolicyName, |
&bool_value)) { |
OnNatPolicyUpdate(bool_value); |
} |
} |
+ void OnHostDomainPolicyUpdate(const std::string& host_domain) { |
+ if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
+ context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( |
+ &HostProcess::OnHostDomainPolicyUpdate, base::Unretained(this), |
+ host_domain)); |
+ return; |
+ } |
+ |
+ if (!host_domain.empty() && |
+ !EndsWith(xmpp_login_, std::string("@") + host_domain, false)) { |
+ Shutdown(kInvalidHostDomainExitCode); |
+ } |
+ } |
+ |
void OnNatPolicyUpdate(bool nat_traversal_enabled) { |
if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( |
@@ -340,6 +360,9 @@ class HostProcess |
DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
DCHECK(!host_); |
+ if (shutting_down_) |
+ return; |
+ |
if (!signal_strategy_.get()) { |
signal_strategy_.reset( |
new XmppSignalStrategy(context_->url_request_context_getter(), |
@@ -464,8 +487,12 @@ class HostProcess |
shutting_down_ = true; |
exit_code_ = exit_code; |
- host_->Shutdown(base::Bind( |
- &HostProcess::OnShutdownFinished, base::Unretained(this))); |
+ if (host_) { |
+ host_->Shutdown(base::Bind( |
+ &HostProcess::OnShutdownFinished, base::Unretained(this))); |
+ } else { |
+ OnShutdownFinished(); |
+ } |
} |
void OnShutdownFinished() { |