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/thread.h" | 10 #include "base/thread.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // return to the idle state. We then go to step (2) if there a new | 54 // return to the idle state. We then go to step (2) if there a new |
55 // incoming connection. | 55 // incoming connection. |
56 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, | 56 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
57 public ClientConnection::EventHandler, | 57 public ClientConnection::EventHandler, |
58 public JingleClient::Callback { | 58 public JingleClient::Callback { |
59 public: | 59 public: |
60 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, | 60 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, |
61 Capturer* capturer, Encoder* encoder, EventExecutor* executor); | 61 Capturer* capturer, Encoder* encoder, EventExecutor* executor); |
62 virtual ~ChromotingHost(); | 62 virtual ~ChromotingHost(); |
63 | 63 |
64 // Start the host process. This method starts the chromoting host | 64 // Asynchronously start the host process. |
65 // asynchronously. | 65 // |
| 66 // After this is invoked, the host process will connect to the talk |
| 67 // network and start listening for incoming connections. |
66 // | 68 // |
67 // |shutdown_task| is called if Start() has failed ot Shutdown() is called | 69 // |shutdown_task| is called if Start() has failed ot Shutdown() is called |
68 // and all related operations are completed. | 70 // and all related operations are completed. |
69 // | 71 // |
70 // This method can only be called once during the lifetime of this object. | 72 // This method can only be called once during the lifetime of this object. |
71 void Start(Task* shutdown_task); | 73 void Start(Task* shutdown_task); |
72 | 74 |
73 // This method is called when we need to destroy the host process. | 75 // Asynchronously shutdown the host process. |
74 void Shutdown(); | 76 void Shutdown(); |
75 | 77 |
76 // This method is called if a client is connected to this object. | 78 // This method is called if a client is connected to this object. |
77 void OnClientConnected(ClientConnection* client); | 79 void OnClientConnected(ClientConnection* client); |
78 | 80 |
79 // This method is called if a client is disconnected from the host. | 81 // This method is called if a client is disconnected from the host. |
80 void OnClientDisconnected(ClientConnection* client); | 82 void OnClientDisconnected(ClientConnection* client); |
81 | 83 |
82 //////////////////////////////////////////////////////////////////////////// | 84 //////////////////////////////////////////////////////////////////////////// |
83 // ClientConnection::EventHandler implementations | 85 // ClientConnection::EventHandler implementations |
(...skipping 13 matching lines...) Expand all Loading... |
97 JingleClient* jingle, | 99 JingleClient* jingle, |
98 scoped_refptr<JingleChannel> channel); | 100 scoped_refptr<JingleChannel> channel); |
99 | 101 |
100 private: | 102 private: |
101 enum State { | 103 enum State { |
102 kInitial, | 104 kInitial, |
103 kStarted, | 105 kStarted, |
104 kStopped, | 106 kStopped, |
105 }; | 107 }; |
106 | 108 |
107 // This method connects to the talk network and start listening for incoming | |
108 // connections. | |
109 void DoStart(Task* shutdown_task); | |
110 | |
111 // This method shuts down the host process. | |
112 void DoShutdown(); | |
113 | |
114 // The context that the chromoting host runs on. | 109 // The context that the chromoting host runs on. |
115 ChromotingHostContext* context_; | 110 ChromotingHostContext* context_; |
116 | 111 |
117 scoped_refptr<MutableHostConfig> config_; | 112 scoped_refptr<MutableHostConfig> config_; |
118 | 113 |
119 // Capturer to be used by SessionManager. Once the SessionManager is | 114 // Capturer to be used by SessionManager. Once the SessionManager is |
120 // constructed this is set to NULL. | 115 // constructed this is set to NULL. |
121 scoped_ptr<Capturer> capturer_; | 116 scoped_ptr<Capturer> capturer_; |
122 | 117 |
123 // Encoder to be used by the SessionManager. Once the SessionManager is | 118 // Encoder to be used by the SessionManager. Once the SessionManager is |
(...skipping 30 matching lines...) Expand all Loading... |
154 | 149 |
155 // Lock is to lock the access to |state_|. | 150 // Lock is to lock the access to |state_|. |
156 Lock lock_; | 151 Lock lock_; |
157 | 152 |
158 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 153 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
159 }; | 154 }; |
160 | 155 |
161 } // namespace remoting | 156 } // namespace remoting |
162 | 157 |
163 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 158 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
OLD | NEW |