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 |
| (...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::RefCountedThreadSafe<ChromotingHost>, | 63 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
| 64 public ClientSession::EventHandler, | 64 public ClientSession::EventHandler, |
| 65 public SignalStrategy::StatusObserver, | 65 public SignalStrategy::Listener, |
| 66 public protocol::SessionManager::Listener { | 66 public protocol::SessionManager::Listener { |
| 67 public: | 67 public: |
| 68 // Factory methods that must be used to create ChromotingHost | 68 // Factory methods that must be used to create ChromotingHost |
| 69 // instances. It does NOT take ownership of |context|, and | 69 // instances. It does NOT take ownership of |context|, and |
| 70 // |environment|, but they should not be deleted until returned host | 70 // |environment|, but they should not be deleted until returned host |
| 71 // is destroyed. | 71 // is destroyed. |
| 72 static ChromotingHost* Create(ChromotingHostContext* context, | 72 static ChromotingHost* Create(ChromotingHostContext* context, |
| 73 MutableHostConfig* config, | 73 MutableHostConfig* config, |
| 74 DesktopEnvironment* environment, | 74 DesktopEnvironment* environment, |
| 75 bool allow_nat_traversal); | 75 bool allow_nat_traversal); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 91 // object. All status observers must be added before the host is | 91 // object. All status observers must be added before the host is |
| 92 // started. | 92 // started. |
| 93 void AddStatusObserver(HostStatusObserver* observer); | 93 void AddStatusObserver(HostStatusObserver* observer); |
| 94 | 94 |
| 95 // Sets shared secret for the host. All incoming connections are | 95 // Sets shared secret for the host. All incoming connections are |
| 96 // rejected if shared secret isn't set. Must be called on the | 96 // rejected if shared secret isn't set. Must be called on the |
| 97 // network thread after the host is started. | 97 // network thread after the host is started. |
| 98 void SetSharedSecret(const std::string& shared_secret); | 98 void SetSharedSecret(const std::string& shared_secret); |
| 99 | 99 |
| 100 //////////////////////////////////////////////////////////////////////////// | 100 //////////////////////////////////////////////////////////////////////////// |
| 101 // SignalStrategy::StatusObserver implementation. | 101 // SignalStrategy::Listener interface. |
| 102 virtual void OnStateChange( | 102 virtual void OnSignalStrategyStateChange( |
| 103 SignalStrategy::StatusObserver::State state) OVERRIDE; | 103 SignalStrategy::State state) OVERRIDE; |
| 104 virtual void OnJidChange(const std::string& full_jid) OVERRIDE; | 104 virtual bool OnSignalStrategyIncomingStanza( |
|
Wez
2011/12/21 23:35:30
We can get rid of this because we'll see DISCONNEC
Sergey Ulanov
2011/12/22 21:45:10
Because I added GetLocalJid() method.
| |
| 105 const buzz::XmlElement* stanza) OVERRIDE; | |
| 105 | 106 |
| 106 //////////////////////////////////////////////////////////////////////////// | 107 //////////////////////////////////////////////////////////////////////////// |
| 107 // ClientSession::EventHandler implementation. | 108 // ClientSession::EventHandler implementation. |
| 108 virtual void OnSessionAuthenticated(ClientSession* client) OVERRIDE; | 109 virtual void OnSessionAuthenticated(ClientSession* client) OVERRIDE; |
| 109 virtual void OnSessionAuthenticationFailed(ClientSession* client) OVERRIDE; | 110 virtual void OnSessionAuthenticationFailed(ClientSession* client) OVERRIDE; |
| 110 virtual void OnSessionClosed(ClientSession* session) OVERRIDE; | 111 virtual void OnSessionClosed(ClientSession* session) OVERRIDE; |
| 111 virtual void OnSessionSequenceNumber(ClientSession* session, | 112 virtual void OnSessionSequenceNumber(ClientSession* session, |
| 112 int64 sequence_number) OVERRIDE; | 113 int64 sequence_number) OVERRIDE; |
| 113 | 114 |
| 114 // SessionManager::Listener implementation. | 115 // SessionManager::Listener implementation. |
| 115 virtual void OnSessionManagerInitialized() OVERRIDE; | 116 virtual void OnSessionManagerReady() OVERRIDE; |
| 116 virtual void OnIncomingSession( | 117 virtual void OnIncomingSession( |
| 117 protocol::Session* session, | 118 protocol::Session* session, |
| 118 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; | 119 protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; |
| 119 | 120 |
| 120 // Sets desired configuration for the protocol. Ownership of the | 121 // Sets desired configuration for the protocol. Ownership of the |
| 121 // |config| is transferred to the object. Must be called before Start(). | 122 // |config| is transferred to the object. Must be called before Start(). |
| 122 void set_protocol_config(protocol::CandidateSessionConfig* config); | 123 void set_protocol_config(protocol::CandidateSessionConfig* config); |
| 123 | 124 |
| 124 // TODO(wez): ChromotingHost shouldn't need to know about Me2Mom. | 125 // TODO(wez): ChromotingHost shouldn't need to know about Me2Mom. |
| 125 void set_it2me(bool is_it2me) { | 126 void set_it2me(bool is_it2me) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 bool is_it2me_; | 232 bool is_it2me_; |
| 232 std::string access_code_; | 233 std::string access_code_; |
| 233 UiStrings ui_strings_; | 234 UiStrings ui_strings_; |
| 234 | 235 |
| 235 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 236 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 236 }; | 237 }; |
| 237 | 238 |
| 238 } // namespace remoting | 239 } // namespace remoting |
| 239 | 240 |
| 240 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 241 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |