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 #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/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 virtual void OnStateChange(JingleClient* client, JingleClient::State state); | 73 virtual void OnStateChange(JingleClient* client, JingleClient::State state); |
74 | 74 |
75 // Callback for chromotocol SessionManager. | 75 // Callback for chromotocol SessionManager. |
76 void OnNewSession( | 76 void OnNewSession( |
77 Session* connection, | 77 Session* connection, |
78 SessionManager::IncomingSessionResponse* response); | 78 SessionManager::IncomingSessionResponse* response); |
79 | 79 |
80 // Callback for chromotocol Session. | 80 // Callback for chromotocol Session. |
81 void OnSessionStateChange(Session::State state); | 81 void OnSessionStateChange(Session::State state); |
82 | 82 |
| 83 // Record whether the client has been properly authenticated with the host. |
| 84 void SetClientAuthenticated(bool enable); |
| 85 |
83 private: | 86 private: |
84 // The message loop for the jingle thread this object works on. | 87 // The message loop for the jingle thread this object works on. |
85 MessageLoop* message_loop(); | 88 MessageLoop* message_loop(); |
86 | 89 |
87 // Called on the jingle thread after we've successfully to XMPP server. Starts | 90 // Called on the jingle thread after we've successfully to XMPP server. Starts |
88 // P2P connection to the host. | 91 // P2P connection to the host. |
89 void InitSession(); | 92 void InitSession(); |
90 | 93 |
91 // Callback for |video_reader_|. | 94 // Callback for |video_reader_|. |
92 void OnVideoPacket(VideoPacket* packet); | 95 void OnVideoPacket(VideoPacket* packet); |
93 | 96 |
94 // Used by Disconnect() to disconnect chromoting connection, stop chromoting | 97 // Used by Disconnect() to disconnect chromoting connection, stop chromoting |
95 // server, and then disconnect XMPP connection. | 98 // server, and then disconnect XMPP connection. |
96 void OnDisconnected(); | 99 void OnDisconnected(); |
97 void OnServerClosed(); | 100 void OnServerClosed(); |
98 | 101 |
| 102 // Initially false, this is set to true once the client has authenticated |
| 103 // properly. When this is false, many messages to the host (like input events) |
| 104 // will be suppressed. |
| 105 bool client_authenticated_; |
| 106 |
99 JingleThread* thread_; | 107 JingleThread* thread_; |
100 | 108 |
101 scoped_ptr<SignalStrategy> signal_strategy_; | 109 scoped_ptr<SignalStrategy> signal_strategy_; |
102 scoped_refptr<JingleClient> jingle_client_; | 110 scoped_refptr<JingleClient> jingle_client_; |
103 scoped_refptr<SessionManager> session_manager_; | 111 scoped_refptr<SessionManager> session_manager_; |
104 scoped_refptr<Session> session_; | 112 scoped_refptr<Session> session_; |
105 | 113 |
106 scoped_ptr<VideoReader> video_reader_; | 114 scoped_ptr<VideoReader> video_reader_; |
107 | 115 |
108 HostEventCallback* event_callback_; | 116 HostEventCallback* event_callback_; |
(...skipping 26 matching lines...) Expand all Loading... |
135 private: | 143 private: |
136 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 144 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
137 }; | 145 }; |
138 | 146 |
139 } // namespace protocol | 147 } // namespace protocol |
140 } // namespace remoting | 148 } // namespace remoting |
141 | 149 |
142 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); | 150 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); |
143 | 151 |
144 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 152 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |