Chromium Code Reviews| 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 <list> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.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/client/chromoting_view.h" | 17 #include "remoting/client/chromoting_view.h" |
| 18 #include "remoting/protocol/audio_stub.h" | |
| 18 #include "remoting/protocol/client_stub.h" | 19 #include "remoting/protocol/client_stub.h" |
| 19 #include "remoting/protocol/clipboard_stub.h" | 20 #include "remoting/protocol/clipboard_stub.h" |
| 20 #include "remoting/protocol/connection_to_host.h" | 21 #include "remoting/protocol/connection_to_host.h" |
| 21 #include "remoting/protocol/input_stub.h" | 22 #include "remoting/protocol/input_stub.h" |
| 22 #include "remoting/protocol/video_stub.h" | 23 #include "remoting/protocol/video_stub.h" |
| 23 #include "remoting/jingle_glue/xmpp_proxy.h" | 24 #include "remoting/jingle_glue/xmpp_proxy.h" |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 27 } // namespace base | 28 } // namespace base |
| 28 | 29 |
| 29 namespace remoting { | 30 namespace remoting { |
| 30 | 31 |
| 31 namespace protocol { | 32 namespace protocol { |
| 32 class TransportFactory; | 33 class TransportFactory; |
| 33 } // namespace protocol | 34 } // namespace protocol |
| 34 | 35 |
| 35 class RectangleUpdateDecoder; | 36 class RectangleUpdateDecoder; |
| 36 | 37 |
| 37 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder. | 38 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder. |
| 38 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, | 39 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, |
| 39 public protocol::ClientStub, | 40 public protocol::ClientStub, |
| 40 public protocol::VideoStub { | 41 public protocol::VideoStub, |
| 42 public protocol::AudioStub { | |
| 41 public: | 43 public: |
| 42 // Objects passed in are not owned by this class. | 44 // Objects passed in are not owned by this class. |
| 43 ChromotingClient(const ClientConfig& config, | 45 ChromotingClient(const ClientConfig& config, |
| 44 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 46 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 45 protocol::ConnectionToHost* connection, | 47 protocol::ConnectionToHost* connection, |
| 46 ChromotingView* view, | 48 ChromotingView* view, |
| 47 RectangleUpdateDecoder* rectangle_decoder); | 49 RectangleUpdateDecoder* rectangle_decoder); |
| 48 virtual ~ChromotingClient(); | 50 virtual ~ChromotingClient(); |
| 49 | 51 |
| 50 // Start/stop the client. Must be called on the main thread. | 52 // Start/stop the client. Must be called on the main thread. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 64 OVERRIDE; | 66 OVERRIDE; |
| 65 | 67 |
| 66 // ConnectionToHost::HostEventCallback implementation. | 68 // ConnectionToHost::HostEventCallback implementation. |
| 67 virtual void OnConnectionState( | 69 virtual void OnConnectionState( |
| 68 protocol::ConnectionToHost::State state, | 70 protocol::ConnectionToHost::State state, |
| 69 protocol::ErrorCode error) OVERRIDE; | 71 protocol::ErrorCode error) OVERRIDE; |
| 70 | 72 |
| 71 // VideoStub implementation. | 73 // VideoStub implementation. |
| 72 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 74 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
| 73 const base::Closure& done) OVERRIDE; | 75 const base::Closure& done) OVERRIDE; |
| 74 virtual int GetPendingPackets() OVERRIDE; | 76 virtual int GetPendingPackets() OVERRIDE; |
|
Wez
2012/06/19 03:29:31
nit: This should be renamed PendingVideoPacketCoun
kxing
2012/06/20 22:30:06
This CL is already getting pretty huge.
I'll do t
| |
| 75 | 77 |
| 78 // AudioStub implementation. | |
| 79 virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> packet, | |
| 80 const base::Closure& done) OVERRIDE; | |
| 81 | |
| 76 private: | 82 private: |
| 77 struct QueuedVideoPacket { | 83 struct QueuedVideoPacket { |
| 78 QueuedVideoPacket(scoped_ptr<VideoPacket> packet, | 84 QueuedVideoPacket(scoped_ptr<VideoPacket> packet, |
| 79 const base::Closure& done); | 85 const base::Closure& done); |
| 80 ~QueuedVideoPacket(); | 86 ~QueuedVideoPacket(); |
| 81 VideoPacket* packet; | 87 VideoPacket* packet; |
| 82 base::Closure done; | 88 base::Closure done; |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 // Initializes connection. | 91 // Initializes connection. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 // WeakPtr used to avoid tasks accessing the client after it is deleted. | 131 // WeakPtr used to avoid tasks accessing the client after it is deleted. |
| 126 base::WeakPtrFactory<ChromotingClient> weak_factory_; | 132 base::WeakPtrFactory<ChromotingClient> weak_factory_; |
| 127 base::WeakPtr<ChromotingClient> weak_ptr_; | 133 base::WeakPtr<ChromotingClient> weak_ptr_; |
| 128 | 134 |
| 129 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 135 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
| 130 }; | 136 }; |
| 131 | 137 |
| 132 } // namespace remoting | 138 } // namespace remoting |
| 133 | 139 |
| 134 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ | 140 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ |
| OLD | NEW |