diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-12 00:46:52 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-12 00:46:52 +0000 |
commit | fb0d52fa9455c6eb25c14750760397741ab87835 (patch) | |
tree | 22d0cc6955cc488b3b256ac91fe21d311d2a0e5f | |
parent | 573e6cc843e5f9e7ee6a777e030ace25befd64cc (diff) | |
download | chromium_src-fb0d52fa9455c6eb25c14750760397741ab87835.zip chromium_src-fb0d52fa9455c6eb25c14750760397741ab87835.tar.gz chromium_src-fb0d52fa9455c6eb25c14750760397741ab87835.tar.bz2 |
Cleanups in ChromotingClient
1. Moved creation of ConnectionToHost to ChromotingClient. Previously
ConnectionToHost had to be passed in the constructor.
2. Authentication now is created outside of ChromotingClient. This
allowed to remove ClientConfig struct (it was used mostly to
pass authentication parameters). This will also allow passing
a fake authenticator for tests.
3. Removed ClientConfig.
Review URL: https://codereview.chromium.org/384523003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282757 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java | 18 | ||||
-rw-r--r-- | remoting/client/chromoting_client.cc | 64 | ||||
-rw-r--r-- | remoting/client/chromoting_client.h | 32 | ||||
-rw-r--r-- | remoting/client/client_config.cc | 15 | ||||
-rw-r--r-- | remoting/client/client_config.h | 43 | ||||
-rw-r--r-- | remoting/client/client_user_interface.h | 5 | ||||
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.cc | 74 | ||||
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.h | 8 | ||||
-rw-r--r-- | remoting/client/jni/chromoting_jni_runtime.cc | 6 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 145 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.h | 11 | ||||
-rw-r--r-- | remoting/ios/bridge/client_instance.cc | 79 | ||||
-rw-r--r-- | remoting/ios/bridge/client_instance.h | 8 | ||||
-rw-r--r-- | remoting/protocol/connection_to_host.cc | 8 | ||||
-rw-r--r-- | remoting/protocol/connection_to_host.h | 5 | ||||
-rw-r--r-- | remoting/remoting_srcs.gypi | 2 |
16 files changed, 201 insertions, 322 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java index 6d1dfd1..f5ce54a 100644 --- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java +++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java @@ -286,11 +286,19 @@ public class JniInterface { /** Saves newly-received pairing credentials to permanent storage. Called on the UI thread. */ @CalledByNative - private static void commitPairingCredentials(String host, byte[] id, byte[] secret) { - sContext.getPreferences(Activity.MODE_PRIVATE).edit(). - putString(host + "_id", new String(id)). - putString(host + "_secret", new String(secret)). - apply(); + private static void commitPairingCredentials(String host, String id, String secret) { + // Empty |id| indicates that pairing needs to be removed. + if (id.isEmpty()) { + sContext.getPreferences(Activity.MODE_PRIVATE).edit(). + remove(host + "_id"). + remove(host + "_secret"). + apply(); + } else { + sContext.getPreferences(Activity.MODE_PRIVATE).edit(). + putString(host + "_id", id). + putString(host + "_secret", secret). + apply(); + } } /** diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index bc18249..99b51c1 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc @@ -25,19 +25,14 @@ namespace remoting { using protocol::AuthenticationMethod; ChromotingClient::ChromotingClient( - const ClientConfig& config, ClientContext* client_context, - protocol::ConnectionToHost* connection, ClientUserInterface* user_interface, VideoRenderer* video_renderer, scoped_ptr<AudioPlayer> audio_player) - : config_(config), - task_runner_(client_context->main_task_runner()), - connection_(connection), + : task_runner_(client_context->main_task_runner()), user_interface_(user_interface), video_renderer_(video_renderer), - host_capabilities_received_(false), - weak_factory_(this) { + host_capabilities_received_(false) { if (audio_player) { audio_decode_scheduler_.reset(new AudioDecodeScheduler( client_context->main_task_runner(), @@ -51,32 +46,21 @@ ChromotingClient::~ChromotingClient() { void ChromotingClient::Start( SignalStrategy* signal_strategy, - scoped_ptr<protocol::TransportFactory> transport_factory) { + scoped_ptr<protocol::Authenticator> authenticator, + scoped_ptr<protocol::TransportFactory> transport_factory, + const std::string& host_jid, + const std::string& capabilities) { DCHECK(task_runner_->BelongsToCurrentThread()); - scoped_ptr<protocol::Authenticator> authenticator( - new protocol::NegotiatingClientAuthenticator( - config_.client_pairing_id, - config_.client_paired_secret, - config_.authentication_tag, - config_.fetch_secret_callback, - user_interface_->GetTokenFetcher(config_.host_public_key), - config_.authentication_methods)); - - // Create a WeakPtr to ourself for to use for all posted tasks. - weak_ptr_ = weak_factory_.GetWeakPtr(); - - connection_->set_client_stub(this); - connection_->set_clipboard_stub(this); - connection_->set_video_stub(video_renderer_); - connection_->set_audio_stub(audio_decode_scheduler_.get()); - - connection_->Connect(signal_strategy, - transport_factory.Pass(), - authenticator.Pass(), - config_.host_jid, - config_.host_public_key, - this); + local_capabilities_ = capabilities; + + connection_.set_client_stub(this); + connection_.set_clipboard_stub(this); + connection_.set_video_stub(video_renderer_); + connection_.set_audio_stub(audio_decode_scheduler_.get()); + + connection_.Connect(signal_strategy, transport_factory.Pass(), + authenticator.Pass(), host_jid, this); } void ChromotingClient::SetCapabilities( @@ -98,7 +82,7 @@ void ChromotingClient::SetCapabilities( // Calculate the set of capabilities enabled by both client and host and pass // it to the webapp. user_interface_->SetCapabilities( - IntersectCapabilities(config_.capabilities, host_capabilities_)); + IntersectCapabilities(local_capabilities_, host_capabilities_)); } void ChromotingClient::SetPairingResponse( @@ -159,13 +143,13 @@ void ChromotingClient::OnAuthenticated() { DCHECK(task_runner_->BelongsToCurrentThread()); // Initialize the decoder. - video_renderer_->Initialize(connection_->config()); - if (connection_->config().is_audio_enabled()) - audio_decode_scheduler_->Initialize(connection_->config()); + video_renderer_->Initialize(connection_.config()); + if (connection_.config().is_audio_enabled()) + audio_decode_scheduler_->Initialize(connection_.config()); // Do not negotiate capabilities with the host if the host does not support // them. - if (!connection_->config().SupportsCapabilities()) { + if (!connection_.config().SupportsCapabilities()) { VLOG(1) << "The host does not support any capabilities."; host_capabilities_received_ = true; @@ -177,12 +161,12 @@ void ChromotingClient::OnChannelsConnected() { DCHECK(task_runner_->BelongsToCurrentThread()); // Negotiate capabilities with the host. - if (connection_->config().SupportsCapabilities()) { - VLOG(1) << "Client capabilities: " << config_.capabilities; + if (connection_.config().SupportsCapabilities()) { + VLOG(1) << "Client capabilities: " << local_capabilities_; protocol::Capabilities capabilities; - capabilities.set_capabilities(config_.capabilities); - connection_->host_stub()->SetCapabilities(capabilities); + capabilities.set_capabilities(local_capabilities_); + connection_.host_stub()->SetCapabilities(capabilities); } } diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h index 65f9910..b052c9a 100644 --- a/remoting/client/chromoting_client.h +++ b/remoting/client/chromoting_client.h @@ -11,8 +11,6 @@ #include "base/callback.h" #include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" -#include "remoting/client/client_config.h" #include "remoting/client/chromoting_stats.h" #include "remoting/protocol/client_stub.h" #include "remoting/protocol/clipboard_stub.h" @@ -43,9 +41,7 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, public protocol::ClientStub { public: // |audio_player| may be null, in which case audio will not be requested. - ChromotingClient(const ClientConfig& config, - ClientContext* client_context, - protocol::ConnectionToHost* connection, + ChromotingClient(ClientContext* client_context, ClientUserInterface* user_interface, VideoRenderer* video_renderer, scoped_ptr<AudioPlayer> audio_player); @@ -55,7 +51,20 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, // Start the client. Must be called on the main thread. |signal_strategy| // must outlive the client. void Start(SignalStrategy* signal_strategy, - scoped_ptr<protocol::TransportFactory> transport_factory); + scoped_ptr<protocol::Authenticator> authenticator, + scoped_ptr<protocol::TransportFactory> transport_factory, + const std::string& host_jid, + const std::string& capabilities); + + protocol::ConnectionToHost::State connection_state() const { + return connection_.state(); + } + + protocol::ClipboardStub* clipboard_forwarder() { + return connection_.clipboard_forwarder(); + } + protocol::HostStub* host_stub() { return connection_.host_stub(); } + protocol::InputStub* input_stub() { return connection_.input_stub(); } // ClientStub implementation. virtual void SetCapabilities( @@ -89,16 +98,15 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, void OnChannelsConnected(); // The following are not owned by this class. - ClientConfig config_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - protocol::ConnectionToHost* connection_; ClientUserInterface* user_interface_; VideoRenderer* video_renderer_; + protocol::ConnectionToHost connection_; + scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_; - // If non-NULL, this is called when the client is done. - base::Closure client_done_; + std::string local_capabilities_; // The set of all capabilities supported by the host. std::string host_capabilities_; @@ -109,10 +117,6 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, // Record the statistics of the connection. ChromotingStats stats_; - // WeakPtr used to avoid tasks accessing the client after it is deleted. - base::WeakPtr<ChromotingClient> weak_ptr_; - base::WeakPtrFactory<ChromotingClient> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(ChromotingClient); }; diff --git a/remoting/client/client_config.cc b/remoting/client/client_config.cc deleted file mode 100644 index 85de152..0000000 --- a/remoting/client/client_config.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/client/client_config.h" - -namespace remoting { - -ClientConfig::ClientConfig() { -} - -ClientConfig::~ClientConfig() { -} - -} // namespace remoting diff --git a/remoting/client/client_config.h b/remoting/client/client_config.h deleted file mode 100644 index d56d0be..0000000 --- a/remoting/client/client_config.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_CLIENT_CLIENT_CONFIG_H_ -#define REMOTING_CLIENT_CLIENT_CONFIG_H_ - -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "remoting/protocol/authentication_method.h" -#include "remoting/protocol/negotiating_client_authenticator.h" - -namespace remoting { - -struct ClientConfig { - ClientConfig(); - ~ClientConfig(); - - std::string host_jid; - std::string host_public_key; - - protocol::FetchSecretCallback fetch_secret_callback; - - std::vector<protocol::AuthenticationMethod> authentication_methods; - std::string authentication_tag; - - // The set of all capabilities supported by the webapp. - std::string capabilities; - - // The host-generated id and secret for paired clients. Paired clients - // should set both of these in addition to fetch_secret_callback; the - // latter is used if the paired connection fails (for example, if the - // pairing has been revoked by the host) and the user needs to prompted - // to enter their PIN. - std::string client_pairing_id; - std::string client_paired_secret; -}; - -} // namespace remoting - -#endif // REMOTING_CLIENT_CLIENT_CONFIG_H_ diff --git a/remoting/client/client_user_interface.h b/remoting/client/client_user_interface.h index 9f1cfa7..51a097e 100644 --- a/remoting/client/client_user_interface.h +++ b/remoting/client/client_user_interface.h @@ -53,11 +53,6 @@ class ClientUserInterface { // Get the view's CursorShapeStub implementation. virtual protocol::CursorShapeStub* GetCursorShapeStub() = 0; - - // Get the view's TokenFetcher implementation. - // The TokenFetcher implementation may require interactive authentication. - virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> - GetTokenFetcher(const std::string& host_public_key) = 0; }; } // namespace remoting diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc index 54b8588..8b63f3d2 100644 --- a/remoting/client/jni/chromoting_jni_instance.cc +++ b/remoting/client/jni/chromoting_jni_instance.cc @@ -23,6 +23,7 @@ #include "remoting/jingle_glue/server_log_entry.h" #include "remoting/protocol/host_stub.h" #include "remoting/protocol/libjingle_transport_factory.h" +#include "remoting/protocol/negotiating_client_authenticator.h" namespace remoting { @@ -48,6 +49,7 @@ ChromotingJniInstance::ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, const char* pairing_secret) : jni_runtime_(jni_runtime), host_id_(host_id), + host_jid_(host_jid), create_pairing_(false), stats_logging_enabled_(false), weak_factory_(this) { @@ -61,23 +63,24 @@ ChromotingJniInstance::ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, xmpp_config_.auth_token = auth_token; xmpp_config_.auth_service = "oauth2"; - // Initialize ClientConfig. - client_config_.host_jid = host_jid; - client_config_.host_public_key = host_pubkey; - - client_config_.fetch_secret_callback = - base::Bind(&ChromotingJniInstance::FetchSecret, this); - client_config_.authentication_tag = host_id_; + // Initialize |authenticator_|. + scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> + token_fetcher(new TokenFetcherProxy( + base::Bind(&ChromotingJniInstance::FetchThirdPartyToken, + weak_factory_.GetWeakPtr()), + host_pubkey)); - client_config_.client_pairing_id = pairing_id; - client_config_.client_paired_secret = pairing_secret; + std::vector<protocol::AuthenticationMethod> auth_methods; + auth_methods.push_back(protocol::AuthenticationMethod::Spake2Pair()); + auth_methods.push_back(protocol::AuthenticationMethod::Spake2( + protocol::AuthenticationMethod::HMAC_SHA256)); + auth_methods.push_back(protocol::AuthenticationMethod::Spake2( + protocol::AuthenticationMethod::NONE)); - client_config_.authentication_methods.push_back( - protocol::AuthenticationMethod::FromString("spake2_pair")); - client_config_.authentication_methods.push_back( - protocol::AuthenticationMethod::FromString("spake2_hmac")); - client_config_.authentication_methods.push_back( - protocol::AuthenticationMethod::FromString("spake2_plain")); + authenticator_.reset(new protocol::NegotiatingClientAuthenticator( + pairing_id, pairing_secret, host_id_, + base::Bind(&ChromotingJniInstance::FetchSecret, this), + token_fetcher.Pass(), auth_methods)); // Post a task to start connection jni_runtime_->display_task_runner()->PostTask( @@ -193,7 +196,7 @@ void ChromotingJniInstance::SendMouseEvent( if (button != protocol::MouseEvent::BUTTON_UNDEFINED) event.set_button_down(button_down); - connection_->input_stub()->InjectMouseEvent(event); + client_->input_stub()->InjectMouseEvent(event); } void ChromotingJniInstance::SendMouseWheelEvent(int delta_x, int delta_y) { @@ -208,7 +211,7 @@ void ChromotingJniInstance::SendMouseWheelEvent(int delta_x, int delta_y) { protocol::MouseEvent event; event.set_wheel_delta_x(delta_x); event.set_wheel_delta_y(delta_y); - connection_->input_stub()->InjectMouseEvent(event); + client_->input_stub()->InjectMouseEvent(event); } bool ChromotingJniInstance::SendKeyEvent(int key_code, bool key_down) { @@ -232,7 +235,7 @@ void ChromotingJniInstance::SendTextEvent(const std::string& text) { protocol::TextEvent event; event.set_text(text); - connection_->input_stub()->InjectTextEvent(event); + client_->input_stub()->InjectTextEvent(event); } void ChromotingJniInstance::RecordPaintTime(int64 paint_time_ms) { @@ -260,7 +263,7 @@ void ChromotingJniInstance::OnConnectionState( protocol::PairingRequest request; DCHECK(!device_name_.empty()); request.set_client_name(device_name_); - connection_->host_stub()->RequestPairing(request); + client_->host_stub()->RequestPairing(request); } jni_runtime_->ui_task_runner()->PostTask( @@ -310,15 +313,6 @@ protocol::CursorShapeStub* ChromotingJniInstance::GetCursorShapeStub() { return this; } -scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> - ChromotingJniInstance::GetTokenFetcher(const std::string& host_public_key) { - return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>( - new TokenFetcherProxy( - base::Bind(&ChromotingJniInstance::FetchThirdPartyToken, - weak_factory_.GetWeakPtr()), - host_public_key)); -} - void ChromotingJniInstance::InjectClipboardEvent( const protocol::ClipboardEvent& event) { NOTIMPLEMENTED(); @@ -360,8 +354,6 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() { jni_runtime_->network_task_runner().get())); client_context_->Start(); - connection_.reset(new protocol::ConnectionToHost(true)); - SoftwareVideoRenderer* renderer = new SoftwareVideoRenderer(client_context_->main_task_runner(), client_context_->decode_task_runner(), @@ -369,10 +361,10 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() { view_->set_frame_producer(renderer); video_renderer_.reset(renderer); - client_.reset(new ChromotingClient( - client_config_, client_context_.get(), connection_.get(), - this, video_renderer_.get(), scoped_ptr<AudioPlayer>())); - + client_.reset(new ChromotingClient(client_context_.get(), + this, + video_renderer_.get(), + scoped_ptr<AudioPlayer>())); signaling_.reset(new XmppSignalStrategy( net::ClientSocketFactory::GetDefaultFactory(), @@ -396,7 +388,8 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() { port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), network_settings)); - client_->Start(signaling_.get(), transport_factory.Pass()); + client_->Start(signaling_.get(), authenticator_.Pass(), + transport_factory.Pass(), host_jid_, std::string()); } void ChromotingJniInstance::DisconnectFromHostOnNetworkThread() { @@ -407,7 +400,7 @@ void ChromotingJniInstance::DisconnectFromHostOnNetworkThread() { stats_logging_enabled_ = false; // |client_| must be torn down before |signaling_|. - connection_.reset(); + client_.reset(); client_.reset(); client_status_logger_.reset(); } @@ -422,11 +415,8 @@ void ChromotingJniInstance::FetchSecret( return; } - if (!client_config_.client_pairing_id.empty()) { - // We attempted to connect using an existing pairing that was rejected. - // Unless we forget about the stale credentials, we'll continue trying them. - jni_runtime_->CommitPairingCredentials(host_id_, "", ""); - } + // Delete pairing credentials if they exist. + jni_runtime_->CommitPairingCredentials(host_id_, "", ""); pin_callback_ = callback; jni_runtime_->DisplayAuthenticationPrompt(pairable); @@ -456,7 +446,7 @@ void ChromotingJniInstance::SendKeyEventInternal(int usb_key_code, protocol::KeyEvent event; event.set_usb_keycode(usb_key_code); event.set_pressed(key_down); - connection_->input_stub()->InjectKeyEvent(event); + client_->input_stub()->InjectKeyEvent(event); } void ChromotingJniInstance::EnableStatsLogging(bool enabled) { diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/client/jni/chromoting_jni_instance.h index 65ffee7..f7067f0 100644 --- a/remoting/client/jni/chromoting_jni_instance.h +++ b/remoting/client/jni/chromoting_jni_instance.h @@ -12,14 +12,12 @@ #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" #include "remoting/client/chromoting_client.h" -#include "remoting/client/client_config.h" #include "remoting/client/client_context.h" #include "remoting/client/client_user_interface.h" #include "remoting/client/frame_consumer_proxy.h" #include "remoting/client/jni/jni_frame_consumer.h" #include "remoting/jingle_glue/xmpp_signal_strategy.h" #include "remoting/protocol/clipboard_stub.h" -#include "remoting/protocol/connection_to_host.h" #include "remoting/protocol/cursor_shape_stub.h" namespace remoting { @@ -106,8 +104,6 @@ class ChromotingJniInstance const protocol::ExtensionMessage& message) OVERRIDE; virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; - virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> - GetTokenFetcher(const std::string& host_public_key) OVERRIDE; // CursorShapeStub implementation. virtual void InjectClipboardEvent( @@ -149,6 +145,7 @@ class ChromotingJniInstance // ID of the host we are connecting to. std::string host_id_; + std::string host_jid_; // This group of variables is to be used on the display thread. scoped_refptr<FrameConsumerProxy> frame_consumer_; @@ -156,10 +153,9 @@ class ChromotingJniInstance scoped_ptr<base::WeakPtrFactory<JniFrameConsumer> > view_weak_factory_; // This group of variables is to be used on the network thread. - ClientConfig client_config_; scoped_ptr<ClientContext> client_context_; scoped_ptr<VideoRenderer> video_renderer_; - scoped_ptr<protocol::ConnectionToHost> connection_; + scoped_ptr<protocol::Authenticator> authenticator_; scoped_ptr<ChromotingClient> client_; XmppSignalStrategy::XmppServerConfig xmpp_config_; scoped_ptr<XmppSignalStrategy> signaling_; // Must outlive client_ diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc index c271973..a4df219 100644 --- a/remoting/client/jni/chromoting_jni_runtime.cc +++ b/remoting/client/jni/chromoting_jni_runtime.cc @@ -258,10 +258,8 @@ void ChromotingJniRuntime::CommitPairingCredentials(const std::string& host, JNIEnv* env = base::android::AttachCurrentThread(); ScopedJavaLocalRef<jstring> j_host = ConvertUTF8ToJavaString(env, host); - ScopedJavaLocalRef<jbyteArray> j_id = ToJavaByteArray( - env, reinterpret_cast<const uint8*>(id.data()), id.size()); - ScopedJavaLocalRef<jbyteArray> j_secret = ToJavaByteArray( - env, reinterpret_cast<const uint8*>(secret.data()), secret.size()); + ScopedJavaLocalRef<jstring> j_id = ConvertUTF8ToJavaString(env, id); + ScopedJavaLocalRef<jstring> j_secret = ConvertUTF8ToJavaString(env,secret); Java_JniInterface_commitPairingCredentials( env, j_host.obj(), j_id.obj(), j_secret.obj()); diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 1b44d8b..e63da8a 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -38,7 +38,6 @@ #include "remoting/base/constants.h" #include "remoting/base/util.h" #include "remoting/client/chromoting_client.h" -#include "remoting/client/client_config.h" #include "remoting/client/frame_consumer_proxy.h" #include "remoting/client/plugin/delegating_signal_strategy.h" #include "remoting/client/plugin/media_source_video_renderer.h" @@ -163,6 +162,26 @@ bool IsVisibleRow(const uint32_t* begin, const uint32_t* end) { return std::find_if(begin, end, &IsVisiblePixel) != end; } +bool ParseAuthMethods( + const std::string& auth_methods_str, + std::vector<protocol::AuthenticationMethod>* auth_methods) { + std::vector<std::string> parts; + base::SplitString(auth_methods_str, ',', &parts); + for (std::vector<std::string>::iterator it = parts.begin(); + it != parts.end(); ++it) { + protocol::AuthenticationMethod authentication_method = + protocol::AuthenticationMethod::FromString(*it); + if (authentication_method.is_valid()) + auth_methods->push_back(authentication_method); + } + if (auth_methods->empty()) { + LOG(ERROR) << "No valid authentication methods specified."; + return false; + } + + return true; +} + // This flag blocks LOGs to the UI if we're already in the middle of logging // to the UI. This prevents a potential infinite loop if we encounter an error // while sending the log message to the UI. @@ -188,25 +207,6 @@ const char ChromotingInstance::kApiFeatures[] = const char ChromotingInstance::kRequestedCapabilities[] = ""; const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape"; -bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str, - ClientConfig* config) { - std::vector<std::string> auth_methods; - base::SplitString(auth_methods_str, ',', &auth_methods); - for (std::vector<std::string>::iterator it = auth_methods.begin(); - it != auth_methods.end(); ++it) { - protocol::AuthenticationMethod authentication_method = - protocol::AuthenticationMethod::FromString(*it); - if (authentication_method.is_valid()) - config->authentication_methods.push_back(authentication_method); - } - if (config->authentication_methods.empty()) { - LOG(ERROR) << "No valid authentication methods specified."; - return false; - } - - return true; -} - ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) : pp::Instance(pp_instance), initialized_(false), @@ -537,15 +537,6 @@ protocol::CursorShapeStub* ChromotingInstance::GetCursorShapeStub() { return this; } -scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> -ChromotingInstance::GetTokenFetcher(const std::string& host_public_key) { - return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>( - new TokenFetcherProxy( - base::Bind(&ChromotingInstance::FetchThirdPartyToken, - weak_factory_.GetWeakPtr()), - host_public_key)); -} - void ChromotingInstance::InjectClipboardEvent( const protocol::ClipboardEvent& event) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); @@ -646,42 +637,53 @@ void ChromotingInstance::OnFirstFrameReceived() { } void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { - ClientConfig config; std::string local_jid; - std::string auth_methods; - if (!data.GetString("hostJid", &config.host_jid) || - !data.GetString("hostPublicKey", &config.host_public_key) || + std::string host_jid; + std::string host_public_key; + std::string auth_methods_str; + std::string authentication_tag; + std::vector<protocol::AuthenticationMethod> auth_methods; + if (!data.GetString("hostJid", &host_jid) || + !data.GetString("hostPublicKey", &host_public_key) || !data.GetString("localJid", &local_jid) || - !data.GetString("authenticationMethods", &auth_methods) || - !ParseAuthMethods(auth_methods, &config) || - !data.GetString("authenticationTag", &config.authentication_tag)) { + !data.GetString("authenticationMethods", &auth_methods_str) || + !ParseAuthMethods(auth_methods_str, &auth_methods) || + !data.GetString("authenticationTag", &authentication_tag)) { LOG(ERROR) << "Invalid connect() data."; return; } - data.GetString("clientPairingId", &config.client_pairing_id); - data.GetString("clientPairedSecret", &config.client_paired_secret); + + std::string client_pairing_id; + data.GetString("clientPairingId", &client_pairing_id); + std::string client_paired_secret; + data.GetString("clientPairedSecret", &client_paired_secret); + + protocol::FetchSecretCallback fetch_secret_callback; if (use_async_pin_dialog_) { - config.fetch_secret_callback = - base::Bind(&ChromotingInstance::FetchSecretFromDialog, - weak_factory_.GetWeakPtr()); + fetch_secret_callback = base::Bind( + &ChromotingInstance::FetchSecretFromDialog, weak_factory_.GetWeakPtr()); } else { std::string shared_secret; if (!data.GetString("sharedSecret", &shared_secret)) { LOG(ERROR) << "sharedSecret not specified in connect()."; return; } - config.fetch_secret_callback = + fetch_secret_callback = base::Bind(&ChromotingInstance::FetchSecretFromString, shared_secret); } // Read the list of capabilities, if any. + std::string capabilities; if (data.HasKey("capabilities")) { - if (!data.GetString("capabilities", &config.capabilities)) { + if (!data.GetString("capabilities", &capabilities)) { LOG(ERROR) << "Invalid connect() data."; return; } } + VLOG(0) << "Connecting to " << host_jid + << ". Local jid: " << local_jid << "."; + #if defined(OS_NACL) std::string key_filter; if (!data.GetString("keyFilter", &key_filter)) { @@ -706,13 +708,6 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { #endif input_handler_.set_input_stub(normalizing_input_filter_.get()); - ConnectWithConfig(config, local_jid); -} - -void ChromotingInstance::ConnectWithConfig(const ClientConfig& config, - const std::string& local_jid) { - DCHECK(plugin_task_runner_->BelongsToCurrentThread()); - if (use_media_source_rendering_) { video_renderer_.reset(new MediaSourceVideoRenderer(this)); } else { @@ -736,36 +731,44 @@ void ChromotingInstance::ConnectWithConfig(const ClientConfig& config, video_renderer_.reset(renderer); } - host_connection_.reset(new protocol::ConnectionToHost(true)); scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this)); - client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), - this, video_renderer_.get(), + client_.reset(new ChromotingClient(&context_, this, video_renderer_.get(), audio_player.Pass())); // Connect the input pipeline to the protocol stub & initialize components. - mouse_input_filter_.set_input_stub(host_connection_->input_stub()); + mouse_input_filter_.set_input_stub(client_->input_stub()); if (!plugin_view_.is_null()) { mouse_input_filter_.set_input_size(webrtc::DesktopSize( plugin_view_.GetRect().width(), plugin_view_.GetRect().height())); } - VLOG(0) << "Connecting to " << config.host_jid - << ". Local jid: " << local_jid << "."; - // Setup the signal strategy. signal_strategy_.reset(new DelegatingSignalStrategy( local_jid, base::Bind(&ChromotingInstance::SendOutgoingIq, weak_factory_.GetWeakPtr()))); - scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator( - PepperPortAllocator::Create(this)); + // Create TransportFactory. scoped_ptr<protocol::TransportFactory> transport_factory( new protocol::LibjingleTransportFactory( - signal_strategy_.get(), port_allocator.Pass(), + signal_strategy_.get(), + PepperPortAllocator::Create(this) + .PassAs<cricket::HttpPortAllocatorBase>(), NetworkSettings(NetworkSettings::NAT_TRAVERSAL_FULL))); + // Create Authenticator. + scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> + token_fetcher(new TokenFetcherProxy( + base::Bind(&ChromotingInstance::FetchThirdPartyToken, + weak_factory_.GetWeakPtr()), + host_public_key)); + scoped_ptr<protocol::Authenticator> authenticator( + new protocol::NegotiatingClientAuthenticator( + client_pairing_id, client_paired_secret, authentication_tag, + fetch_secret_callback, token_fetcher.Pass(), auth_methods)); + // Kick off the connection. - client_->Start(signal_strategy_.get(), transport_factory.Pass()); + client_->Start(signal_strategy_.get(), authenticator.Pass(), + transport_factory.Pass(), host_jid, capabilities); // Start timer that periodically sends perf stats. plugin_task_runner_->PostDelayedTask( @@ -783,11 +786,9 @@ void ChromotingInstance::HandleDisconnect(const base::DictionaryValue& data) { VLOG(0) << "Disconnecting from host."; - client_.reset(); - // Disconnect the input pipeline and teardown the connection. mouse_input_filter_.set_input_stub(NULL); - host_connection_.reset(); + client_.reset(); } void ChromotingInstance::HandleOnIncomingIq(const base::DictionaryValue& data) { @@ -867,7 +868,7 @@ void ChromotingInstance::HandleSendClipboardItem( protocol::ClipboardEvent event; event.set_mime_type(mime_type); event.set_data(item); - host_connection_->clipboard_forwarder()->InjectClipboardEvent(event); + client_->clipboard_forwarder()->InjectClipboardEvent(event); } void ChromotingInstance::HandleNotifyClientResolution( @@ -900,7 +901,7 @@ void ChromotingInstance::HandleNotifyClientResolution( client_resolution.set_dips_width((width * kDefaultDPI) / x_dpi); client_resolution.set_dips_height((height * kDefaultDPI) / y_dpi); - host_connection_->host_stub()->NotifyClientResolution(client_resolution); + client_->host_stub()->NotifyClientResolution(client_resolution); } void ChromotingInstance::HandlePauseVideo(const base::DictionaryValue& data) { @@ -928,7 +929,7 @@ void ChromotingInstance::HandleVideoControl(const base::DictionaryValue& data) { if (!IsConnected()) { return; } - host_connection_->host_stub()->ControlVideo(video_control); + client_->host_stub()->ControlVideo(video_control); } void ChromotingInstance::HandlePauseAudio(const base::DictionaryValue& data) { @@ -942,7 +943,7 @@ void ChromotingInstance::HandlePauseAudio(const base::DictionaryValue& data) { } protocol::AudioControl audio_control; audio_control.set_enable(!pause); - host_connection_->host_stub()->ControlAudio(audio_control); + client_->host_stub()->ControlAudio(audio_control); } void ChromotingInstance::HandleOnPinFetched(const base::DictionaryValue& data) { std::string pin; @@ -987,7 +988,7 @@ void ChromotingInstance::HandleRequestPairing( } protocol::PairingRequest pairing_request; pairing_request.set_client_name(client_name); - host_connection_->host_stub()->RequestPairing(pairing_request); + client_->host_stub()->RequestPairing(pairing_request); } void ChromotingInstance::HandleExtensionMessage( @@ -1005,7 +1006,7 @@ void ChromotingInstance::HandleExtensionMessage( protocol::ExtensionMessage message; message.set_type(type); message.set_data(message_data); - host_connection_->host_stub()->DeliverClientMessage(message); + client_->host_stub()->DeliverClientMessage(message); } void ChromotingInstance::HandleAllowMouseLockMessage() { @@ -1204,8 +1205,8 @@ bool ChromotingInstance::IsCallerAppOrExtension() { } bool ChromotingInstance::IsConnected() { - return host_connection_.get() && - (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); + return client_ && + (client_->connection_state() == protocol::ConnectionToHost::CONNECTED); } void ChromotingInstance::OnMediaSourceSize(const webrtc::DesktopSize& size, diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index 9ed7fdf..325b0d0 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -102,10 +102,6 @@ class ChromotingInstance : // an older version of the API. static const int kApiMinScriptableVersion = 5; - // Helper method to parse authentication_methods parameter. - static bool ParseAuthMethods(const std::string& auth_methods, - ClientConfig* config); - explicit ChromotingInstance(PP_Instance instance); virtual ~ChromotingInstance(); @@ -130,8 +126,6 @@ class ChromotingInstance : const protocol::ExtensionMessage& message) OVERRIDE; virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; - virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> - GetTokenFetcher(const std::string& host_public_key) OVERRIDE; // protocol::ClipboardStub interface. virtual void InjectClipboardEvent( @@ -213,10 +207,6 @@ class ChromotingInstance : void HandleSendMouseInputWhenUnfocused(); void HandleDelegateLargeCursors(); - // Helper method called from Connect() to connect with parsed config. - void ConnectWithConfig(const ClientConfig& config, - const std::string& local_jid); - // Helper method to post messages to the webapp. void PostChromotingMessage(const std::string& method, const pp::VarDictionary& data); @@ -277,7 +267,6 @@ class ChromotingInstance : scoped_ptr<DelegatingSignalStrategy> signal_strategy_; - scoped_ptr<protocol::ConnectionToHost> host_connection_; scoped_ptr<ChromotingClient> client_; // Input pipeline components, in reverse order of distance from input source. diff --git a/remoting/ios/bridge/client_instance.cc b/remoting/ios/bridge/client_instance.cc index 45f0b3fc..5a49922 100644 --- a/remoting/ios/bridge/client_instance.cc +++ b/remoting/ios/bridge/client_instance.cc @@ -15,6 +15,7 @@ #include "remoting/jingle_glue/chromium_port_allocator.h" #include "remoting/protocol/host_stub.h" #include "remoting/protocol/libjingle_transport_factory.h" +#include "remoting/protocol/negotiating_client_authenticator.h" namespace { const char* const kXmppServer = "talk.google.com"; @@ -34,8 +35,10 @@ ClientInstance::ClientInstance(const base::WeakPtr<ClientProxy>& proxy, const std::string& host_pubkey, const std::string& pairing_id, const std::string& pairing_secret) - : proxyToClient_(proxy), host_id_(host_id), create_pairing_(false) { - + : proxyToClient_(proxy), + host_id_(host_id), + host_jid_(host_jid), + create_pairing_(false) { if (!base::MessageLoop::current()) { VLOG(1) << "Starting main message loop"; ui_loop_ = new base::MessageLoopForUI(); @@ -71,18 +74,24 @@ ClientInstance::ClientInstance(const base::WeakPtr<ClientProxy>& proxy, xmpp_config_.auth_token = auth_token; xmpp_config_.auth_service = "oauth2"; - // Initialize ClientConfig. - client_config_.host_jid = host_jid; - client_config_.host_public_key = host_pubkey; - client_config_.authentication_tag = host_id_; - client_config_.client_pairing_id = pairing_id; - client_config_.client_paired_secret = pairing_secret; - client_config_.authentication_methods.push_back( - protocol::AuthenticationMethod::FromString("spake2_pair")); - client_config_.authentication_methods.push_back( - protocol::AuthenticationMethod::FromString("spake2_hmac")); - client_config_.authentication_methods.push_back( - protocol::AuthenticationMethod::FromString("spake2_plain")); + // Initialize |authenticator_|. + scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> + token_fetcher(new TokenFetcherProxy( + base::Bind(&ChromotingJniInstance::FetchThirdPartyToken, + weak_factory_.GetWeakPtr()), + host_pubkey)); + + std::vector<protocol::AuthenticationMethod> auth_methods; + auth_methods.push_back(protocol::AuthenticationMethod::Spake2Pair()); + auth_methods.push_back(protocol::AuthenticationMethod::Spake2( + protocol::AuthenticationMethod::HMAC_SHA256)); + auth_methods.push_back(protocol::AuthenticationMethod::Spake2( + protocol::AuthenticationMethod::NONE)); + + authenticator_.reset(new protocol::NegotiatingClientAuthenticator( + pairing_id, pairing_secret, host_id_, + base::Bind(&ClientInstance::FetchSecret, this), + token_fetcher.Pass(), auth_methods)); } ClientInstance::~ClientInstance() {} @@ -90,10 +99,6 @@ ClientInstance::~ClientInstance() {} void ClientInstance::Start() { DCHECK(ui_task_runner_->BelongsToCurrentThread()); - // Creates a reference to |this|, so don't want to bind during constructor - client_config_.fetch_secret_callback = - base::Bind(&ClientInstance::FetchSecret, this); - view_.reset(new FrameConsumerBridge( base::Bind(&ClientProxy::RedrawCanvas, proxyToClient_))); @@ -119,7 +124,6 @@ void ClientInstance::Start() { void ClientInstance::Cleanup() { DCHECK(ui_task_runner_->BelongsToCurrentThread()); - client_config_.fetch_secret_callback.Reset(); // Release ref to this // |view_| must be destroyed on the UI thread before the producer is gone. view_.reset(); @@ -149,14 +153,9 @@ void ClientInstance::FetchSecret( pin_callback_ = callback; if (proxyToClient_) { - if (!client_config_.client_pairing_id.empty()) { - // We attempted to connect using an existing pairing that was rejected. - // Unless we forget about the stale credentials, we'll continue trying - // them. - VLOG(1) << "Deleting rejected pairing credentials"; - - proxyToClient_->CommitPairingCredentials(host_id_, "", ""); - } + // Delete pairing credentials if they exist. + proxyToClient_->CommitPairingCredentials(host_id_, "", ""); + proxyToClient_->DisplayAuthenticationPrompt(pairable); } } @@ -229,7 +228,7 @@ void ClientInstance::PerformMouseAction( if (mButton != protocol::MouseEvent::BUTTON_UNDEFINED) action.set_button_down(button_down); - connection_->input_stub()->InjectMouseEvent(action); + client_->input_stub()->InjectMouseEvent(action); } void ClientInstance::PerformKeyboardAction(int key_code, bool key_down) { @@ -244,7 +243,7 @@ void ClientInstance::PerformKeyboardAction(int key_code, bool key_down) { protocol::KeyEvent action; action.set_usb_keycode(key_code); action.set_pressed(key_down); - connection_->input_stub()->InjectKeyEvent(action); + client_->input_stub()->InjectKeyEvent(action); } void ClientInstance::OnConnectionState(protocol::ConnectionToHost::State state, @@ -261,7 +260,7 @@ void ClientInstance::OnConnectionState(protocol::ConnectionToHost::State state, // VLOG(1) << "Attempting to pair with host"; // protocol::PairingRequest request; // request.set_client_name("iOS"); - // connection_->host_stub()->RequestPairing(request); + // client_->host_stub()->RequestPairing(request); // } if (proxyToClient_) @@ -279,10 +278,6 @@ void ClientInstance::OnRouteChanged(const std::string& channel_name, } void ClientInstance::SetCapabilities(const std::string& capabilities) { - DCHECK(video_renderer_); - DCHECK(connection_); - DCHECK(connection_->state() == protocol::ConnectionToHost::CONNECTED); - video_renderer_->Initialize(connection_->config()); } void ClientInstance::SetPairingResponse( @@ -312,12 +307,6 @@ protocol::ClipboardStub* ClientInstance::GetClipboardStub() { return this; } // Returning interface of protocol::CursorShapeStub protocol::CursorShapeStub* ClientInstance::GetCursorShapeStub() { return this; } -scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> -ClientInstance::GetTokenFetcher(const std::string& host_public_key) { - // Returns null when third-party authentication is unsupported. - return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>(); -} - void ClientInstance::InjectClipboardEvent( const protocol::ClipboardEvent& event) { NOTIMPLEMENTED(); @@ -347,11 +336,7 @@ void ClientInstance::ConnectToHostOnNetworkThread( view_->Initialize(video_renderer_.get()); - connection_.reset(new protocol::ConnectionToHost(true)); - - client_.reset(new ChromotingClient(client_config_, - client_context_.get(), - connection_.get(), + client_.reset(new ChromotingClient(client_context_.get(), this, video_renderer_.get(), scoped_ptr<AudioPlayer>())); @@ -372,7 +357,8 @@ void ClientInstance::ConnectToHostOnNetworkThread( port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), network_settings)); - client_->Start(signaling_.get(), transport_factory.Pass()); + client_->Start(signaling_.get(), authenticator_.Pass(), + transport_factory.Pass(), host_jid_, std::string()); if (!done.is_null()) done.Run(); @@ -385,7 +371,6 @@ void ClientInstance::DisconnectFromHostOnNetworkThread( host_id_.clear(); // |client_| must be torn down before |signaling_|. - connection_.reset(); client_.reset(); signaling_.reset(); video_renderer_.reset(); diff --git a/remoting/ios/bridge/client_instance.h b/remoting/ios/bridge/client_instance.h index 18f1cef..4c631e3 100644 --- a/remoting/ios/bridge/client_instance.h +++ b/remoting/ios/bridge/client_instance.h @@ -14,7 +14,6 @@ #include "net/url_request/url_request_context_getter.h" #include "remoting/base/auto_thread.h" #include "remoting/client/chromoting_client.h" -#include "remoting/client/client_config.h" #include "remoting/client/client_context.h" #include "remoting/client/client_user_interface.h" #include "remoting/client/frame_consumer_proxy.h" @@ -25,7 +24,6 @@ #include "remoting/jingle_glue/network_settings.h" #include "remoting/jingle_glue/xmpp_signal_strategy.h" #include "remoting/protocol/clipboard_stub.h" -#include "remoting/protocol/connection_to_host.h" #include "remoting/protocol/cursor_shape_stub.h" namespace remoting { @@ -94,8 +92,6 @@ class ClientInstance : public ClientUserInterface, OVERRIDE; virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; - virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> - GetTokenFetcher(const std::string& host_public_key) OVERRIDE; // CursorShapeStub implementation. virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event) @@ -119,15 +115,15 @@ class ClientInstance : public ClientUserInterface, // ID of the host we are connecting to. std::string host_id_; + std::string host_jid_; // This group of variables is to be used on the display thread. scoped_ptr<SoftwareVideoRenderer> video_renderer_; scoped_ptr<FrameConsumerBridge> view_; // This group of variables is to be used on the network thread. - ClientConfig client_config_; scoped_ptr<ClientContext> client_context_; - scoped_ptr<protocol::ConnectionToHost> connection_; + scoped_ptr<protocol::Authenticator> authenticator_; scoped_ptr<ChromotingClient> client_; XmppSignalStrategy::XmppServerConfig xmpp_config_; scoped_ptr<XmppSignalStrategy> signaling_; // Must outlive client_ diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc index fdbd0f2..1e6940a 100644 --- a/remoting/protocol/connection_to_host.cc +++ b/remoting/protocol/connection_to_host.cc @@ -26,10 +26,8 @@ namespace remoting { namespace protocol { -ConnectionToHost::ConnectionToHost( - bool allow_nat_traversal) - : allow_nat_traversal_(allow_nat_traversal), - event_callback_(NULL), +ConnectionToHost::ConnectionToHost() + : event_callback_(NULL), client_stub_(NULL), clipboard_stub_(NULL), audio_stub_(NULL), @@ -55,7 +53,6 @@ void ConnectionToHost::Connect(SignalStrategy* signal_strategy, scoped_ptr<TransportFactory> transport_factory, scoped_ptr<Authenticator> authenticator, const std::string& host_jid, - const std::string& host_public_key, HostEventCallback* event_callback) { DCHECK(client_stub_); DCHECK(clipboard_stub_); @@ -68,7 +65,6 @@ void ConnectionToHost::Connect(SignalStrategy* signal_strategy, // Save jid of the host. The actual connection is created later after // |signal_strategy_| is connected. host_jid_ = host_jid; - host_public_key_ = host_public_key; signal_strategy_->AddListener(this); signal_strategy_->Connect(); diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h index d1e1313..88d633c 100644 --- a/remoting/protocol/connection_to_host.h +++ b/remoting/protocol/connection_to_host.h @@ -80,7 +80,7 @@ class ConnectionToHost : public SignalStrategy::Listener, const protocol::TransportRoute& route) = 0; }; - ConnectionToHost(bool allow_nat_traversal); + ConnectionToHost(); virtual ~ConnectionToHost(); // Set the stubs which will handle messages from the host. @@ -104,7 +104,6 @@ class ConnectionToHost : public SignalStrategy::Listener, scoped_ptr<TransportFactory> transport_factory, scoped_ptr<Authenticator> authenticator, const std::string& host_jid, - const std::string& host_public_key, HostEventCallback* event_callback); // Returns the session configuration that was negotiated with the host. @@ -151,8 +150,6 @@ class ConnectionToHost : public SignalStrategy::Listener, void SetState(State state, ErrorCode error); - bool allow_nat_traversal_; - std::string host_jid_; std::string host_public_key_; scoped_ptr<Authenticator> authenticator_; diff --git a/remoting/remoting_srcs.gypi b/remoting/remoting_srcs.gypi index c6e9248..0471736 100644 --- a/remoting/remoting_srcs.gypi +++ b/remoting/remoting_srcs.gypi @@ -207,8 +207,6 @@ 'client/chromoting_client.h', 'client/chromoting_stats.cc', 'client/chromoting_stats.h', - 'client/client_config.cc', - 'client/client_config.h', 'client/client_context.cc', 'client/client_context.h', 'client/client_status_logger.cc', |