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_SIMPLE_HOST_H_ | 5 #ifndef REMOTING_SIMPLE_HOST_H_ |
6 #define REMOTING_SIMPLE_HOST_H_ | 6 #define REMOTING_SIMPLE_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // | 40 // |
41 // 3. When the user is disconencted, we will pause the SessionManager | 41 // 3. When the user is disconencted, we will pause the SessionManager |
42 // and try to terminate the threads we have created. This will allow | 42 // and try to terminate the threads we have created. This will allow |
43 // all pending tasks to complete. After all of that completed we | 43 // all pending tasks to complete. After all of that completed we |
44 // return to the idle state. We then go to step (2) if there a new | 44 // return to the idle state. We then go to step (2) if there a new |
45 // incoming connection. | 45 // incoming connection. |
46 class SimpleHost : public base::RefCountedThreadSafe<SimpleHost>, | 46 class SimpleHost : public base::RefCountedThreadSafe<SimpleHost>, |
47 public ClientConnection::EventHandler, | 47 public ClientConnection::EventHandler, |
48 public JingleClient::Callback { | 48 public JingleClient::Callback { |
49 public: | 49 public: |
50 SimpleHost(const std::string& username, const std::string& auth_token, | 50 SimpleHost(const std::string& username, const std::string& password, |
51 Capturer* capturer, Encoder* encoder, EventExecutor* executor); | 51 Capturer* capturer, Encoder* encoder, EventExecutor* executor); |
52 | 52 |
53 // Run the host porcess. This method returns only after the message loop | 53 // Run the host porcess. This method returns only after the message loop |
54 // of the host process exits. | 54 // of the host process exits. |
55 void Run(); | 55 void Run(); |
56 | 56 |
57 // This method is called when we need to the host process. | 57 // This method is called when we need to the host process. |
58 void DestroySession(); | 58 void DestroySession(); |
59 | 59 |
60 // This method talks to the cloud to register the host process. If | 60 // This method talks to the cloud to register the host process. If |
(...skipping 28 matching lines...) Expand all Loading... |
89 // The message loop that this class runs on. | 89 // The message loop that this class runs on. |
90 MessageLoop main_loop_; | 90 MessageLoop main_loop_; |
91 | 91 |
92 // A thread that hosts capture operations. | 92 // A thread that hosts capture operations. |
93 base::Thread capture_thread_; | 93 base::Thread capture_thread_; |
94 | 94 |
95 // A thread that hosts encode operations. | 95 // A thread that hosts encode operations. |
96 base::Thread encode_thread_; | 96 base::Thread encode_thread_; |
97 | 97 |
98 std::string username_; | 98 std::string username_; |
99 std::string auth_token_; | 99 std::string password_; |
100 | 100 |
101 // Capturer to be used by SessionManager. Once the SessionManager is | 101 // Capturer to be used by SessionManager. Once the SessionManager is |
102 // constructed this is set to NULL. | 102 // constructed this is set to NULL. |
103 scoped_ptr<Capturer> capturer_; | 103 scoped_ptr<Capturer> capturer_; |
104 | 104 |
105 // Encoder to be used by the SessionManager. Once the SessionManager is | 105 // Encoder to be used by the SessionManager. Once the SessionManager is |
106 // constructed this is set to NULL. | 106 // constructed this is set to NULL. |
107 scoped_ptr<Encoder> encoder_; | 107 scoped_ptr<Encoder> encoder_; |
108 | 108 |
109 // EventExecutor executes input events received from the client. | 109 // EventExecutor executes input events received from the client. |
(...skipping 12 matching lines...) Expand all Loading... |
122 | 122 |
123 // Session manager for the host process. | 123 // Session manager for the host process. |
124 scoped_refptr<SessionManager> session_; | 124 scoped_refptr<SessionManager> session_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(SimpleHost); | 126 DISALLOW_COPY_AND_ASSIGN(SimpleHost); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace remoting | 129 } // namespace remoting |
130 | 130 |
131 #endif // REMOTING_HOST_SIMPLE_HOST_H_ | 131 #endif // REMOTING_HOST_SIMPLE_HOST_H_ |
OLD | NEW |