| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
| 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/task.h" | 12 #include "base/task.h" |
| 13 #include "remoting/jingle_glue/signal_strategy.h" | 13 #include "remoting/jingle_glue/signal_strategy.h" |
| 14 #include "remoting/proto/internal.pb.h" | 14 #include "remoting/proto/internal.pb.h" |
| 15 #include "remoting/protocol/connection_to_host.h" | 15 #include "remoting/protocol/connection_to_host.h" |
| 16 #include "remoting/protocol/host_stub.h" | |
| 17 #include "remoting/protocol/input_stub.h" | |
| 18 #include "remoting/protocol/message_reader.h" | 16 #include "remoting/protocol/message_reader.h" |
| 19 #include "remoting/protocol/session.h" | 17 #include "remoting/protocol/session.h" |
| 20 #include "remoting/protocol/session_manager.h" | 18 #include "remoting/protocol/session_manager.h" |
| 21 | 19 |
| 22 class MessageLoop; | 20 class MessageLoop; |
| 23 | 21 |
| 24 namespace talk_base { | 22 namespace talk_base { |
| 25 class NetworkManager; | 23 class NetworkManager; |
| 26 class PacketSocketFactory; | 24 class PacketSocketFactory; |
| 27 } // namespace talk_base | 25 } // namespace talk_base |
| 28 | 26 |
| 29 namespace remoting { | 27 namespace remoting { |
| 30 | 28 |
| 31 class JingleThread; | 29 class JingleThread; |
| 32 class PortAllocatorSessionFactory; | 30 class PortAllocatorSessionFactory; |
| 33 class XmppProxy; | 31 class XmppProxy; |
| 34 class VideoPacket; | 32 class VideoPacket; |
| 35 | 33 |
| 36 namespace protocol { | 34 namespace protocol { |
| 37 | 35 |
| 38 class ClientMessageDispatcher; | 36 class ClientMessageDispatcher; |
| 37 class ClientControlSender; |
| 39 class ClientStub; | 38 class ClientStub; |
| 39 class HostControlSender; |
| 40 class HostStub; |
| 41 class InputSender; |
| 42 class InputStub; |
| 40 class SessionConfig; | 43 class SessionConfig; |
| 41 class VideoReader; | 44 class VideoReader; |
| 42 class VideoStub; | 45 class VideoStub; |
| 43 | 46 |
| 44 class ConnectionToHost : public SignalStrategy::StatusObserver { | 47 class ConnectionToHost : public SignalStrategy::StatusObserver { |
| 45 public: | 48 public: |
| 46 enum State { | 49 enum State { |
| 47 STATE_EMPTY, | 50 STATE_EMPTY, |
| 48 STATE_CONNECTED, | 51 STATE_CONNECTED, |
| 49 STATE_AUTHENTICATED, | 52 STATE_AUTHENTICATED, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 State state() const; | 115 State state() const; |
| 113 | 116 |
| 114 private: | 117 private: |
| 115 // Called on the jingle thread after we've successfully to XMPP server. Starts | 118 // Called on the jingle thread after we've successfully to XMPP server. Starts |
| 116 // P2P connection to the host. | 119 // P2P connection to the host. |
| 117 void InitSession(); | 120 void InitSession(); |
| 118 | 121 |
| 119 // Callback for |video_reader_|. | 122 // Callback for |video_reader_|. |
| 120 void OnVideoPacket(VideoPacket* packet); | 123 void OnVideoPacket(VideoPacket* packet); |
| 121 | 124 |
| 125 // Stops writing in the channels. |
| 126 void CloseChannels(); |
| 127 |
| 122 // Used by Disconnect() to disconnect chromoting connection, stop chromoting | 128 // Used by Disconnect() to disconnect chromoting connection, stop chromoting |
| 123 // server, and then disconnect XMPP connection. | 129 // server, and then disconnect XMPP connection. |
| 124 void OnDisconnected(const base::Closure& shutdown_task); | 130 void OnDisconnected(const base::Closure& shutdown_task); |
| 125 void OnServerClosed(const base::Closure& shutdown_task); | 131 void OnServerClosed(const base::Closure& shutdown_task); |
| 126 | 132 |
| 127 // Internal state of the connection. | 133 // Internal state of the connection. |
| 128 State state_; | 134 State state_; |
| 129 | 135 |
| 130 MessageLoop* message_loop_; | 136 MessageLoop* message_loop_; |
| 131 | 137 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 145 std::string host_jid_; | 151 std::string host_jid_; |
| 146 std::string host_public_key_; | 152 std::string host_public_key_; |
| 147 std::string access_code_; | 153 std::string access_code_; |
| 148 | 154 |
| 149 scoped_ptr<ClientMessageDispatcher> dispatcher_; | 155 scoped_ptr<ClientMessageDispatcher> dispatcher_; |
| 150 | 156 |
| 151 //////////////////////////////////////////////////////////////////////////// | 157 //////////////////////////////////////////////////////////////////////////// |
| 152 // User input event channel interface | 158 // User input event channel interface |
| 153 | 159 |
| 154 // Stub for sending input event messages to the host. | 160 // Stub for sending input event messages to the host. |
| 155 scoped_ptr<InputStub> input_stub_; | 161 scoped_ptr<InputSender> input_sender_; |
| 156 | 162 |
| 157 //////////////////////////////////////////////////////////////////////////// | 163 //////////////////////////////////////////////////////////////////////////// |
| 158 // Protocol control channel interface | 164 // Protocol control channel interface |
| 159 | 165 |
| 160 // Stub for sending control messages to the host. | 166 // Stub for sending control messages to the host. |
| 161 scoped_ptr<HostStub> host_stub_; | 167 scoped_ptr<HostControlSender> host_control_sender_; |
| 162 | 168 |
| 163 // Stub for receiving control messages from the host. | 169 // Stub for receiving control messages from the host. |
| 164 ClientStub* client_stub_; | 170 ClientStub* client_stub_; |
| 165 | 171 |
| 166 //////////////////////////////////////////////////////////////////////////// | 172 //////////////////////////////////////////////////////////////////////////// |
| 167 // Video channel interface | 173 // Video channel interface |
| 168 | 174 |
| 169 // Stub for receiving video packets from the host. | 175 // Stub for receiving video packets from the host. |
| 170 VideoStub* video_stub_; | 176 VideoStub* video_stub_; |
| 171 | 177 |
| 172 private: | 178 private: |
| 173 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 179 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
| 174 }; | 180 }; |
| 175 | 181 |
| 176 } // namespace protocol | 182 } // namespace protocol |
| 177 } // namespace remoting | 183 } // namespace remoting |
| 178 | 184 |
| 179 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); | 185 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); |
| 180 | 186 |
| 181 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 187 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
| OLD | NEW |