OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ChromotingClient is the controller for the Client implementation. | 5 // ChromotingClient is the controller for the Client implementation. |
6 | 6 |
7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, | 41 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, |
42 public protocol::ClientStub { | 42 public protocol::ClientStub { |
43 public: | 43 public: |
44 // |audio_player| may be null, in which case audio will not be requested. | 44 // |audio_player| may be null, in which case audio will not be requested. |
45 ChromotingClient(ClientContext* client_context, | 45 ChromotingClient(ClientContext* client_context, |
46 ClientUserInterface* user_interface, | 46 ClientUserInterface* user_interface, |
47 VideoRenderer* video_renderer, | 47 VideoRenderer* video_renderer, |
48 scoped_ptr<AudioPlayer> audio_player); | 48 scoped_ptr<AudioPlayer> audio_player); |
49 | 49 |
50 virtual ~ChromotingClient(); | 50 ~ChromotingClient() override; |
51 | 51 |
52 void SetProtocolConfigForTests( | 52 void SetProtocolConfigForTests( |
53 scoped_ptr<protocol::CandidateSessionConfig> config); | 53 scoped_ptr<protocol::CandidateSessionConfig> config); |
54 | 54 |
55 // Start the client. Must be called on the main thread. |signal_strategy| | 55 // Start the client. Must be called on the main thread. |signal_strategy| |
56 // must outlive the client. | 56 // must outlive the client. |
57 void Start(SignalStrategy* signal_strategy, | 57 void Start(SignalStrategy* signal_strategy, |
58 scoped_ptr<protocol::Authenticator> authenticator, | 58 scoped_ptr<protocol::Authenticator> authenticator, |
59 scoped_ptr<protocol::TransportFactory> transport_factory, | 59 scoped_ptr<protocol::TransportFactory> transport_factory, |
60 const std::string& host_jid, | 60 const std::string& host_jid, |
61 const std::string& capabilities); | 61 const std::string& capabilities); |
62 | 62 |
63 protocol::ConnectionToHost::State connection_state() const { | 63 protocol::ConnectionToHost::State connection_state() const { |
64 return connection_.state(); | 64 return connection_.state(); |
65 } | 65 } |
66 | 66 |
67 protocol::ClipboardStub* clipboard_forwarder() { | 67 protocol::ClipboardStub* clipboard_forwarder() { |
68 return connection_.clipboard_forwarder(); | 68 return connection_.clipboard_forwarder(); |
69 } | 69 } |
70 protocol::HostStub* host_stub() { return connection_.host_stub(); } | 70 protocol::HostStub* host_stub() { return connection_.host_stub(); } |
71 protocol::InputStub* input_stub() { return connection_.input_stub(); } | 71 protocol::InputStub* input_stub() { return connection_.input_stub(); } |
72 | 72 |
73 // ClientStub implementation. | 73 // ClientStub implementation. |
74 virtual void SetCapabilities( | 74 void SetCapabilities(const protocol::Capabilities& capabilities) override; |
75 const protocol::Capabilities& capabilities) override; | 75 void SetPairingResponse( |
76 virtual void SetPairingResponse( | |
77 const protocol::PairingResponse& pairing_response) override; | 76 const protocol::PairingResponse& pairing_response) override; |
78 virtual void DeliverHostMessage( | 77 void DeliverHostMessage(const protocol::ExtensionMessage& message) override; |
79 const protocol::ExtensionMessage& message) override; | |
80 | 78 |
81 // ClipboardStub implementation for receiving clipboard data from host. | 79 // ClipboardStub implementation for receiving clipboard data from host. |
82 virtual void InjectClipboardEvent( | 80 void InjectClipboardEvent(const protocol::ClipboardEvent& event) override; |
83 const protocol::ClipboardEvent& event) override; | |
84 | 81 |
85 // CursorShapeStub implementation for receiving cursor shape updates. | 82 // CursorShapeStub implementation for receiving cursor shape updates. |
86 virtual void SetCursorShape( | 83 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; |
87 const protocol::CursorShapeInfo& cursor_shape) override; | |
88 | 84 |
89 // ConnectionToHost::HostEventCallback implementation. | 85 // ConnectionToHost::HostEventCallback implementation. |
90 virtual void OnConnectionState( | 86 void OnConnectionState(protocol::ConnectionToHost::State state, |
91 protocol::ConnectionToHost::State state, | 87 protocol::ErrorCode error) override; |
92 protocol::ErrorCode error) override; | 88 void OnConnectionReady(bool ready) override; |
93 virtual void OnConnectionReady(bool ready) override; | 89 void OnRouteChanged(const std::string& channel_name, |
94 virtual void OnRouteChanged(const std::string& channel_name, | 90 const protocol::TransportRoute& route) override; |
95 const protocol::TransportRoute& route) override; | |
96 | 91 |
97 private: | 92 private: |
98 // Called when the connection is authenticated. | 93 // Called when the connection is authenticated. |
99 void OnAuthenticated(); | 94 void OnAuthenticated(); |
100 | 95 |
101 // Called when all channels are connected. | 96 // Called when all channels are connected. |
102 void OnChannelsConnected(); | 97 void OnChannelsConnected(); |
103 | 98 |
104 // The following are not owned by this class. | 99 // The following are not owned by this class. |
105 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 100 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
(...skipping 14 matching lines...) Expand all Loading... |
120 | 115 |
121 // Record the statistics of the connection. | 116 // Record the statistics of the connection. |
122 ChromotingStats stats_; | 117 ChromotingStats stats_; |
123 | 118 |
124 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 119 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
125 }; | 120 }; |
126 | 121 |
127 } // namespace remoting | 122 } // namespace remoting |
128 | 123 |
129 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 124 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
OLD | NEW |