| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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 instances. | 67 // Factory methods that must be used to create ChromotingHost |
| 68 // Default capturer and input stub are used if it is not specified. | 68 // instances. Default capturer is used if it is not specified. |
| 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); | |
| 75 | 74 |
| 76 // Asynchronously start the host process. | 75 // Asynchronously start the host process. |
| 77 // | 76 // |
| 78 // After this is invoked, the host process will connect to the talk | 77 // After this is invoked, the host process will connect to the talk |
| 79 // network and start listening for incoming connections. | 78 // network and start listening for incoming connections. |
| 80 // | 79 // |
| 81 // |shutdown_task| is called if Start() has failed ot Shutdown() is called | 80 // |shutdown_task| is called if Start() has failed ot Shutdown() is called |
| 82 // and all related operations are completed. | 81 // and all related operations are completed. |
| 83 // | 82 // |
| 84 // This method can only be called once during the lifetime of this object. | 83 // This method can only be called once during the lifetime of this object. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 108 protocol::Session* session, | 107 protocol::Session* session, |
| 109 protocol::SessionManager::IncomingSessionResponse* response); | 108 protocol::SessionManager::IncomingSessionResponse* response); |
| 110 | 109 |
| 111 // Sets desired configuration for the protocol. Ownership of the | 110 // Sets desired configuration for the protocol. Ownership of the |
| 112 // |config| is transferred to the object. Must be called before Start(). | 111 // |config| is transferred to the object. Must be called before Start(). |
| 113 void set_protocol_config(protocol::CandidateSessionConfig* config); | 112 void set_protocol_config(protocol::CandidateSessionConfig* config); |
| 114 | 113 |
| 115 private: | 114 private: |
| 116 friend class base::RefCountedThreadSafe<ChromotingHost>; | 115 friend class base::RefCountedThreadSafe<ChromotingHost>; |
| 117 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, | 116 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, |
| 118 Capturer* capturer, protocol::InputStub* input_stub); | 117 Capturer* capturer); |
| 119 virtual ~ChromotingHost(); | 118 virtual ~ChromotingHost(); |
| 120 | 119 |
| 121 enum State { | 120 enum State { |
| 122 kInitial, | 121 kInitial, |
| 123 kStarted, | 122 kStarted, |
| 124 kStopped, | 123 kStopped, |
| 125 }; | 124 }; |
| 126 | 125 |
| 127 // Callback for protocol::SessionManager::Close(). | 126 // Callback for protocol::SessionManager::Close(). |
| 128 void OnServerClosed(); | 127 void OnServerClosed(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 178 |
| 180 // Configuration of the protocol. | 179 // Configuration of the protocol. |
| 181 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; | 180 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; |
| 182 | 181 |
| 183 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 182 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 184 }; | 183 }; |
| 185 | 184 |
| 186 } // namespace remoting | 185 } // namespace remoting |
| 187 | 186 |
| 188 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 187 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |