Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/it2me/it2me_host.h" | 5 #include "remoting/host/it2me/it2me_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
| 10 #include "net/socket/client_socket_factory.h" | 10 #include "net/socket/client_socket_factory.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 SetState(kConnected); | 349 SetState(kConnected); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void It2MeHost::OnClientDisconnected(const std::string& jid) { | 352 void It2MeHost::OnClientDisconnected(const std::string& jid) { |
| 353 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); | 353 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); |
| 354 | 354 |
| 355 Disconnect(); | 355 Disconnect(); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void It2MeHost::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { | 358 void It2MeHost::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { |
| 359 // The policy watcher runs on the |ui_task_runner| on ChromeOS and the | 359 // The policy watcher runs on the |ui_task_runner|. |
| 360 // |network_task_runner| on other platforms. | |
| 361 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) { | 360 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) { |
| 362 host_context_->network_task_runner()->PostTask( | 361 host_context_->network_task_runner()->PostTask( |
|
Łukasz Anforowicz
2015/01/30 05:35:55
After your changes, OnPolicyUpdate will always be
Sergey Ulanov
2015/01/30 19:33:45
This callback is called on UI thread, but we still
Łukasz Anforowicz
2015/01/30 19:50:59
Acknowledged.
| |
| 363 FROM_HERE, | 362 FROM_HERE, |
| 364 base::Bind(&It2MeHost::OnPolicyUpdate, this, base::Passed(&policies))); | 363 base::Bind(&It2MeHost::OnPolicyUpdate, this, base::Passed(&policies))); |
| 365 return; | 364 return; |
| 366 } | 365 } |
| 367 | 366 |
| 368 bool nat_policy; | 367 bool nat_policy; |
| 369 if (policies->GetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, | 368 if (policies->GetBoolean(policy::key::kRemoteAccessHostFirewallTraversal, |
| 370 &nat_policy)) { | 369 &nat_policy)) { |
| 371 UpdateNatPolicy(nat_policy); | 370 UpdateNatPolicy(nat_policy); |
| 372 } | 371 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 DCHECK(policy_service); | 524 DCHECK(policy_service); |
| 526 DCHECK(!policy_service_) << "|policy_service| can only be set once."; | 525 DCHECK(!policy_service_) << "|policy_service| can only be set once."; |
| 527 policy_service_ = policy_service; | 526 policy_service_ = policy_service; |
| 528 } | 527 } |
| 529 | 528 |
| 530 scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost( | 529 scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost( |
| 531 scoped_ptr<ChromotingHostContext> context, | 530 scoped_ptr<ChromotingHostContext> context, |
| 532 base::WeakPtr<It2MeHost::Observer> observer, | 531 base::WeakPtr<It2MeHost::Observer> observer, |
| 533 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, | 532 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
| 534 const std::string& directory_bot_jid) { | 533 const std::string& directory_bot_jid) { |
| 534 DCHECK(context->ui_task_runner()->BelongsToCurrentThread()); | |
| 535 | |
| 535 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( | 536 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( |
| 536 new It2MeConfirmationDialogFactory()); | 537 new It2MeConfirmationDialogFactory()); |
| 537 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher = | 538 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher = |
| 538 policy_hack::PolicyWatcher::Create(policy_service_, | 539 policy_hack::PolicyWatcher::Create(policy_service_, |
| 540 context->ui_task_runner(), | |
| 539 context->network_task_runner()); | 541 context->network_task_runner()); |
|
Łukasz Anforowicz
2015/01/30 05:35:55
I wonder if we should be using file_task_runner he
Sergey Ulanov
2015/01/30 19:33:45
Yes, you are right. From the AsyncPolicyLoader nam
| |
| 540 return new It2MeHost(context.Pass(), policy_watcher.Pass(), | 542 return new It2MeHost(context.Pass(), policy_watcher.Pass(), |
| 541 confirmation_dialog_factory.Pass(), | 543 confirmation_dialog_factory.Pass(), |
| 542 observer, xmpp_server_config, directory_bot_jid); | 544 observer, xmpp_server_config, directory_bot_jid); |
| 543 } | 545 } |
| 544 | 546 |
| 545 } // namespace remoting | 547 } // namespace remoting |
| OLD | NEW |