From 8de78b013c1754d83a67312b086a53bd6d593ab9 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Wed, 17 Nov 2010 05:20:29 +0000 Subject: Introduce a fake HostStub since there's no need to handle it now Also changed ChormotingHost to use it. BUG=None TEST=None Review URL: http://codereview.chromium.org/4975003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66389 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/host/chromoting_host.cc | 11 ++++++++--- remoting/host/chromoting_host.h | 6 +++++- remoting/host/host_stub_fake.cc | 16 ++++++++++++++++ remoting/host/host_stub_fake.h | 29 +++++++++++++++++++++++++++++ remoting/remoting.gyp | 2 ++ 5 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 remoting/host/host_stub_fake.cc create mode 100644 remoting/host/host_stub_fake.h (limited to 'remoting') diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 9fad9cbf..c7fc7f5 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -15,10 +15,13 @@ #include "remoting/host/chromoting_host_context.h" #include "remoting/host/capturer.h" #include "remoting/host/host_config.h" +#include "remoting/host/host_stub_fake.h" #include "remoting/host/session_manager.h" -#include "remoting/protocol/session_config.h" -#include "remoting/protocol/jingle_session_manager.h" #include "remoting/protocol/connection_to_client.h" +#include "remoting/protocol/host_stub.h" +#include "remoting/protocol/input_stub.h" +#include "remoting/protocol/jingle_session_manager.h" +#include "remoting/protocol/session_config.h" using remoting::protocol::ConnectionToClient; @@ -32,6 +35,7 @@ ChromotingHost::ChromotingHost(ChromotingHostContext* context, config_(config), capturer_(capturer), input_stub_(input_stub), + host_stub_(new HostStubFake()), state_(kInitial) { } @@ -273,7 +277,8 @@ void ChromotingHost::OnNewClientSession( // If we accept the connected then create a client object and set the // callback. connection_ = new ConnectionToClient(context_->main_message_loop(), - this, NULL, input_stub_.get()); + this, host_stub_.get(), + input_stub_.get()); connection_->Init(session); } diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h index ab285ab..f3b908f 100644 --- a/remoting/host/chromoting_host.h +++ b/remoting/host/chromoting_host.h @@ -14,7 +14,6 @@ #include "remoting/host/heartbeat_sender.h" #include "remoting/jingle_glue/jingle_client.h" #include "remoting/jingle_glue/jingle_thread.h" -#include "remoting/protocol/input_stub.h" #include "remoting/protocol/session_manager.h" #include "remoting/protocol/connection_to_client.h" @@ -24,6 +23,8 @@ namespace remoting { namespace protocol { class ConnectionToClient; +class HostStub; +class InputStub; class SessionConfig; } // namespace protocol @@ -133,6 +134,9 @@ class ChromotingHost : public base::RefCountedThreadSafe, // InputStub in the host executes input events received from the client. scoped_ptr input_stub_; + // HostStub in the host executes control events received from the client. + scoped_ptr host_stub_; + // The libjingle client. This is used to connect to the talk network to // receive connection requests from chromoting client. scoped_refptr jingle_client_; diff --git a/remoting/host/host_stub_fake.cc b/remoting/host/host_stub_fake.cc new file mode 100644 index 0000000..179dd34 --- /dev/null +++ b/remoting/host/host_stub_fake.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2010 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 "base/task.h" +#include "remoting/host/host_stub_fake.h" + +namespace remoting { + +void HostStubFake::SuggestResolution( + const protocol::SuggestResolutionRequest* msg, Task* done) { + done->Run(); + delete done; +} + +} // namespace remoting diff --git a/remoting/host/host_stub_fake.h b/remoting/host/host_stub_fake.h new file mode 100644 index 0000000..5757b36 --- /dev/null +++ b/remoting/host/host_stub_fake.h @@ -0,0 +1,29 @@ +// Copyright (c) 2010 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. + +// A fake HostStub implementation that does not do anything. + +#ifndef REMOTING_PROTOCOL_HOST_STUB_FAKE_H_ +#define REMOTING_PROTOCOL_HOST_STUB_FAKE_H_ + +#include "base/basictypes.h" +#include "remoting/protocol/host_stub.h" + +namespace remoting { + +class HostStubFake : public protocol::HostStub { + public: + HostStubFake() {} + virtual ~HostStubFake() {} + + virtual void SuggestResolution( + const protocol::SuggestResolutionRequest* msg, Task* done); + + private: + DISALLOW_COPY_AND_ASSIGN(HostStubFake); +}; + +} // namespace remoting + +#endif // REMOTING_PROTOCOL_HOST_STUB_FAKE_H_ diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index e1b20d3..915ae65 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -205,6 +205,8 @@ 'host/host_config.h', 'host/host_key_pair.cc', 'host/host_key_pair.h', + 'host/host_stub_fake.cc', + 'host/host_stub_fake.h', 'host/json_host_config.cc', 'host/json_host_config.h', 'host/in_memory_host_config.cc', -- cgit v1.1