| 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 <list> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "remoting/client/client_config.h" | 15 #include "remoting/client/client_config.h" |
| 16 #include "remoting/client/chromoting_stats.h" | 16 #include "remoting/client/chromoting_stats.h" |
| 17 #include "remoting/protocol/client_stub.h" | 17 #include "remoting/protocol/client_stub.h" |
| 18 #include "remoting/protocol/clipboard_stub.h" | 18 #include "remoting/protocol/clipboard_stub.h" |
| 19 #include "remoting/protocol/connection_to_host.h" | 19 #include "remoting/protocol/connection_to_host.h" |
| 20 #include "remoting/protocol/input_stub.h" | 20 #include "remoting/protocol/input_stub.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Start/stop the client. Must be called on the main thread. | 54 // Start/stop the client. Must be called on the main thread. |
| 55 void Start(scoped_refptr<XmppProxy> xmpp_proxy, | 55 void Start(scoped_refptr<XmppProxy> xmpp_proxy, |
| 56 scoped_ptr<protocol::TransportFactory> transport_factory); | 56 scoped_ptr<protocol::TransportFactory> transport_factory); |
| 57 void Stop(const base::Closure& shutdown_task); | 57 void Stop(const base::Closure& shutdown_task); |
| 58 | 58 |
| 59 FrameProducer* GetFrameProducer(); | 59 FrameProducer* GetFrameProducer(); |
| 60 | 60 |
| 61 // Return the stats recorded by this client. | 61 // Return the stats recorded by this client. |
| 62 ChromotingStats* GetStats(); | 62 ChromotingStats* GetStats(); |
| 63 | 63 |
| 64 // ClientStub implementation. |
| 65 virtual void SetCapabilities( |
| 66 const protocol::Capabilities& capabilities) OVERRIDE; |
| 67 |
| 64 // ClipboardStub implementation for receiving clipboard data from host. | 68 // ClipboardStub implementation for receiving clipboard data from host. |
| 65 virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event) | 69 virtual void InjectClipboardEvent( |
| 66 OVERRIDE; | 70 const protocol::ClipboardEvent& event) OVERRIDE; |
| 67 | 71 |
| 68 // CursorShapeStub implementation for receiving cursor shape updates. | 72 // CursorShapeStub implementation for receiving cursor shape updates. |
| 69 virtual void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) | 73 virtual void SetCursorShape( |
| 70 OVERRIDE; | 74 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; |
| 71 | 75 |
| 72 // ConnectionToHost::HostEventCallback implementation. | 76 // ConnectionToHost::HostEventCallback implementation. |
| 73 virtual void OnConnectionState( | 77 virtual void OnConnectionState( |
| 74 protocol::ConnectionToHost::State state, | 78 protocol::ConnectionToHost::State state, |
| 75 protocol::ErrorCode error) OVERRIDE; | 79 protocol::ErrorCode error) OVERRIDE; |
| 76 virtual void OnConnectionReady(bool ready) OVERRIDE; | 80 virtual void OnConnectionReady(bool ready) OVERRIDE; |
| 77 | 81 |
| 78 private: | 82 private: |
| 79 // Initializes connection. | 83 // Initializes connection. |
| 80 void Initialize(); | 84 void Initialize(); |
| 81 | 85 |
| 82 void OnDisconnected(const base::Closure& shutdown_task); | 86 void OnDisconnected(const base::Closure& shutdown_task); |
| 83 | 87 |
| 84 // The following are not owned by this class. | 88 // The following are not owned by this class. |
| 85 ClientConfig config_; | 89 ClientConfig config_; |
| 86 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 90 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 87 protocol::ConnectionToHost* connection_; | 91 protocol::ConnectionToHost* connection_; |
| 88 ClientUserInterface* user_interface_; | 92 ClientUserInterface* user_interface_; |
| 89 scoped_refptr<RectangleUpdateDecoder> rectangle_decoder_; | 93 scoped_refptr<RectangleUpdateDecoder> rectangle_decoder_; |
| 90 | 94 |
| 91 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_; | 95 scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_; |
| 92 | 96 |
| 93 // If non-NULL, this is called when the client is done. | 97 // If non-NULL, this is called when the client is done. |
| 94 base::Closure client_done_; | 98 base::Closure client_done_; |
| 95 | 99 |
| 100 // The set of all capabilities supported by the host. |
| 101 std::string host_capabilities_; |
| 102 |
| 103 // True if |protocol::Capabilities| message has been received. |
| 104 bool host_capabilities_received_; |
| 105 |
| 96 // Record the statistics of the connection. | 106 // Record the statistics of the connection. |
| 97 ChromotingStats stats_; | 107 ChromotingStats stats_; |
| 98 | 108 |
| 99 // WeakPtr used to avoid tasks accessing the client after it is deleted. | 109 // WeakPtr used to avoid tasks accessing the client after it is deleted. |
| 100 base::WeakPtrFactory<ChromotingClient> weak_factory_; | 110 base::WeakPtrFactory<ChromotingClient> weak_factory_; |
| 101 base::WeakPtr<ChromotingClient> weak_ptr_; | 111 base::WeakPtr<ChromotingClient> weak_ptr_; |
| 102 | 112 |
| 103 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 113 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
| 104 }; | 114 }; |
| 105 | 115 |
| 106 } // namespace remoting | 116 } // namespace remoting |
| 107 | 117 |
| 108 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 118 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
| OLD | NEW |