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_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // | 65 // |
66 // After this method is called all the send method calls will be ignored. | 66 // After this method is called all the send method calls will be ignored. |
67 virtual void Disconnect(); | 67 virtual void Disconnect(); |
68 | 68 |
69 // Send encoded update stream data to the viewer. | 69 // Send encoded update stream data to the viewer. |
70 virtual VideoStub* video_stub(); | 70 virtual VideoStub* video_stub(); |
71 | 71 |
72 // Return pointer to ClientStub. | 72 // Return pointer to ClientStub. |
73 virtual ClientStub* client_stub(); | 73 virtual ClientStub* client_stub(); |
74 | 74 |
75 protected: | 75 // Record whether the client has been properly authenticated with the host. |
76 // Protected constructor used by unit test. | 76 void SetClientAuthenticated(bool auth); |
77 ConnectionToClient(); | |
78 | 77 |
79 private: | 78 private: |
80 // Callback for protocol Session. | 79 // Callback for protocol Session. |
81 void OnSessionStateChange(Session::State state); | 80 void OnSessionStateChange(Session::State state); |
82 | 81 |
83 // Process a libjingle state change event on the |loop_|. | 82 // Process a libjingle state change event on the |loop_|. |
84 void StateChangeTask(Session::State state); | 83 void StateChangeTask(Session::State state); |
85 | 84 |
86 void OnClosed(); | 85 void OnClosed(); |
87 | 86 |
| 87 // Initially false, this is set to true once the client has authenticated |
| 88 // properly. When this is false, many client messages (like input events) |
| 89 // will be ignored. |
| 90 bool client_authenticated_; |
| 91 |
88 // The libjingle channel used to send and receive data from the remote client. | 92 // The libjingle channel used to send and receive data from the remote client. |
89 scoped_refptr<Session> session_; | 93 scoped_refptr<Session> session_; |
90 | 94 |
91 scoped_ptr<VideoWriter> video_writer_; | 95 scoped_ptr<VideoWriter> video_writer_; |
92 | 96 |
93 // ClientStub for sending messages to the client. | 97 // ClientStub for sending messages to the client. |
94 scoped_ptr<ClientStub> client_stub_; | 98 scoped_ptr<ClientStub> client_stub_; |
95 | 99 |
96 // The message loop that this object runs on. | 100 // The message loop that this object runs on. |
97 MessageLoop* loop_; | 101 MessageLoop* loop_; |
(...skipping 10 matching lines...) Expand all Loading... |
108 // Dispatcher for submitting messages to stubs. | 112 // Dispatcher for submitting messages to stubs. |
109 scoped_ptr<HostMessageDispatcher> dispatcher_; | 113 scoped_ptr<HostMessageDispatcher> dispatcher_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 115 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace protocol | 118 } // namespace protocol |
115 } // namespace remoting | 119 } // namespace remoting |
116 | 120 |
117 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 121 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |