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

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: Remove extra comments/whitespace 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
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..6e614ac9c138b2a76b39a0d08a88efff9df5f8ba 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,47 +450,60 @@ 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;
+ }
+
+ if (talkgadget_prefix != talkgadget_prefix_) {
+ LOG(INFO) << "Restarting host due to updated talkgadget policy:";
+ talkgadget_prefix_ = talkgadget_prefix;
+ RestartHost();
+ }
+ }
+
void StartHost() {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
DCHECK(!host_);
+ DCHECK(!signal_strategy_.get());
if (shutting_down_)
return;
- if (!signal_strategy_.get()) {
- signal_strategy_.reset(
- new XmppSignalStrategy(context_->url_request_context_getter(),
- xmpp_login_, xmpp_auth_token_,
- xmpp_auth_service_));
+ signal_strategy_.reset(
+ new XmppSignalStrategy(context_->url_request_context_getter(),
+ xmpp_login_, xmpp_auth_token_,
+ xmpp_auth_service_));
- signaling_connector_.reset(new SignalingConnector(
- signal_strategy_.get(),
- base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this))));
+ signaling_connector_.reset(new SignalingConnector(
+ signal_strategy_.get(), context_.get(), talkgadget_prefix_,
+ base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this))));
- if (!oauth_refresh_token_.empty()) {
- OAuthClientInfo client_info = {
- kUnofficialOAuth2ClientId,
- kUnofficialOAuth2ClientSecret
- };
+ if (!oauth_refresh_token_.empty()) {
+ OAuthClientInfo client_info = {
+ kUnofficialOAuth2ClientId,
+ kUnofficialOAuth2ClientSecret
+ };
#ifdef OFFICIAL_BUILD
- if (oauth_use_official_client_id_) {
- OAuthClientInfo official_client_info = {
- kOfficialOAuth2ClientId,
- kOfficialOAuth2ClientSecret
- };
-
- client_info = official_client_info;
- }
-#endif // OFFICIAL_BUILD
+ if (oauth_use_official_client_id_) {
+ OAuthClientInfo official_client_info = {
+ kOfficialOAuth2ClientId,
+ kOfficialOAuth2ClientSecret
+ };
- 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());
+ client_info = official_client_info;
}
+#endif // OFFICIAL_BUILD
+
+ scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials(
+ new SignalingConnector::OAuthCredentials(
+ xmpp_login_, oauth_refresh_token_, client_info));
+ signaling_connector_->EnableOAuth(oauth_credentials.Pass());
}
if (!desktop_environment_.get()) {
@@ -561,9 +579,7 @@ class HostProcess
restarting_ = false;
host_ = NULL;
- log_to_server_.reset();
- host_event_logger_.reset();
- heartbeat_sender_.reset();
+ ResetHost();
StartHost();
}
@@ -589,13 +605,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 +640,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_;

Powered by Google App Engine
This is Rietveld 408576698