OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // JingleConnectionToHost implements the ConnectionToHost interface using | 5 // JingleConnectionToHost implements the ConnectionToHost interface using |
6 // libjingle as the transport protocol. | 6 // libjingle as the transport protocol. |
7 // | 7 // |
8 // Much of this class focuses on translating JingleClient and | 8 // Much of this class focuses on translating JingleClient and |
9 // ChromotingConnection callbacks into ConnectionToHost::HostEventCallback | 9 // ChromotingConnection callbacks into ConnectionToHost::HostEventCallback |
10 // messages. | 10 // messages. |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "remoting/protocol/message_reader.h" | 27 #include "remoting/protocol/message_reader.h" |
28 #include "remoting/protocol/session.h" | 28 #include "remoting/protocol/session.h" |
29 #include "remoting/protocol/session_manager.h" | 29 #include "remoting/protocol/session_manager.h" |
30 #include "remoting/protocol/stream_writer.h" | 30 #include "remoting/protocol/stream_writer.h" |
31 | 31 |
32 class MessageLoop; | 32 class MessageLoop; |
33 | 33 |
34 namespace remoting { | 34 namespace remoting { |
35 | 35 |
36 class JingleThread; | 36 class JingleThread; |
| 37 class VideoPacket; |
37 | 38 |
38 namespace protocol { | 39 namespace protocol { |
39 | 40 |
40 class VideoReader; | 41 class VideoReader; |
41 class VideoStub; | 42 class VideoStub; |
42 | 43 |
43 class JingleConnectionToHost : public ConnectionToHost, | 44 class JingleConnectionToHost : public ConnectionToHost, |
44 public JingleClient::Callback { | 45 public JingleClient::Callback { |
45 public: | 46 public: |
46 // TODO(sergeyu): Constructor shouldn't need thread here. | 47 // TODO(sergeyu): Constructor shouldn't need thread here. |
47 explicit JingleConnectionToHost(JingleThread* thread); | 48 explicit JingleConnectionToHost(JingleThread* thread); |
48 virtual ~JingleConnectionToHost(); | 49 virtual ~JingleConnectionToHost(); |
49 | 50 |
50 virtual void Connect(const std::string& username, | 51 virtual void Connect(const std::string& username, |
51 const std::string& auth_token, | 52 const std::string& auth_token, |
52 const std::string& host_jid, | 53 const std::string& host_jid, |
53 HostEventCallback* event_callback, | 54 HostEventCallback* event_callback, |
54 VideoStub* video_stub); | 55 VideoStub* video_stub); |
55 virtual void Disconnect(); | 56 virtual void Disconnect(); |
56 | 57 |
| 58 virtual const SessionConfig* config(); |
| 59 |
57 virtual void SendEvent(const ChromotingClientMessage& msg); | 60 virtual void SendEvent(const ChromotingClientMessage& msg); |
58 | 61 |
59 // JingleClient::Callback interface. | 62 // JingleClient::Callback interface. |
60 virtual void OnStateChange(JingleClient* client, JingleClient::State state); | 63 virtual void OnStateChange(JingleClient* client, JingleClient::State state); |
61 | 64 |
62 // Callback for chromotocol SessionManager. | 65 // Callback for chromotocol SessionManager. |
63 void OnNewSession( | 66 void OnNewSession( |
64 protocol::Session* connection, | 67 protocol::Session* connection, |
65 protocol::SessionManager::IncomingSessionResponse* response); | 68 protocol::SessionManager::IncomingSessionResponse* response); |
66 | 69 |
67 // Callback for chromotocol Session. | 70 // Callback for chromotocol Session. |
68 void OnSessionStateChange(protocol::Session::State state); | 71 void OnSessionStateChange(protocol::Session::State state); |
69 | 72 |
70 private: | 73 private: |
71 // The message loop for the jingle thread this object works on. | 74 // The message loop for the jingle thread this object works on. |
72 MessageLoop* message_loop(); | 75 MessageLoop* message_loop(); |
73 | 76 |
74 // Called on the jingle thread after we've successfully to XMPP server. Starts | 77 // Called on the jingle thread after we've successfully to XMPP server. Starts |
75 // P2P connection to the host. | 78 // P2P connection to the host. |
76 void InitSession(); | 79 void InitSession(); |
77 | 80 |
78 // Callback for |control_reader_|. | 81 // Callback for |control_reader_|. |
79 void OnControlMessage(ChromotingHostMessage* msg); | 82 void OnControlMessage(ControlMessage* msg); |
80 | 83 |
81 // Callback for |video_reader_|. | 84 // Callback for |video_reader_|. |
82 void OnVideoPacket(VideoPacket* packet); | 85 void OnVideoPacket(VideoPacket* packet); |
83 | 86 |
84 // Used by Disconnect() to disconnect chromoting connection, stop chromoting | 87 // Used by Disconnect() to disconnect chromoting connection, stop chromoting |
85 // server, and then disconnect XMPP connection. | 88 // server, and then disconnect XMPP connection. |
86 void OnDisconnected(); | 89 void OnDisconnected(); |
87 void OnServerClosed(); | 90 void OnServerClosed(); |
88 | 91 |
89 JingleThread* thread_; | 92 JingleThread* thread_; |
(...skipping 13 matching lines...) Expand all Loading... |
103 | 106 |
104 DISALLOW_COPY_AND_ASSIGN(JingleConnectionToHost); | 107 DISALLOW_COPY_AND_ASSIGN(JingleConnectionToHost); |
105 }; | 108 }; |
106 | 109 |
107 } // namespace protocol | 110 } // namespace protocol |
108 } // namespace remoting | 111 } // namespace remoting |
109 | 112 |
110 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::JingleConnectionToHost); | 113 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::JingleConnectionToHost); |
111 | 114 |
112 #endif // REMOTING_PROTOCOL_JINGLE_CONNECTION_TO_HOST_H_ | 115 #endif // REMOTING_PROTOCOL_JINGLE_CONNECTION_TO_HOST_H_ |
OLD | NEW |