| 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 <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 std::unique_ptr<PolicyWatcher> policy_watcher, | 61 std::unique_ptr<PolicyWatcher> policy_watcher, |
| 62 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory, | 62 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory, |
| 63 base::WeakPtr<It2MeHost::Observer> observer, | 63 base::WeakPtr<It2MeHost::Observer> observer, |
| 64 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, | 64 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
| 65 const std::string& directory_bot_jid) | 65 const std::string& directory_bot_jid) |
| 66 : host_context_(std::move(host_context)), | 66 : host_context_(std::move(host_context)), |
| 67 task_runner_(host_context_->ui_task_runner()), | 67 task_runner_(host_context_->ui_task_runner()), |
| 68 observer_(observer), | 68 observer_(observer), |
| 69 xmpp_server_config_(xmpp_server_config), | 69 xmpp_server_config_(xmpp_server_config), |
| 70 directory_bot_jid_(directory_bot_jid), | 70 directory_bot_jid_(directory_bot_jid), |
| 71 state_(kDisconnected), | |
| 72 failed_login_attempts_(0), | |
| 73 policy_watcher_(std::move(policy_watcher)), | 71 policy_watcher_(std::move(policy_watcher)), |
| 74 confirmation_dialog_factory_(std::move(confirmation_dialog_factory)), | 72 confirmation_dialog_factory_(std::move(confirmation_dialog_factory)) { |
| 75 nat_traversal_enabled_(false), | |
| 76 policy_received_(false) { | |
| 77 DCHECK(task_runner_->BelongsToCurrentThread()); | 73 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 78 } | 74 } |
| 79 | 75 |
| 80 It2MeHost::~It2MeHost() { | 76 It2MeHost::~It2MeHost() { |
| 81 // Check that resources that need to be torn down on the UI thread are gone. | 77 // Check that resources that need to be torn down on the UI thread are gone. |
| 82 DCHECK(!desktop_environment_factory_.get()); | 78 DCHECK(!desktop_environment_factory_.get()); |
| 83 DCHECK(!policy_watcher_.get()); | 79 DCHECK(!policy_watcher_.get()); |
| 84 } | 80 } |
| 85 | 81 |
| 86 void It2MeHost::Connect() { | 82 void It2MeHost::Connect() { |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid | 537 LOG(ERROR) << "Rejecting incoming connection from " << remote_jid |
| 542 << ": Domain mismatch."; | 538 << ": Domain mismatch."; |
| 543 result_callback.Run(ValidationResult::ERROR_INVALID_ACCOUNT); | 539 result_callback.Run(ValidationResult::ERROR_INVALID_ACCOUNT); |
| 544 return; | 540 return; |
| 545 } | 541 } |
| 546 } | 542 } |
| 547 | 543 |
| 548 result_callback.Run(ValidationResult::SUCCESS); | 544 result_callback.Run(ValidationResult::SUCCESS); |
| 549 } | 545 } |
| 550 | 546 |
| 551 It2MeHostFactory::It2MeHostFactory() : policy_service_(nullptr) { | 547 It2MeHostFactory::It2MeHostFactory() {} |
| 552 } | |
| 553 | 548 |
| 554 It2MeHostFactory::~It2MeHostFactory() {} | 549 It2MeHostFactory::~It2MeHostFactory() {} |
| 555 | 550 |
| 556 void It2MeHostFactory::set_policy_service( | 551 void It2MeHostFactory::set_policy_service( |
| 557 policy::PolicyService* policy_service) { | 552 policy::PolicyService* policy_service) { |
| 558 DCHECK(policy_service); | 553 DCHECK(policy_service); |
| 559 DCHECK(!policy_service_) << "|policy_service| can only be set once."; | 554 DCHECK(!policy_service_) << "|policy_service| can only be set once."; |
| 560 policy_service_ = policy_service; | 555 policy_service_ = policy_service; |
| 561 } | 556 } |
| 562 | 557 |
| 563 scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost( | 558 scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost( |
| 564 std::unique_ptr<ChromotingHostContext> context, | 559 std::unique_ptr<ChromotingHostContext> context, |
| 565 base::WeakPtr<It2MeHost::Observer> observer, | 560 base::WeakPtr<It2MeHost::Observer> observer, |
| 566 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, | 561 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
| 567 const std::string& directory_bot_jid) { | 562 const std::string& directory_bot_jid) { |
| 568 DCHECK(context->ui_task_runner()->BelongsToCurrentThread()); | 563 DCHECK(context->ui_task_runner()->BelongsToCurrentThread()); |
| 569 | 564 |
| 570 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( | 565 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( |
| 571 new It2MeConfirmationDialogFactory()); | 566 new It2MeConfirmationDialogFactory()); |
| 572 std::unique_ptr<PolicyWatcher> policy_watcher = | 567 std::unique_ptr<PolicyWatcher> policy_watcher = |
| 573 PolicyWatcher::Create(policy_service_, context->file_task_runner()); | 568 PolicyWatcher::Create(policy_service_, context->file_task_runner()); |
| 574 return new It2MeHost(std::move(context), std::move(policy_watcher), | 569 return new It2MeHost(std::move(context), std::move(policy_watcher), |
| 575 std::move(confirmation_dialog_factory), observer, | 570 std::move(confirmation_dialog_factory), observer, |
| 576 xmpp_server_config, directory_bot_jid); | 571 xmpp_server_config, directory_bot_jid); |
| 577 } | 572 } |
| 578 | 573 |
| 579 } // namespace remoting | 574 } // namespace remoting |
| OLD | NEW |