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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 10873050: [Chromoting] Hook up host talkgadget policy checks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/policy_hack/policy_watcher_unittest.cc ('k') | remoting/host/signaling_connector.h » ('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 be25fa363bd9e0e28aa3ef1fa00777313f1a5ae9..afac0fa4f2d4dbeeb5bdf10805e8d4c25e25b4c5 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -378,6 +378,11 @@ class HostProcess
&bool_value)) {
OnCurtainPolicyUpdate(bool_value);
}
+ if (policies->GetString(
+ policy_hack::PolicyWatcher::kHostTalkGadgetPrefixPolicyName,
+ &string_value)) {
+ OnHostTalkGadgetPrefixPolicyUpdate(string_value);
+ }
}
void OnHostDomainPolicyUpdate(const std::string& host_domain) {
@@ -445,6 +450,25 @@ class HostProcess
#endif
}
+ void OnHostTalkGadgetPrefixPolicyUpdate(
+ const std::string& talkgadget_prefix) {
+ if (!context_->network_task_runner()->BelongsToCurrentThread()) {
+ context_->network_task_runner()->PostTask(FROM_HERE, base::Bind(
+ &HostProcess::OnHostTalkGadgetPrefixPolicyUpdate,
+ base::Unretained(this), talkgadget_prefix));
+ return;
+ }
+
+ LOG(INFO) << "Host talkgadget policy update: " << talkgadget_prefix;
+ if (talkgadget_prefix != talkgadget_prefix_) {
+ LOG(INFO) << "Restarting host due to changed talkgadget policy:";
+ LOG(INFO) << " old talkgadget: " << talkgadget_prefix_;
+ LOG(INFO) << " new talkgadget: " << talkgadget_prefix;
+ talkgadget_prefix_ = talkgadget_prefix;
+ RestartHost();
+ }
+ }
+
void StartHost() {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
DCHECK(!host_);
@@ -459,7 +483,7 @@ class HostProcess
xmpp_auth_service_));
signaling_connector_.reset(new SignalingConnector(
- signal_strategy_.get(),
+ signal_strategy_.get(), context_.get(), talkgadget_prefix_,
base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this))));
if (!oauth_refresh_token_.empty()) {
@@ -482,9 +506,7 @@ class HostProcess
scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials(
new SignalingConnector::OAuthCredentials(
xmpp_login_, oauth_refresh_token_, client_info));
- signaling_connector_->EnableOAuth(
- oauth_credentials.Pass(),
- context_->url_request_context_getter());
+ signaling_connector_->EnableOAuth(oauth_credentials.Pass());
}
}
@@ -561,9 +583,7 @@ class HostProcess
restarting_ = false;
host_ = NULL;
- log_to_server_.reset();
- host_event_logger_.reset();
- heartbeat_sender_.reset();
+ ResetHost();
garykac 2012/08/23 22:08:50 Note that calling ResetHost here resets the Signal
StartHost();
}
@@ -589,13 +609,19 @@ class HostProcess
// Destroy networking objects while we are on the network thread.
host_ = NULL;
+ ResetHost();
+
+ message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
+ }
+
+ void ResetHost() {
+ DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
+
host_event_logger_.reset();
log_to_server_.reset();
heartbeat_sender_.reset();
signaling_connector_.reset();
signal_strategy_.reset();
-
- message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
}
MessageLoop message_loop_;
@@ -618,6 +644,7 @@ class HostProcess
scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
bool allow_nat_traversal_;
+ std::string talkgadget_prefix_;
scoped_ptr<base::files::FilePathWatcher> config_watcher_;
scoped_ptr<base::DelayTimer<HostProcess> > config_updated_timer_;
« no previous file with comments | « remoting/host/policy_hack/policy_watcher_unittest.cc ('k') | remoting/host/signaling_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698