Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CHROMOTING_HOST_H_ | 5 #ifndef REMOTING_CHROMOTING_HOST_H_ |
| 6 #define REMOTING_CHROMOTING_HOST_H_ | 6 #define REMOTING_CHROMOTING_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 protocol::ConnectionToClient::EventHandler, | 64 public protocol::ConnectionToClient::EventHandler, |
| 65 public JingleClient::Callback { | 65 public JingleClient::Callback { |
| 66 public: | 66 public: |
| 67 // Factory methods that must be used to create ChromotingHost | 67 // Factory methods that must be used to create ChromotingHost |
| 68 // instances. Default capturer is used if it is not specified. | 68 // instances. Default capturer is used if it is not specified. |
|
Sergey Ulanov
2011/01/20 19:51:26
update comment: Default capturer and input stub ar
Alpha Left Google
2011/01/20 20:04:31
Done.
| |
| 69 static ChromotingHost* Create(ChromotingHostContext* context, | 69 static ChromotingHost* Create(ChromotingHostContext* context, |
| 70 MutableHostConfig* config); | 70 MutableHostConfig* config); |
| 71 static ChromotingHost* Create(ChromotingHostContext* context, | 71 static ChromotingHost* Create(ChromotingHostContext* context, |
| 72 MutableHostConfig* config, | 72 MutableHostConfig* config, |
| 73 Capturer* capturer); | 73 Capturer* capturer, |
| 74 protocol::InputStub* input_stub); | |
| 74 | 75 |
| 75 // Asynchronously start the host process. | 76 // Asynchronously start the host process. |
| 76 // | 77 // |
| 77 // After this is invoked, the host process will connect to the talk | 78 // After this is invoked, the host process will connect to the talk |
| 78 // network and start listening for incoming connections. | 79 // network and start listening for incoming connections. |
| 79 // | 80 // |
| 80 // |shutdown_task| is called if Start() has failed ot Shutdown() is called | 81 // |shutdown_task| is called if Start() has failed ot Shutdown() is called |
| 81 // and all related operations are completed. | 82 // and all related operations are completed. |
| 82 // | 83 // |
| 83 // This method can only be called once during the lifetime of this object. | 84 // This method can only be called once during the lifetime of this object. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 107 protocol::Session* session, | 108 protocol::Session* session, |
| 108 protocol::SessionManager::IncomingSessionResponse* response); | 109 protocol::SessionManager::IncomingSessionResponse* response); |
| 109 | 110 |
| 110 // Sets desired configuration for the protocol. Ownership of the | 111 // Sets desired configuration for the protocol. Ownership of the |
| 111 // |config| is transferred to the object. Must be called before Start(). | 112 // |config| is transferred to the object. Must be called before Start(). |
| 112 void set_protocol_config(protocol::CandidateSessionConfig* config); | 113 void set_protocol_config(protocol::CandidateSessionConfig* config); |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 friend class base::RefCountedThreadSafe<ChromotingHost>; | 116 friend class base::RefCountedThreadSafe<ChromotingHost>; |
| 116 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, | 117 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, |
| 117 Capturer* capturer); | 118 Capturer* capturer, protocol::InputStub* input_stub); |
| 118 virtual ~ChromotingHost(); | 119 virtual ~ChromotingHost(); |
| 119 | 120 |
| 120 enum State { | 121 enum State { |
| 121 kInitial, | 122 kInitial, |
| 122 kStarted, | 123 kStarted, |
| 123 kStopped, | 124 kStopped, |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 // Callback for protocol::SessionManager::Close(). | 127 // Callback for protocol::SessionManager::Close(). |
| 127 void OnServerClosed(); | 128 void OnServerClosed(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 | 179 |
| 179 // Configuration of the protocol. | 180 // Configuration of the protocol. |
| 180 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; | 181 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; |
| 181 | 182 |
| 182 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 183 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 183 }; | 184 }; |
| 184 | 185 |
| 185 } // namespace remoting | 186 } // namespace remoting |
| 186 | 187 |
| 187 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 188 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |