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_CHROMOTING_HOST_H_ | 5 #ifndef REMOTING_CHROMOTING_HOST_H_ |
6 #define REMOTING_CHROMOTING_HOST_H_ | 6 #define REMOTING_CHROMOTING_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual void OnConnectionOpened(protocol::ConnectionToClient* client); | 99 virtual void OnConnectionOpened(protocol::ConnectionToClient* client); |
100 virtual void OnConnectionClosed(protocol::ConnectionToClient* client); | 100 virtual void OnConnectionClosed(protocol::ConnectionToClient* client); |
101 virtual void OnConnectionFailed(protocol::ConnectionToClient* client); | 101 virtual void OnConnectionFailed(protocol::ConnectionToClient* client); |
102 | 102 |
103 //////////////////////////////////////////////////////////////////////////// | 103 //////////////////////////////////////////////////////////////////////////// |
104 // JingleClient::Callback implementations | 104 // JingleClient::Callback implementations |
105 virtual void OnStateChange(JingleClient* client, JingleClient::State state); | 105 virtual void OnStateChange(JingleClient* client, JingleClient::State state); |
106 | 106 |
107 //////////////////////////////////////////////////////////////////////////// | 107 //////////////////////////////////////////////////////////////////////////// |
108 // DesktopEnvironment::EventHandler implementations | 108 // DesktopEnvironment::EventHandler implementations |
109 virtual void LocalLoginSucceeded(); | 109 virtual void LocalLoginSucceeded(protocol::ConnectionToClient* client); |
110 virtual void LocalLoginFailed(); | 110 virtual void LocalLoginFailed(protocol::ConnectionToClient* client); |
111 | 111 |
112 // Callback for ChromotingServer. | 112 // Callback for ChromotingServer. |
113 void OnNewClientSession( | 113 void OnNewClientSession( |
114 protocol::Session* session, | 114 protocol::Session* session, |
115 protocol::SessionManager::IncomingSessionResponse* response); | 115 protocol::SessionManager::IncomingSessionResponse* response); |
116 | 116 |
117 // Sets desired configuration for the protocol. Ownership of the | 117 // Sets desired configuration for the protocol. Ownership of the |
118 // |config| is transferred to the object. Must be called before Start(). | 118 // |config| is transferred to the object. Must be called before Start(). |
119 void set_protocol_config(protocol::CandidateSessionConfig* config); | 119 void set_protocol_config(protocol::CandidateSessionConfig* config); |
120 | 120 |
121 // This getter is only used in unit test. | 121 // This getter is only used in unit test. |
122 protocol::HostStub* host_stub() const; | 122 protocol::HostStub* host_stub() const; |
123 | 123 |
124 // This setter is only used in unit test to simulate client connection. | 124 // This setter is only used in unit test to simulate client connection. |
125 void set_connection(protocol::ConnectionToClient* conn) { | 125 void add_connection(protocol::ConnectionToClient* conn) { |
126 connection_ = conn; | 126 connections_.push_back(conn); |
127 } | 127 } |
128 | 128 |
129 private: | 129 private: |
130 friend class base::RefCountedThreadSafe<ChromotingHost>; | 130 friend class base::RefCountedThreadSafe<ChromotingHost>; |
131 | 131 |
132 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, | 132 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, |
133 DesktopEnvironment* environment); | 133 DesktopEnvironment* environment); |
134 virtual ~ChromotingHost(); | 134 virtual ~ChromotingHost(); |
135 | 135 |
136 enum State { | 136 enum State { |
(...skipping 23 matching lines...) Expand all Loading... |
160 // receive connection requests from chromoting client. | 160 // receive connection requests from chromoting client. |
161 scoped_refptr<JingleClient> jingle_client_; | 161 scoped_refptr<JingleClient> jingle_client_; |
162 | 162 |
163 scoped_refptr<protocol::SessionManager> session_manager_; | 163 scoped_refptr<protocol::SessionManager> session_manager_; |
164 | 164 |
165 // Objects that takes care of sending heartbeats to the chromoting bot. | 165 // Objects that takes care of sending heartbeats to the chromoting bot. |
166 scoped_refptr<HeartbeatSender> heartbeat_sender_; | 166 scoped_refptr<HeartbeatSender> heartbeat_sender_; |
167 | 167 |
168 AccessVerifier access_verifier_; | 168 AccessVerifier access_verifier_; |
169 | 169 |
170 // A ConnectionToClient manages the connectino to a remote client. | 170 // A ConnectionToClient manages the connection to a remote client. |
171 // TODO(hclam): Expand this to a list of clients. | 171 std::vector<scoped_refptr<protocol::ConnectionToClient>> connections_; |
172 scoped_refptr<protocol::ConnectionToClient> connection_; | |
173 | 172 |
174 // Session manager for the host process. | 173 // Session manager for the host process. |
175 scoped_refptr<ScreenRecorder> recorder_; | 174 scoped_refptr<ScreenRecorder> recorder_; |
176 | 175 |
177 // This task gets executed when this object fails to connect to the | 176 // This task gets executed when this object fails to connect to the |
178 // talk network or Shutdown() is called. | 177 // talk network or Shutdown() is called. |
179 scoped_ptr<Task> shutdown_task_; | 178 scoped_ptr<Task> shutdown_task_; |
180 | 179 |
181 // Tracks the internal state of the host. | 180 // Tracks the internal state of the host. |
182 // This variable is written on the main thread of ChromotingHostContext | 181 // This variable is written on the main thread of ChromotingHostContext |
183 // and read by jingle thread. | 182 // and read by jingle thread. |
184 State state_; | 183 State state_; |
185 | 184 |
186 // Lock is to lock the access to |state_|. | 185 // Lock is to lock the access to |state_|. |
187 base::Lock lock_; | 186 base::Lock lock_; |
188 | 187 |
189 // Configuration of the protocol. | 188 // Configuration of the protocol. |
190 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; | 189 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; |
191 | 190 |
192 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 191 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
193 }; | 192 }; |
194 | 193 |
195 } // namespace remoting | 194 } // namespace remoting |
196 | 195 |
197 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 196 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
OLD | NEW |