| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_HOST_CHROMOTING_HOST_H_ | 5 #ifndef REMOTING_HOST_CHROMOTING_HOST_H_ |
| 6 #define REMOTING_HOST_CHROMOTING_HOST_H_ | 6 #define REMOTING_HOST_CHROMOTING_HOST_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // After we have done all the initialization we'll start the ScreenRecorder. | 55 // After we have done all the initialization we'll start the ScreenRecorder. |
| 56 // We'll then enter the running state of the host process. | 56 // We'll then enter the running state of the host process. |
| 57 // | 57 // |
| 58 // 3. When the user is disconnected, we will pause the ScreenRecorder | 58 // 3. When the user is disconnected, we will pause the ScreenRecorder |
| 59 // and try to terminate the threads we have created. This will allow | 59 // and try to terminate the threads we have created. This will allow |
| 60 // all pending tasks to complete. After all of that completed we | 60 // all pending tasks to complete. After all of that completed we |
| 61 // return to the idle state. We then go to step (2) if there a new | 61 // return to the idle state. We then go to step (2) if there a new |
| 62 // incoming connection. | 62 // incoming connection. |
| 63 class ChromotingHost : public base::NonThreadSafe, | 63 class ChromotingHost : public base::NonThreadSafe, |
| 64 public ClientSession::EventHandler, | 64 public ClientSession::EventHandler, |
| 65 public protocol::SessionManager::Listener, | |
| 66 public HostStatusMonitor { | 65 public HostStatusMonitor { |
| 67 public: | 66 public: |
| 68 // Both |signal_strategy| and |desktop_environment_factory| should outlive | 67 // |desktop_environment_factory| must outlive this object. |
| 69 // this object. | |
| 70 ChromotingHost( | 68 ChromotingHost( |
| 71 SignalStrategy* signal_strategy, | |
| 72 DesktopEnvironmentFactory* desktop_environment_factory, | 69 DesktopEnvironmentFactory* desktop_environment_factory, |
| 73 scoped_ptr<protocol::SessionManager> session_manager, | 70 scoped_ptr<protocol::SessionManager> session_manager, |
| 74 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 71 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 75 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 72 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 76 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 73 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 77 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, |
| 78 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 75 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 79 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | 76 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
| 80 ~ChromotingHost() override; | 77 ~ChromotingHost() override; |
| 81 | 78 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // ClientSession::EventHandler implementation. | 112 // ClientSession::EventHandler implementation. |
| 116 void OnSessionAuthenticating(ClientSession* client) override; | 113 void OnSessionAuthenticating(ClientSession* client) override; |
| 117 void OnSessionAuthenticated(ClientSession* client) override; | 114 void OnSessionAuthenticated(ClientSession* client) override; |
| 118 void OnSessionChannelsConnected(ClientSession* client) override; | 115 void OnSessionChannelsConnected(ClientSession* client) override; |
| 119 void OnSessionAuthenticationFailed(ClientSession* client) override; | 116 void OnSessionAuthenticationFailed(ClientSession* client) override; |
| 120 void OnSessionClosed(ClientSession* session) override; | 117 void OnSessionClosed(ClientSession* session) override; |
| 121 void OnSessionRouteChange(ClientSession* session, | 118 void OnSessionRouteChange(ClientSession* session, |
| 122 const std::string& channel_name, | 119 const std::string& channel_name, |
| 123 const protocol::TransportRoute& route) override; | 120 const protocol::TransportRoute& route) override; |
| 124 | 121 |
| 125 // SessionManager::Listener implementation. | 122 // Callback for SessionManager to accept incoming sessions. |
| 126 void OnIncomingSession( | 123 void OnIncomingSession( |
| 127 protocol::Session* session, | 124 protocol::Session* session, |
| 128 protocol::SessionManager::IncomingSessionResponse* response) override; | 125 protocol::SessionManager::IncomingSessionResponse* response); |
| 129 | 126 |
| 130 // The host uses a pairing registry to generate and store pairing information | 127 // The host uses a pairing registry to generate and store pairing information |
| 131 // for clients for PIN-less authentication. | 128 // for clients for PIN-less authentication. |
| 132 scoped_refptr<protocol::PairingRegistry> pairing_registry() const { | 129 scoped_refptr<protocol::PairingRegistry> pairing_registry() const { |
| 133 return pairing_registry_; | 130 return pairing_registry_; |
| 134 } | 131 } |
| 135 void set_pairing_registry( | 132 void set_pairing_registry( |
| 136 scoped_refptr<protocol::PairingRegistry> pairing_registry) { | 133 scoped_refptr<protocol::PairingRegistry> pairing_registry) { |
| 137 pairing_registry_ = pairing_registry; | 134 pairing_registry_ = pairing_registry; |
| 138 } | 135 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 158 // Parameters specified when the host was created. | 155 // Parameters specified when the host was created. |
| 159 DesktopEnvironmentFactory* desktop_environment_factory_; | 156 DesktopEnvironmentFactory* desktop_environment_factory_; |
| 160 scoped_ptr<protocol::SessionManager> session_manager_; | 157 scoped_ptr<protocol::SessionManager> session_manager_; |
| 161 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; | 158 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; |
| 162 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; | 159 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; |
| 163 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_; | 160 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_; |
| 164 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; | 161 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; |
| 165 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 162 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 166 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 163 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 167 | 164 |
| 168 // Connection objects. | |
| 169 SignalStrategy* signal_strategy_; | |
| 170 | |
| 171 // Must be used on the network thread only. | 165 // Must be used on the network thread only. |
| 172 base::ObserverList<HostStatusObserver> status_observers_; | 166 base::ObserverList<HostStatusObserver> status_observers_; |
| 173 | 167 |
| 174 // The connections to remote clients. | 168 // The connections to remote clients. |
| 175 ClientList clients_; | 169 ClientList clients_; |
| 176 | 170 |
| 177 // True if the host has been started. | 171 // True if the host has been started. |
| 178 bool started_; | 172 bool started_; |
| 179 | 173 |
| 180 // Login backoff state. | 174 // Login backoff state. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 193 HostExtensionList extensions_; | 187 HostExtensionList extensions_; |
| 194 | 188 |
| 195 base::WeakPtrFactory<ChromotingHost> weak_factory_; | 189 base::WeakPtrFactory<ChromotingHost> weak_factory_; |
| 196 | 190 |
| 197 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 191 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 198 }; | 192 }; |
| 199 | 193 |
| 200 } // namespace remoting | 194 } // namespace remoting |
| 201 | 195 |
| 202 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 196 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |