Chromium Code Reviews| 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..18ee4fa52cde7d07fd3ecbd7ac71e066b4abd44a 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,22 @@ 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_); |
| @@ -459,7 +480,7 @@ class HostProcess |
| xmpp_auth_service_)); |
| signaling_connector_.reset(new SignalingConnector( |
| - signal_strategy_.get(), |
| + signal_strategy_.get(), context_.get(), talkgadget_prefix_, |
|
Sergey Ulanov
2012/08/24 19:43:33
I think you need to update simple_host as it uses
garykac
2012/08/27 22:34:57
Done.
|
| base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this)))); |
| if (!oauth_refresh_token_.empty()) { |
| @@ -482,9 +503,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 +580,7 @@ class HostProcess |
| restarting_ = false; |
| host_ = NULL; |
| - log_to_server_.reset(); |
| - host_event_logger_.reset(); |
| - heartbeat_sender_.reset(); |
| + ResetHost(); |
| StartHost(); |
| } |
| @@ -589,13 +606,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 +641,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_; |