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_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/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "remoting/base/encoder.h" | 13 #include "remoting/base/encoder.h" |
| 14 #include "remoting/host/capturer.h" | 14 #include "remoting/host/capturer.h" |
| 15 #include "remoting/host/client_session.h" | 15 #include "remoting/host/client_session.h" |
| 16 #include "remoting/host/desktop_environment.h" | 16 #include "remoting/host/desktop_environment.h" |
| 17 #include "remoting/host/host_key_pair.h" | |
| 17 #include "remoting/host/host_status_observer.h" | 18 #include "remoting/host/host_status_observer.h" |
| 18 #include "remoting/host/ui_strings.h" | 19 #include "remoting/host/ui_strings.h" |
| 19 #include "remoting/jingle_glue/jingle_thread.h" | 20 #include "remoting/jingle_glue/jingle_thread.h" |
| 20 #include "remoting/jingle_glue/signal_strategy.h" | 21 #include "remoting/jingle_glue/signal_strategy.h" |
| 21 #include "remoting/protocol/session_manager.h" | 22 #include "remoting/protocol/session_manager.h" |
| 22 #include "remoting/protocol/connection_to_client.h" | 23 #include "remoting/protocol/connection_to_client.h" |
| 23 | 24 |
| 24 namespace remoting { | 25 namespace remoting { |
| 25 | 26 |
| 26 namespace protocol { | 27 namespace protocol { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 // Asynchronously shutdown the host process. |shutdown_task| is | 85 // Asynchronously shutdown the host process. |shutdown_task| is |
| 85 // called after shutdown is completed. | 86 // called after shutdown is completed. |
| 86 void Shutdown(const base::Closure& shutdown_task); | 87 void Shutdown(const base::Closure& shutdown_task); |
| 87 | 88 |
| 88 // Adds |observer| to the list of status observers. Doesn't take | 89 // Adds |observer| to the list of status observers. Doesn't take |
| 89 // ownership of |observer|, so |observer| must outlive this | 90 // ownership of |observer|, so |observer| must outlive this |
| 90 // object. All status observers must be added before the host is | 91 // object. All status observers must be added before the host is |
| 91 // started. | 92 // started. |
| 92 void AddStatusObserver(HostStatusObserver* observer); | 93 void AddStatusObserver(HostStatusObserver* observer); |
| 93 | 94 |
| 95 // Sets shared secret for the host. All incoming connections are | |
| 96 // rejected if shared secret isn't set. Must be called on the | |
| 97 // network thread after the host is started. | |
| 98 void SetSharedSecret(const std::string& shared_secret); | |
|
Wez
2011/11/25 06:54:11
Will you be removing this in favour of having the
Sergey Ulanov
2011/11/28 18:55:16
Most probably yes.
| |
| 99 | |
| 94 //////////////////////////////////////////////////////////////////////////// | 100 //////////////////////////////////////////////////////////////////////////// |
| 95 // SignalStrategy::StatusObserver implementation. | 101 // SignalStrategy::StatusObserver implementation. |
| 96 virtual void OnStateChange( | 102 virtual void OnStateChange( |
| 97 SignalStrategy::StatusObserver::State state) OVERRIDE; | 103 SignalStrategy::StatusObserver::State state) OVERRIDE; |
| 98 virtual void OnJidChange(const std::string& full_jid) OVERRIDE; | 104 virtual void OnJidChange(const std::string& full_jid) OVERRIDE; |
| 99 | 105 |
| 100 //////////////////////////////////////////////////////////////////////////// | 106 //////////////////////////////////////////////////////////////////////////// |
| 101 // ClientSession::EventHandler implementation. | 107 // ClientSession::EventHandler implementation. |
| 102 virtual void OnSessionAuthenticated(ClientSession* client) OVERRIDE; | 108 virtual void OnSessionAuthenticated(ClientSession* client) OVERRIDE; |
| 103 virtual void OnSessionAuthenticationFailed(ClientSession* client) OVERRIDE; | 109 virtual void OnSessionAuthenticationFailed(ClientSession* client) OVERRIDE; |
| 104 virtual void OnSessionClosed(ClientSession* session) OVERRIDE; | 110 virtual void OnSessionClosed(ClientSession* session) OVERRIDE; |
| 105 virtual void OnSessionSequenceNumber(ClientSession* session, | 111 virtual void OnSessionSequenceNumber(ClientSession* session, |
| 106 int64 sequence_number) OVERRIDE; | 112 int64 sequence_number) OVERRIDE; |
| 107 | 113 |
| 108 // SessionManager::Listener implementation. | 114 // SessionManager::Listener implementation. |
| 109 virtual void OnSessionManagerInitialized() OVERRIDE; | 115 virtual void OnSessionManagerInitialized() OVERRIDE; |
| 110 virtual void OnIncomingSession( | 116 virtual void OnIncomingSession( |
| 111 protocol::Session* session, | 117 protocol::Session* session, |
| 112 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; | 118 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; |
| 113 | 119 |
| 114 // Sets desired configuration for the protocol. Ownership of the | 120 // Sets desired configuration for the protocol. Ownership of the |
| 115 // |config| is transferred to the object. Must be called before Start(). | 121 // |config| is transferred to the object. Must be called before Start(). |
| 116 void set_protocol_config(protocol::CandidateSessionConfig* config); | 122 void set_protocol_config(protocol::CandidateSessionConfig* config); |
| 117 | 123 |
| 118 // TODO(wez): ChromotingHost shouldn't need to know about Me2Mom. | 124 // TODO(wez): ChromotingHost shouldn't need to know about Me2Mom. |
| 119 void set_it2me(bool is_it2me) { | 125 void set_it2me(bool is_it2me) { |
| 120 is_it2me_ = is_it2me; | 126 is_it2me_ = is_it2me; |
| 121 } | 127 } |
| 122 void set_access_code(const std::string& access_code) { | |
| 123 access_code_ = access_code; | |
| 124 } | |
| 125 | 128 |
| 126 // Notify all active client sessions that local input has been detected, and | 129 // Notify all active client sessions that local input has been detected, and |
| 127 // that remote input should be ignored for a short time. | 130 // that remote input should be ignored for a short time. |
| 128 void LocalMouseMoved(const SkIPoint& new_pos); | 131 void LocalMouseMoved(const SkIPoint& new_pos); |
| 129 | 132 |
| 130 // Pause or unpause the session. While the session is paused, remote input | 133 // Pause or unpause the session. While the session is paused, remote input |
| 131 // is ignored. | 134 // is ignored. |
| 132 void PauseSession(bool pause); | 135 void PauseSession(bool pause); |
| 133 | 136 |
| 134 const UiStrings& ui_strings() { return ui_strings_; } | 137 const UiStrings& ui_strings() { return ui_strings_; } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 // Called from Shutdown() or OnScreenRecorderStopped() to finish shutdown. | 179 // Called from Shutdown() or OnScreenRecorderStopped() to finish shutdown. |
| 177 void ShutdownFinish(); | 180 void ShutdownFinish(); |
| 178 | 181 |
| 179 // Unless specified otherwise all members of this class must be | 182 // Unless specified otherwise all members of this class must be |
| 180 // used on the network thread only. | 183 // used on the network thread only. |
| 181 | 184 |
| 182 // Parameters specified when the host was created. | 185 // Parameters specified when the host was created. |
| 183 ChromotingHostContext* context_; | 186 ChromotingHostContext* context_; |
| 184 DesktopEnvironment* desktop_environment_; | 187 DesktopEnvironment* desktop_environment_; |
| 185 scoped_refptr<MutableHostConfig> config_; | 188 scoped_refptr<MutableHostConfig> config_; |
| 189 HostKeyPair key_pair_; | |
| 186 bool allow_nat_traversal_; | 190 bool allow_nat_traversal_; |
| 187 | 191 |
| 188 // Connection objects. | 192 // Connection objects. |
| 189 scoped_ptr<SignalStrategy> signal_strategy_; | 193 scoped_ptr<SignalStrategy> signal_strategy_; |
| 190 std::string local_jid_; | 194 std::string local_jid_; |
| 191 scoped_ptr<protocol::SessionManager> session_manager_; | 195 scoped_ptr<protocol::SessionManager> session_manager_; |
| 192 | 196 |
| 193 // StatusObserverList is thread-safe and can be used on any thread. | 197 // StatusObserverList is thread-safe and can be used on any thread. |
| 194 StatusObserverList status_observers_; | 198 StatusObserverList status_observers_; |
| 195 | 199 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 221 bool is_it2me_; | 225 bool is_it2me_; |
| 222 std::string access_code_; | 226 std::string access_code_; |
| 223 UiStrings ui_strings_; | 227 UiStrings ui_strings_; |
| 224 | 228 |
| 225 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 229 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 226 }; | 230 }; |
| 227 | 231 |
| 228 } // namespace remoting | 232 } // namespace remoting |
| 229 | 233 |
| 230 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 234 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |