| 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 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "net/base/backoff_entry.h" | 16 #include "net/base/backoff_entry.h" |
| 17 #include "remoting/host/client_session.h" | 17 #include "remoting/host/client_session.h" |
| 18 #include "remoting/host/host_status_monitor.h" | 18 #include "remoting/host/host_status_monitor.h" |
| 19 #include "remoting/host/host_status_observer.h" | 19 #include "remoting/host/host_status_observer.h" |
| 20 #include "remoting/host/mouse_move_observer.h" | |
| 21 #include "remoting/protocol/authenticator.h" | 20 #include "remoting/protocol/authenticator.h" |
| 22 #include "remoting/protocol/session_manager.h" | 21 #include "remoting/protocol/session_manager.h" |
| 23 #include "remoting/protocol/connection_to_client.h" | 22 #include "remoting/protocol/connection_to_client.h" |
| 24 #include "third_party/skia/include/core/SkSize.h" | 23 #include "third_party/skia/include/core/SkSize.h" |
| 25 | 24 |
| 26 namespace base { | 25 namespace base { |
| 27 class SingleThreadTaskRunner; | 26 class SingleThreadTaskRunner; |
| 28 } // namespace base | 27 } // namespace base |
| 29 | 28 |
| 30 namespace remoting { | 29 namespace remoting { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 56 // We'll then enter the running state of the host process. | 55 // We'll then enter the running state of the host process. |
| 57 // | 56 // |
| 58 // 3. When the user is disconnected, we will pause the ScreenRecorder | 57 // 3. When the user is disconnected, we will pause the ScreenRecorder |
| 59 // and try to terminate the threads we have created. This will allow | 58 // and try to terminate the threads we have created. This will allow |
| 60 // all pending tasks to complete. After all of that completed we | 59 // 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 | 60 // return to the idle state. We then go to step (2) if there a new |
| 62 // incoming connection. | 61 // incoming connection. |
| 63 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, | 62 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
| 64 public ClientSession::EventHandler, | 63 public ClientSession::EventHandler, |
| 65 public protocol::SessionManager::Listener, | 64 public protocol::SessionManager::Listener, |
| 66 public HostStatusMonitor, | 65 public HostStatusMonitor { |
| 67 public MouseMoveObserver { | |
| 68 public: | 66 public: |
| 69 // The caller must ensure that |signal_strategy| and | 67 // The caller must ensure that |signal_strategy| and |
| 70 // |desktop_environment_factory| remain valid at least until the | 68 // |desktop_environment_factory| remain valid at least until the |
| 71 // |shutdown_task| supplied to Shutdown() has been notified. | 69 // |shutdown_task| supplied to Shutdown() has been notified. |
| 72 ChromotingHost( | 70 ChromotingHost( |
| 73 SignalStrategy* signal_strategy, | 71 SignalStrategy* signal_strategy, |
| 74 DesktopEnvironmentFactory* desktop_environment_factory, | 72 DesktopEnvironmentFactory* desktop_environment_factory, |
| 75 scoped_ptr<protocol::SessionManager> session_manager, | 73 scoped_ptr<protocol::SessionManager> session_manager, |
| 76 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 77 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 75 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ClientSession* session, | 124 ClientSession* session, |
| 127 const std::string& channel_name, | 125 const std::string& channel_name, |
| 128 const protocol::TransportRoute& route) OVERRIDE; | 126 const protocol::TransportRoute& route) OVERRIDE; |
| 129 | 127 |
| 130 // SessionManager::Listener implementation. | 128 // SessionManager::Listener implementation. |
| 131 virtual void OnSessionManagerReady() OVERRIDE; | 129 virtual void OnSessionManagerReady() OVERRIDE; |
| 132 virtual void OnIncomingSession( | 130 virtual void OnIncomingSession( |
| 133 protocol::Session* session, | 131 protocol::Session* session, |
| 134 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; | 132 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; |
| 135 | 133 |
| 136 // MouseMoveObserver interface. | |
| 137 virtual void OnLocalMouseMoved(const SkIPoint& new_pos) OVERRIDE; | |
| 138 | |
| 139 // Sets desired configuration for the protocol. Must be called before Start(). | 134 // Sets desired configuration for the protocol. Must be called before Start(). |
| 140 void set_protocol_config(scoped_ptr<protocol::CandidateSessionConfig> config); | 135 void set_protocol_config(scoped_ptr<protocol::CandidateSessionConfig> config); |
| 141 | 136 |
| 142 // Pause or unpause the session. While the session is paused, remote input | 137 // Pause or unpause the session. While the session is paused, remote input |
| 143 // is ignored. Can be called from any thread. | 138 // is ignored. Can be called from any thread. |
| 144 void PauseSession(bool pause); | 139 void PauseSession(bool pause); |
| 145 | 140 |
| 146 // Disconnects all active clients. Clients are disconnected | 141 // Disconnects all active clients. Clients are disconnected |
| 147 // asynchronously when this method is called on a thread other than | 142 // asynchronously when this method is called on a thread other than |
| 148 // the network thread. Potentically this may cause disconnection of | 143 // the network thread. Potentically this may cause disconnection of |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 base::TimeDelta max_session_duration_; | 209 base::TimeDelta max_session_duration_; |
| 215 | 210 |
| 216 base::WeakPtrFactory<ChromotingHost> weak_factory_; | 211 base::WeakPtrFactory<ChromotingHost> weak_factory_; |
| 217 | 212 |
| 218 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 213 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 219 }; | 214 }; |
| 220 | 215 |
| 221 } // namespace remoting | 216 } // namespace remoting |
| 222 | 217 |
| 223 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 218 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |