Chromium Code Reviews| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 class HostStub; | 30 class HostStub; |
| 31 class InputStub; | 31 class InputStub; |
| 32 class SessionConfig; | 32 class SessionConfig; |
| 33 class CandidateSessionConfig; | 33 class CandidateSessionConfig; |
| 34 } // namespace protocol | 34 } // namespace protocol |
| 35 | 35 |
| 36 class Capturer; | 36 class Capturer; |
| 37 class ChromotingHostContext; | 37 class ChromotingHostContext; |
| 38 class DesktopEnvironment; | 38 class DesktopEnvironment; |
| 39 class Encoder; | 39 class Encoder; |
| 40 class Logger; | |
| 40 class MutableHostConfig; | 41 class MutableHostConfig; |
| 41 class ScreenRecorder; | 42 class ScreenRecorder; |
| 42 | 43 |
| 43 // A class to implement the functionality of a host process. | 44 // A class to implement the functionality of a host process. |
| 44 // | 45 // |
| 45 // Here's the work flow of this class: | 46 // Here's the work flow of this class: |
| 46 // 1. We should load the saved GAIA ID token or if this is the first | 47 // 1. We should load the saved GAIA ID token or if this is the first |
| 47 // time the host process runs we should prompt user for the | 48 // time the host process runs we should prompt user for the |
| 48 // credential. We will use this token or credentials to authenicate | 49 // credential. We will use this token or credentials to authenicate |
| 49 // and register the host. | 50 // and register the host. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 67 public protocol::ConnectionToClient::EventHandler, | 68 public protocol::ConnectionToClient::EventHandler, |
| 68 public ClientSession::EventHandler, | 69 public ClientSession::EventHandler, |
| 69 public JingleClient::Callback { | 70 public JingleClient::Callback { |
| 70 public: | 71 public: |
| 71 // Factory methods that must be used to create ChromotingHost instances. | 72 // Factory methods that must be used to create ChromotingHost instances. |
| 72 // Default capturer and input stub are used if it is not specified. | 73 // Default capturer and input stub are used if it is not specified. |
| 73 // Returned instance takes ownership of |access_verifier| and |environment|, | 74 // Returned instance takes ownership of |access_verifier| and |environment|, |
| 74 // and adds a reference to |config|. It does NOT take ownership of |context|. | 75 // and adds a reference to |config|. It does NOT take ownership of |context|. |
| 75 static ChromotingHost* Create(ChromotingHostContext* context, | 76 static ChromotingHost* Create(ChromotingHostContext* context, |
| 76 MutableHostConfig* config, | 77 MutableHostConfig* config, |
| 77 AccessVerifier* access_verifier); | 78 AccessVerifier* access_verifier, |
| 79 Logger* logger); | |
| 78 static ChromotingHost* Create(ChromotingHostContext* context, | 80 static ChromotingHost* Create(ChromotingHostContext* context, |
| 79 MutableHostConfig* config, | 81 MutableHostConfig* config, |
| 80 DesktopEnvironment* environment, | 82 DesktopEnvironment* environment, |
| 81 AccessVerifier* access_verifier); | 83 AccessVerifier* access_verifier, |
| 84 Logger* logger); | |
| 82 | 85 |
| 83 // Asynchronously start the host process. | 86 // Asynchronously start the host process. |
| 84 // | 87 // |
| 85 // After this is invoked, the host process will connect to the talk | 88 // After this is invoked, the host process will connect to the talk |
| 86 // network and start listening for incoming connections. | 89 // network and start listening for incoming connections. |
| 87 // | 90 // |
| 88 // This method can only be called once during the lifetime of this object. | 91 // This method can only be called once during the lifetime of this object. |
| 89 void Start(); | 92 void Start(); |
| 90 | 93 |
| 91 // Asynchronously shutdown the host process. |shutdown_task| is | 94 // Asynchronously shutdown the host process. |shutdown_task| is |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 110 // JingleClient::Callback implementations | 113 // JingleClient::Callback implementations |
| 111 virtual void OnStateChange(JingleClient* client, JingleClient::State state); | 114 virtual void OnStateChange(JingleClient* client, JingleClient::State state); |
| 112 | 115 |
| 113 //////////////////////////////////////////////////////////////////////////// | 116 //////////////////////////////////////////////////////////////////////////// |
| 114 // ClientSession::EventHandler implementations | 117 // ClientSession::EventHandler implementations |
| 115 virtual void LocalLoginSucceeded( | 118 virtual void LocalLoginSucceeded( |
| 116 scoped_refptr<protocol::ConnectionToClient> client); | 119 scoped_refptr<protocol::ConnectionToClient> client); |
| 117 virtual void LocalLoginFailed( | 120 virtual void LocalLoginFailed( |
| 118 scoped_refptr<protocol::ConnectionToClient> client); | 121 scoped_refptr<protocol::ConnectionToClient> client); |
| 119 | 122 |
| 123 Logger* logger() { return logger_; } | |
| 124 | |
| 120 // Callback for ChromotingServer. | 125 // Callback for ChromotingServer. |
| 121 void OnNewClientSession( | 126 void OnNewClientSession( |
| 122 protocol::Session* session, | 127 protocol::Session* session, |
| 123 protocol::SessionManager::IncomingSessionResponse* response); | 128 protocol::SessionManager::IncomingSessionResponse* response); |
| 124 | 129 |
| 125 // Sets desired configuration for the protocol. Ownership of the | 130 // Sets desired configuration for the protocol. Ownership of the |
| 126 // |config| is transferred to the object. Must be called before Start(). | 131 // |config| is transferred to the object. Must be called before Start(). |
| 127 void set_protocol_config(protocol::CandidateSessionConfig* config); | 132 void set_protocol_config(protocol::CandidateSessionConfig* config); |
| 128 | 133 |
| 129 // TODO(wez): ChromotingHost shouldn't need to know about Me2Mom. | 134 // TODO(wez): ChromotingHost shouldn't need to know about Me2Mom. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 144 friend class ChromotingHostTest; | 149 friend class ChromotingHostTest; |
| 145 | 150 |
| 146 typedef std::vector<HostStatusObserver*> StatusObserverList; | 151 typedef std::vector<HostStatusObserver*> StatusObserverList; |
| 147 typedef std::vector<scoped_refptr<ClientSession> > ClientList; | 152 typedef std::vector<scoped_refptr<ClientSession> > ClientList; |
| 148 | 153 |
| 149 // Takes ownership of |access_verifier| and |environment|, and adds a | 154 // Takes ownership of |access_verifier| and |environment|, and adds a |
| 150 // reference to |config|. Does NOT take ownership of |context|. | 155 // reference to |config|. Does NOT take ownership of |context|. |
| 151 ChromotingHost(ChromotingHostContext* context, | 156 ChromotingHost(ChromotingHostContext* context, |
| 152 MutableHostConfig* config, | 157 MutableHostConfig* config, |
| 153 DesktopEnvironment* environment, | 158 DesktopEnvironment* environment, |
| 154 AccessVerifier* access_verifier); | 159 AccessVerifier* access_verifier, |
| 160 Logger* logger); | |
| 155 virtual ~ChromotingHost(); | 161 virtual ~ChromotingHost(); |
| 156 | 162 |
| 157 enum State { | 163 enum State { |
| 158 kInitial, | 164 kInitial, |
| 159 kStarted, | 165 kStarted, |
| 160 kStopping, | 166 kStopping, |
| 161 kStopped, | 167 kStopped, |
| 162 }; | 168 }; |
| 163 | 169 |
| 164 // This method is called if a client is disconnected from the host. | 170 // This method is called if a client is disconnected from the host. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 // The libjingle client. This is used to connect to the talk network to | 213 // The libjingle client. This is used to connect to the talk network to |
| 208 // receive connection requests from chromoting client. | 214 // receive connection requests from chromoting client. |
| 209 scoped_refptr<JingleClient> jingle_client_; | 215 scoped_refptr<JingleClient> jingle_client_; |
| 210 | 216 |
| 211 scoped_refptr<protocol::SessionManager> session_manager_; | 217 scoped_refptr<protocol::SessionManager> session_manager_; |
| 212 | 218 |
| 213 StatusObserverList status_observers_; | 219 StatusObserverList status_observers_; |
| 214 | 220 |
| 215 scoped_ptr<AccessVerifier> access_verifier_; | 221 scoped_ptr<AccessVerifier> access_verifier_; |
| 216 | 222 |
| 223 // Logger (not owned). | |
| 224 Logger* logger_; | |
|
dmac
2011/06/26 14:34:44
Chromoting host takes ownership of everything else
garykac
2011/06/27 21:24:20
Unlike the other params, the logger is part of the
| |
| 225 | |
| 217 // The connections to remote clients. | 226 // The connections to remote clients. |
| 218 ClientList clients_; | 227 ClientList clients_; |
| 219 | 228 |
| 220 // Session manager for the host process. | 229 // Session manager for the host process. |
| 221 scoped_refptr<ScreenRecorder> recorder_; | 230 scoped_refptr<ScreenRecorder> recorder_; |
| 222 | 231 |
| 223 // Tracks the internal state of the host. | 232 // Tracks the internal state of the host. |
| 224 // This variable is written on the main thread of ChromotingHostContext | 233 // This variable is written on the main thread of ChromotingHostContext |
| 225 // and read by jingle thread. | 234 // and read by jingle thread. |
| 226 State state_; | 235 State state_; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 246 // Stores list of tasks that should be executed when we finish | 255 // Stores list of tasks that should be executed when we finish |
| 247 // shutdown. Used only while |state_| is set to kStopping. | 256 // shutdown. Used only while |state_| is set to kStopping. |
| 248 std::vector<Task*> shutdown_tasks_; | 257 std::vector<Task*> shutdown_tasks_; |
| 249 | 258 |
| 250 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 259 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 251 }; | 260 }; |
| 252 | 261 |
| 253 } // namespace remoting | 262 } // namespace remoting |
| 254 | 263 |
| 255 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 264 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |