Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / remoting / client / chromoting_client.h
blob96950847bd68326853164ae8ee05616b659a659e
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // ChromotingClient is the controller for the Client implementation.
7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_
8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_
10 #include <string>
12 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "remoting/client/chromoting_stats.h"
15 #include "remoting/protocol/client_stub.h"
16 #include "remoting/protocol/clipboard_stub.h"
17 #include "remoting/protocol/connection_to_host.h"
18 #include "remoting/protocol/input_stub.h"
19 #include "remoting/protocol/video_stub.h"
21 namespace base {
22 class SingleThreadTaskRunner;
23 } // namespace base
25 namespace remoting {
27 namespace protocol {
28 class CandidateSessionConfig;
29 class TransportFactory;
30 } // namespace protocol
32 class AudioDecodeScheduler;
33 class AudioPlayer;
34 class ClientContext;
35 class ClientUserInterface;
36 class FrameConsumerProxy;
37 class FrameProducer;
38 class VideoRenderer;
39 class SignalStrategy;
41 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
42 public protocol::ClientStub {
43 public:
44 // |audio_player| may be null, in which case audio will not be requested.
45 ChromotingClient(ClientContext* client_context,
46 ClientUserInterface* user_interface,
47 VideoRenderer* video_renderer,
48 scoped_ptr<AudioPlayer> audio_player);
50 ~ChromotingClient() override;
52 void SetProtocolConfigForTests(
53 scoped_ptr<protocol::CandidateSessionConfig> config);
55 // Start the client. Must be called on the main thread. |signal_strategy|
56 // must outlive the client.
57 void Start(SignalStrategy* signal_strategy,
58 scoped_ptr<protocol::Authenticator> authenticator,
59 scoped_ptr<protocol::TransportFactory> transport_factory,
60 const std::string& host_jid,
61 const std::string& capabilities);
63 protocol::ConnectionToHost::State connection_state() const {
64 return connection_.state();
67 protocol::ClipboardStub* clipboard_forwarder() {
68 return connection_.clipboard_forwarder();
70 protocol::HostStub* host_stub() { return connection_.host_stub(); }
71 protocol::InputStub* input_stub() { return connection_.input_stub(); }
73 // ClientStub implementation.
74 void SetCapabilities(const protocol::Capabilities& capabilities) override;
75 void SetPairingResponse(
76 const protocol::PairingResponse& pairing_response) override;
77 void DeliverHostMessage(const protocol::ExtensionMessage& message) override;
79 // ClipboardStub implementation for receiving clipboard data from host.
80 void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;
82 // CursorShapeStub implementation for receiving cursor shape updates.
83 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
85 // ConnectionToHost::HostEventCallback implementation.
86 void OnConnectionState(protocol::ConnectionToHost::State state,
87 protocol::ErrorCode error) override;
88 void OnConnectionReady(bool ready) override;
89 void OnRouteChanged(const std::string& channel_name,
90 const protocol::TransportRoute& route) override;
92 private:
93 // Called when the connection is authenticated.
94 void OnAuthenticated();
96 // Called when all channels are connected.
97 void OnChannelsConnected();
99 // The following are not owned by this class.
100 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
101 ClientUserInterface* user_interface_;
102 VideoRenderer* video_renderer_;
104 protocol::ConnectionToHost connection_;
106 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_;
108 std::string local_capabilities_;
110 // The set of all capabilities supported by the host.
111 std::string host_capabilities_;
113 // True if |protocol::Capabilities| message has been received.
114 bool host_capabilities_received_;
116 // Record the statistics of the connection.
117 ChromotingStats stats_;
119 DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
122 } // namespace remoting
124 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_