| Index: remoting/host/it2me/it2me_host.cc
|
| diff --git a/remoting/host/it2me/it2me_impl.cc b/remoting/host/it2me/it2me_host.cc
|
| similarity index 89%
|
| rename from remoting/host/it2me/it2me_impl.cc
|
| rename to remoting/host/it2me/it2me_host.cc
|
| index 7b1b4c4565173453e4c9e680c03058804b1546af..302774840377a477adc9f502736f06f957eede6a 100644
|
| --- a/remoting/host/it2me/it2me_impl.cc
|
| +++ b/remoting/host/it2me/it2me_host.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "remoting/host/it2me/it2me_impl.h"
|
| +#include "remoting/host/it2me/it2me_host.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/strings/string_util.h"
|
| @@ -32,10 +32,10 @@ const int kMaxLoginAttempts = 5;
|
|
|
| } // namespace
|
|
|
| -It2MeImpl::It2MeImpl(
|
| +It2MeHost::It2MeHost(
|
| scoped_ptr<ChromotingHostContext> host_context,
|
| scoped_refptr<base::SingleThreadTaskRunner> plugin_task_runner,
|
| - base::WeakPtr<It2MeImpl::Observer> observer,
|
| + base::WeakPtr<It2MeHost::Observer> observer,
|
| const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
|
| const std::string& directory_bot_jid)
|
| : host_context_(host_context.Pass()),
|
| @@ -50,11 +50,11 @@ It2MeImpl::It2MeImpl(
|
| DCHECK(plugin_task_runner_->BelongsToCurrentThread());
|
| }
|
|
|
| -void It2MeImpl::Connect() {
|
| +void It2MeHost::Connect() {
|
| if (!host_context_->ui_task_runner()->BelongsToCurrentThread()) {
|
| DCHECK(plugin_task_runner_->BelongsToCurrentThread());
|
| host_context_->ui_task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::Connect, this));
|
| + FROM_HERE, base::Bind(&It2MeHost::Connect, this));
|
| return;
|
| }
|
|
|
| @@ -67,18 +67,18 @@ void It2MeImpl::Connect() {
|
| policy_watcher_.reset(
|
| policy_hack::PolicyWatcher::Create(host_context_->network_task_runner()));
|
| policy_watcher_->StartWatching(
|
| - base::Bind(&It2MeImpl::OnPolicyUpdate, this));
|
| + base::Bind(&It2MeHost::OnPolicyUpdate, this));
|
|
|
| // Switch to the network thread to start the actual connection.
|
| host_context_->network_task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::ReadPolicyAndConnect, this));
|
| + FROM_HERE, base::Bind(&It2MeHost::ReadPolicyAndConnect, this));
|
| }
|
|
|
| -void It2MeImpl::Disconnect() {
|
| +void It2MeHost::Disconnect() {
|
| if (!host_context_->network_task_runner()->BelongsToCurrentThread()) {
|
| DCHECK(plugin_task_runner_->BelongsToCurrentThread());
|
| host_context_->network_task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::Disconnect, this));
|
| + FROM_HERE, base::Bind(&It2MeHost::Disconnect, this));
|
| return;
|
| }
|
|
|
| @@ -109,16 +109,16 @@ void It2MeImpl::Disconnect() {
|
| // SignalStrategy::Listener handlers are not allowed to destroy
|
| // SignalStrategy, so post task to destroy the host later.
|
| host_context_->network_task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::ShutdownOnNetworkThread, this));
|
| + FROM_HERE, base::Bind(&It2MeHost::ShutdownOnNetworkThread, this));
|
| return;
|
| }
|
| }
|
|
|
| -void It2MeImpl::RequestNatPolicy() {
|
| +void It2MeHost::RequestNatPolicy() {
|
| if (!host_context_->network_task_runner()->BelongsToCurrentThread()) {
|
| DCHECK(plugin_task_runner_->BelongsToCurrentThread());
|
| host_context_->network_task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::RequestNatPolicy, this));
|
| + FROM_HERE, base::Bind(&It2MeHost::RequestNatPolicy, this));
|
| return;
|
| }
|
|
|
| @@ -126,7 +126,7 @@ void It2MeImpl::RequestNatPolicy() {
|
| UpdateNatPolicy(nat_traversal_enabled_);
|
| }
|
|
|
| -void It2MeImpl::ReadPolicyAndConnect() {
|
| +void It2MeHost::ReadPolicyAndConnect() {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| SetState(kStarting);
|
| @@ -138,11 +138,11 @@ void It2MeImpl::ReadPolicyAndConnect() {
|
| } else {
|
| // Otherwise, create the policy watcher, and thunk the connect.
|
| pending_connect_ =
|
| - base::Bind(&It2MeImpl::FinishConnect, this);
|
| + base::Bind(&It2MeHost::FinishConnect, this);
|
| }
|
| }
|
|
|
| -void It2MeImpl::FinishConnect() {
|
| +void It2MeHost::FinishConnect() {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| if (state_ != kStarting) {
|
| @@ -172,7 +172,7 @@ void It2MeImpl::FinishConnect() {
|
| scoped_ptr<RegisterSupportHostRequest> register_request(
|
| new RegisterSupportHostRequest(
|
| signal_strategy.get(), host_key_pair_, directory_bot_jid_,
|
| - base::Bind(&It2MeImpl::OnReceivedSupportID,
|
| + base::Bind(&It2MeHost::OnReceivedSupportID,
|
| base::Unretained(this))));
|
|
|
| // Beyond this point nothing can fail, so save the config and request.
|
| @@ -231,7 +231,7 @@ void It2MeImpl::FinishConnect() {
|
| return;
|
| }
|
|
|
| -void It2MeImpl::ShutdownOnNetworkThread() {
|
| +void It2MeHost::ShutdownOnNetworkThread() {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
| DCHECK(state_ == kDisconnecting || state_ == kDisconnected);
|
|
|
| @@ -247,10 +247,10 @@ void It2MeImpl::ShutdownOnNetworkThread() {
|
| }
|
|
|
| host_context_->ui_task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::ShutdownOnUiThread, this));
|
| + FROM_HERE, base::Bind(&It2MeHost::ShutdownOnUiThread, this));
|
| }
|
|
|
| -void It2MeImpl::ShutdownOnUiThread() {
|
| +void It2MeHost::ShutdownOnUiThread() {
|
| DCHECK(host_context_->ui_task_runner()->BelongsToCurrentThread());
|
|
|
| // Destroy the DesktopEnvironmentFactory, to free thread references.
|
| @@ -265,7 +265,7 @@ void It2MeImpl::ShutdownOnUiThread() {
|
| }
|
| }
|
|
|
| -void It2MeImpl::OnAccessDenied(const std::string& jid) {
|
| +void It2MeHost::OnAccessDenied(const std::string& jid) {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| ++failed_login_attempts_;
|
| @@ -274,7 +274,7 @@ void It2MeImpl::OnAccessDenied(const std::string& jid) {
|
| }
|
| }
|
|
|
| -void It2MeImpl::OnClientAuthenticated(
|
| +void It2MeHost::OnClientAuthenticated(
|
| const std::string& jid) {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| @@ -300,20 +300,20 @@ void It2MeImpl::OnClientAuthenticated(
|
|
|
| // Pass the client user name to the script object before changing state.
|
| plugin_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::Observer::OnClientAuthenticated,
|
| + FROM_HERE, base::Bind(&It2MeHost::Observer::OnClientAuthenticated,
|
| observer_, client_username));
|
|
|
| SetState(kConnected);
|
| }
|
|
|
| -void It2MeImpl::OnClientDisconnected(
|
| +void It2MeHost::OnClientDisconnected(
|
| const std::string& jid) {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| Disconnect();
|
| }
|
|
|
| -void It2MeImpl::OnPolicyUpdate(
|
| +void It2MeHost::OnPolicyUpdate(
|
| scoped_ptr<base::DictionaryValue> policies) {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| @@ -336,7 +336,7 @@ void It2MeImpl::OnPolicyUpdate(
|
| }
|
| }
|
|
|
| -void It2MeImpl::UpdateNatPolicy(
|
| +void It2MeHost::UpdateNatPolicy(
|
| bool nat_traversal_enabled) {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| @@ -352,11 +352,11 @@ void It2MeImpl::UpdateNatPolicy(
|
|
|
| // Notify the web-app of the policy setting.
|
| plugin_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::Observer::OnNatPolicyChanged,
|
| + FROM_HERE, base::Bind(&It2MeHost::Observer::OnNatPolicyChanged,
|
| observer_, nat_traversal_enabled_));
|
| }
|
|
|
| -void It2MeImpl::UpdateHostDomainPolicy(
|
| +void It2MeHost::UpdateHostDomainPolicy(
|
| const std::string& host_domain) {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| @@ -370,13 +370,13 @@ void It2MeImpl::UpdateHostDomainPolicy(
|
| required_host_domain_ = host_domain;
|
| }
|
|
|
| -It2MeImpl::~It2MeImpl() {
|
| +It2MeHost::~It2MeHost() {
|
| // Check that resources that need to be torn down on the UI thread are gone.
|
| DCHECK(!desktop_environment_factory_.get());
|
| DCHECK(!policy_watcher_.get());
|
| }
|
|
|
| -void It2MeImpl::SetState(It2MeHostState state) {
|
| +void It2MeHost::SetState(It2MeHostState state) {
|
| DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
|
|
|
| switch (state_) {
|
| @@ -420,16 +420,16 @@ void It2MeImpl::SetState(It2MeHostState state) {
|
|
|
| // Post a state-change notification to the web-app.
|
| plugin_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::Observer::OnStateChanged,
|
| + FROM_HERE, base::Bind(&It2MeHost::Observer::OnStateChanged,
|
| observer_, state));
|
| }
|
|
|
| -bool It2MeImpl::IsConnected() const {
|
| +bool It2MeHost::IsConnected() const {
|
| return state_ == kRequestedAccessCode || state_ == kReceivedAccessCode ||
|
| state_ == kConnected;
|
| }
|
|
|
| -void It2MeImpl::OnReceivedSupportID(
|
| +void It2MeHost::OnReceivedSupportID(
|
| bool success,
|
| const std::string& support_id,
|
| const base::TimeDelta& lifetime) {
|
| @@ -459,7 +459,7 @@ void It2MeImpl::OnReceivedSupportID(
|
|
|
| // Pass the Access Code to the script object before changing state.
|
| plugin_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&It2MeImpl::Observer::OnStoreAccessCode,
|
| + FROM_HERE, base::Bind(&It2MeHost::Observer::OnStoreAccessCode,
|
| observer_, access_code, lifetime));
|
|
|
| SetState(kReceivedAccessCode);
|
|
|