summaryrefslogtreecommitdiffstats
path: root/remoting/host/fake_host_extension.h
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 12:51:43 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 12:51:43 +0000
commit1b478ba390decb3f225cbc8600dc306300fe2f26 (patch)
treef2e572a501250d65df65afbb4629bfa542e839e5 /remoting/host/fake_host_extension.h
parent18fb84786baf37f0ad6e4b33d6153a6e57496bc1 (diff)
downloadchromium_src-1b478ba390decb3f225cbc8600dc306300fe2f26.zip
chromium_src-1b478ba390decb3f225cbc8600dc306300fe2f26.tar.gz
chromium_src-1b478ba390decb3f225cbc8600dc306300fe2f26.tar.bz2
Add HostExtensionSessionManager to help ClientSession handle extensions.
This CL changes the HostExtension[Session] interface: 1. Each HostExtension may optionally specify one required capability; if the client does not offer the capability then the HostExtension is not instantiated for the session. 2. Each HostExtensionSession may optionally wrap or replace the video encoder or capturer for the session. 3. HostExtension[Session]s are passed the ClientSession's ClientSessionControl and ClientStub interfaces, rather than the concrete ClientSession class itself. 4. HostExtensionSessions may force the video pipeline to be re-created, if necessary. This will be used by the VideoFrameRecorder extension to allow it to wrap the VideoEncoder when it is first created. This CL also changes the host implementation and tests: 1. ChromotingHost passes the set of configured HostExtensions to each ClientSession to work with, rather than creating & applying HostExtensionSession instances directly. 2. All logic for managing HostExtension[Session]s is moved out of ClientSession into the new HostExtensionSessionManager sub-component. 3. The FakeExtension test implementation of HostExtension is moved out of the ClientSession unittests implementation, and updated to allow testing of e.g. encoder wrapping capabilities. Review URL: https://codereview.chromium.org/402233003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/fake_host_extension.h')
-rw-r--r--remoting/host/fake_host_extension.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/remoting/host/fake_host_extension.h b/remoting/host/fake_host_extension.h
new file mode 100644
index 0000000..e61828c
--- /dev/null
+++ b/remoting/host/fake_host_extension.h
@@ -0,0 +1,63 @@
+// Copyright 2014 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_HOST_FAKE_HOST_EXTENSION_H_
+#define REMOTING_HOST_FAKE_HOST_EXTENSION_H_
+
+#include <string>
+
+#include "remoting/host/host_extension.h"
+
+namespace remoting {
+
+class ClientSessionControl;
+class HostExtensionSession;
+
+namespace protocol {
+class ClientStub;
+}
+
+// |HostExtension| implementation that can report a specified capability, and
+// reports messages matching a specified type as having been handled.
+class FakeExtension : public HostExtension {
+ public:
+ FakeExtension(const std::string& message_type,
+ const std::string& capability);
+ virtual ~FakeExtension();
+
+ // HostExtension interface.
+ virtual std::string capability() const OVERRIDE;
+ virtual scoped_ptr<HostExtensionSession> CreateExtensionSession(
+ ClientSessionControl* client_session_control,
+ protocol::ClientStub* client_stub) OVERRIDE;
+
+ // Controls for testing.
+ void set_steal_video_capturer(bool steal_video_capturer);
+
+ // Accessors for testing.
+ bool has_handled_message();
+ bool has_wrapped_video_encoder();
+ bool has_wrapped_video_capturer();
+ bool was_instantiated() { return was_instantiated_; }
+
+ private:
+ class Session;
+ friend class Session;
+
+ std::string message_type_;
+ std::string capability_;
+
+ bool steal_video_capturer_;
+
+ bool has_handled_message_;
+ bool has_wrapped_video_encoder_;
+ bool has_wrapped_video_capturer_;
+ bool was_instantiated_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeExtension);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_FAKE_HOST_EXTENSION_H_