| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "net/base/backoff_entry.h" | 14 #include "net/base/backoff_entry.h" |
| 15 #include "remoting/base/encoder.h" | 15 #include "remoting/base/encoder.h" |
| 16 #include "remoting/host/capturer.h" | 16 #include "remoting/host/capturer.h" |
| 17 #include "remoting/host/client_session.h" | 17 #include "remoting/host/client_session.h" |
| 18 #include "remoting/host/desktop_environment.h" | 18 #include "remoting/host/desktop_environment.h" |
| 19 #include "remoting/host/host_key_pair.h" | 19 #include "remoting/host/host_key_pair.h" |
| 20 #include "remoting/host/host_status_observer.h" | 20 #include "remoting/host/host_status_observer.h" |
| 21 #include "remoting/host/mouse_move_observer.h" |
| 21 #include "remoting/host/network_settings.h" | 22 #include "remoting/host/network_settings.h" |
| 22 #include "remoting/host/ui_strings.h" | 23 #include "remoting/host/ui_strings.h" |
| 23 #include "remoting/jingle_glue/jingle_thread.h" | 24 #include "remoting/jingle_glue/jingle_thread.h" |
| 24 #include "remoting/jingle_glue/signal_strategy.h" | 25 #include "remoting/jingle_glue/signal_strategy.h" |
| 25 #include "remoting/protocol/authenticator.h" | 26 #include "remoting/protocol/authenticator.h" |
| 26 #include "remoting/protocol/session_manager.h" | 27 #include "remoting/protocol/session_manager.h" |
| 27 #include "remoting/protocol/connection_to_client.h" | 28 #include "remoting/protocol/connection_to_client.h" |
| 28 | 29 |
| 29 namespace remoting { | 30 namespace remoting { |
| 30 | 31 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 58 // After we have done all the initialization we'll start the ScreenRecorder. | 59 // After we have done all the initialization we'll start the ScreenRecorder. |
| 59 // We'll then enter the running state of the host process. | 60 // We'll then enter the running state of the host process. |
| 60 // | 61 // |
| 61 // 3. When the user is disconnected, we will pause the ScreenRecorder | 62 // 3. When the user is disconnected, we will pause the ScreenRecorder |
| 62 // and try to terminate the threads we have created. This will allow | 63 // and try to terminate the threads we have created. This will allow |
| 63 // all pending tasks to complete. After all of that completed we | 64 // all pending tasks to complete. After all of that completed we |
| 64 // return to the idle state. We then go to step (2) if there a new | 65 // return to the idle state. We then go to step (2) if there a new |
| 65 // incoming connection. | 66 // incoming connection. |
| 66 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, | 67 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
| 67 public ClientSession::EventHandler, | 68 public ClientSession::EventHandler, |
| 68 public protocol::SessionManager::Listener { | 69 public protocol::SessionManager::Listener, |
| 70 public MouseMoveObserver { |
| 69 public: | 71 public: |
| 70 // The caller must ensure that |context|, |signal_strategy| and | 72 // The caller must ensure that |context|, |signal_strategy| and |
| 71 // |environment| out-live the host. | 73 // |environment| out-live the host. |
| 72 ChromotingHost(ChromotingHostContext* context, | 74 ChromotingHost(ChromotingHostContext* context, |
| 73 SignalStrategy* signal_strategy, | 75 SignalStrategy* signal_strategy, |
| 74 DesktopEnvironment* environment, | 76 DesktopEnvironment* environment, |
| 75 const NetworkSettings& network_settings); | 77 const NetworkSettings& network_settings); |
| 76 | 78 |
| 77 // Asynchronously start the host process. | 79 // Asynchronously start the host process. |
| 78 // | 80 // |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 ClientSession* session, | 119 ClientSession* session, |
| 118 const std::string& channel_name, | 120 const std::string& channel_name, |
| 119 const protocol::TransportRoute& route) OVERRIDE; | 121 const protocol::TransportRoute& route) OVERRIDE; |
| 120 | 122 |
| 121 // SessionManager::Listener implementation. | 123 // SessionManager::Listener implementation. |
| 122 virtual void OnSessionManagerReady() OVERRIDE; | 124 virtual void OnSessionManagerReady() OVERRIDE; |
| 123 virtual void OnIncomingSession( | 125 virtual void OnIncomingSession( |
| 124 protocol::Session* session, | 126 protocol::Session* session, |
| 125 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; | 127 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; |
| 126 | 128 |
| 129 // MouseMoveObserver interface. |
| 130 virtual void OnLocalMouseMoved(const SkIPoint& new_pos) OVERRIDE; |
| 131 |
| 127 // Sets desired configuration for the protocol. Ownership of the | 132 // Sets desired configuration for the protocol. Ownership of the |
| 128 // |config| is transferred to the object. Must be called before Start(). | 133 // |config| is transferred to the object. Must be called before Start(). |
| 129 void set_protocol_config(protocol::CandidateSessionConfig* config); | 134 void set_protocol_config(protocol::CandidateSessionConfig* config); |
| 130 | 135 |
| 131 // Notify all active client sessions that local input has been detected, and | |
| 132 // that remote input should be ignored for a short time. | |
| 133 void LocalMouseMoved(const SkIPoint& new_pos); | |
| 134 | |
| 135 // Pause or unpause the session. While the session is paused, remote input | 136 // Pause or unpause the session. While the session is paused, remote input |
| 136 // is ignored. | 137 // is ignored. |
| 137 void PauseSession(bool pause); | 138 void PauseSession(bool pause); |
| 138 | 139 |
| 139 const UiStrings& ui_strings() { return ui_strings_; } | 140 const UiStrings& ui_strings() { return ui_strings_; } |
| 140 | 141 |
| 141 // Set localized strings. Must be called before host is started. | 142 // Set localized strings. Must be called before host is started. |
| 142 void SetUiStrings(const UiStrings& ui_strings); | 143 void SetUiStrings(const UiStrings& ui_strings); |
| 143 | 144 |
| 144 private: | 145 private: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // TODO(sergeyu): The following members do not belong to | 220 // TODO(sergeyu): The following members do not belong to |
| 220 // ChromotingHost and should be moved elsewhere. | 221 // ChromotingHost and should be moved elsewhere. |
| 221 UiStrings ui_strings_; | 222 UiStrings ui_strings_; |
| 222 | 223 |
| 223 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 224 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 224 }; | 225 }; |
| 225 | 226 |
| 226 } // namespace remoting | 227 } // namespace remoting |
| 227 | 228 |
| 228 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 229 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |