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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 10823083: [Chromoting] Implement the host domain policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 8 years, 5 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
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | remoting/tools/me2me_virtual_host.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | remoting/tools/me2me_virtual_host.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698