| 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_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/thread.h" | 10 #include "base/thread.h" |
| 11 #include "remoting/base/encoder.h" | 11 #include "remoting/base/encoder.h" |
| 12 #include "remoting/host/access_verifier.h" | 12 #include "remoting/host/access_verifier.h" |
| 13 #include "remoting/host/capturer.h" | 13 #include "remoting/host/capturer.h" |
| 14 #include "remoting/host/client_connection.h" | 14 #include "remoting/host/client_connection.h" |
| 15 #include "remoting/host/event_executor.h" | 15 #include "remoting/host/event_executor.h" |
| 16 #include "remoting/host/heartbeat_sender.h" | 16 #include "remoting/host/heartbeat_sender.h" |
| 17 #include "remoting/jingle_glue/jingle_client.h" | 17 #include "remoting/jingle_glue/jingle_client.h" |
| 18 #include "remoting/jingle_glue/jingle_thread.h" | 18 #include "remoting/jingle_glue/jingle_thread.h" |
| 19 #include "remoting/protocol/chromotocol_server.h" | 19 #include "remoting/protocol/session_manager.h" |
| 20 | 20 |
| 21 class Task; | 21 class Task; |
| 22 | 22 |
| 23 namespace remoting { | 23 namespace remoting { |
| 24 | 24 |
| 25 class Capturer; | 25 class Capturer; |
| 26 class ChromotingHostContext; | 26 class ChromotingHostContext; |
| 27 class ChromotocolConfig; | 27 class ChromotocolConfig; |
| 28 class Encoder; | 28 class Encoder; |
| 29 class EventExecutor; | 29 class EventExecutor; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ChromotingClientMessage* message); | 89 ChromotingClientMessage* message); |
| 90 virtual void OnConnectionOpened(ClientConnection* client); | 90 virtual void OnConnectionOpened(ClientConnection* client); |
| 91 virtual void OnConnectionClosed(ClientConnection* client); | 91 virtual void OnConnectionClosed(ClientConnection* client); |
| 92 virtual void OnConnectionFailed(ClientConnection* client); | 92 virtual void OnConnectionFailed(ClientConnection* client); |
| 93 | 93 |
| 94 //////////////////////////////////////////////////////////////////////////// | 94 //////////////////////////////////////////////////////////////////////////// |
| 95 // JingleClient::Callback implementations | 95 // JingleClient::Callback implementations |
| 96 virtual void OnStateChange(JingleClient* client, JingleClient::State state); | 96 virtual void OnStateChange(JingleClient* client, JingleClient::State state); |
| 97 | 97 |
| 98 // Callback for ChromotingServer. | 98 // Callback for ChromotingServer. |
| 99 void OnNewClientConnection( | 99 void OnNewClientSession( |
| 100 ChromotocolConnection* connection, | 100 protocol::Session* session, |
| 101 ChromotocolServer::IncomingConnectionResponse* response); | 101 protocol::SessionManager::IncomingSessionResponse* response); |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 enum State { | 104 enum State { |
| 105 kInitial, | 105 kInitial, |
| 106 kStarted, | 106 kStarted, |
| 107 kStopped, | 107 kStopped, |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // This method connects to the talk network and start listening for incoming | 110 // This method connects to the talk network and start listening for incoming |
| 111 // connections. | 111 // connections. |
| 112 void DoStart(Task* shutdown_task); | 112 void DoStart(Task* shutdown_task); |
| 113 | 113 |
| 114 // Callback for ChromotocolServer::Close(). | 114 // Callback for protocol::SessionManager::Close(). |
| 115 void OnServerClosed(); | 115 void OnServerClosed(); |
| 116 | 116 |
| 117 // Creates encoder for the specified configuration. | 117 // Creates encoder for the specified configuration. |
| 118 Encoder* CreateEncoder(const ChromotocolConfig* config); | 118 Encoder* CreateEncoder(const ChromotocolConfig* config); |
| 119 | 119 |
| 120 // The context that the chromoting host runs on. | 120 // The context that the chromoting host runs on. |
| 121 ChromotingHostContext* context_; | 121 ChromotingHostContext* context_; |
| 122 | 122 |
| 123 scoped_refptr<MutableHostConfig> config_; | 123 scoped_refptr<MutableHostConfig> config_; |
| 124 | 124 |
| 125 // Capturer to be used by SessionManager. Once the SessionManager is | 125 // Capturer to be used by SessionManager. Once the SessionManager is |
| 126 // constructed this is set to NULL. | 126 // constructed this is set to NULL. |
| 127 scoped_ptr<Capturer> capturer_; | 127 scoped_ptr<Capturer> capturer_; |
| 128 | 128 |
| 129 // constructed this is set to NULL. | 129 // constructed this is set to NULL. |
| 130 scoped_ptr<Encoder> encoder_; | 130 scoped_ptr<Encoder> encoder_; |
| 131 | 131 |
| 132 // EventExecutor executes input events received from the client. | 132 // EventExecutor executes input events received from the client. |
| 133 scoped_ptr<EventExecutor> executor_; | 133 scoped_ptr<EventExecutor> executor_; |
| 134 | 134 |
| 135 // The libjingle client. This is used to connect to the talk network to | 135 // The libjingle client. This is used to connect to the talk network to |
| 136 // receive connection requests from chromoting client. | 136 // receive connection requests from chromoting client. |
| 137 scoped_refptr<JingleClient> jingle_client_; | 137 scoped_refptr<JingleClient> jingle_client_; |
| 138 | 138 |
| 139 scoped_refptr<ChromotocolServer> chromotocol_server_; | 139 scoped_refptr<protocol::SessionManager> session_manager_; |
| 140 | 140 |
| 141 // Objects that takes care of sending heartbeats to the chromoting bot. | 141 // Objects that takes care of sending heartbeats to the chromoting bot. |
| 142 scoped_refptr<HeartbeatSender> heartbeat_sender_; | 142 scoped_refptr<HeartbeatSender> heartbeat_sender_; |
| 143 | 143 |
| 144 AccessVerifier access_verifier_; | 144 AccessVerifier access_verifier_; |
| 145 | 145 |
| 146 // A ClientConnection manages the connectino to a remote client. | 146 // A ClientConnection manages the connectino to a remote client. |
| 147 // TODO(hclam): Expand this to a list of clients. | 147 // TODO(hclam): Expand this to a list of clients. |
| 148 scoped_refptr<ClientConnection> client_; | 148 scoped_refptr<ClientConnection> client_; |
| 149 | 149 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 161 | 161 |
| 162 // Lock is to lock the access to |state_|. | 162 // Lock is to lock the access to |state_|. |
| 163 Lock lock_; | 163 Lock lock_; |
| 164 | 164 |
| 165 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 165 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 } // namespace remoting | 168 } // namespace remoting |
| 169 | 169 |
| 170 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 170 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |