Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: remoting/host/chromoting_host.h

Issue 6911024: Add HostObserverInterface and decouple HeartbeatSender and ChromotingHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/service/remoting/chromoting_host_manager.cc ('k') | remoting/host/chromoting_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "remoting/base/encoder.h" 12 #include "remoting/base/encoder.h"
13 #include "remoting/host/access_verifier.h" 13 #include "remoting/host/access_verifier.h"
14 #include "remoting/host/capturer.h" 14 #include "remoting/host/capturer.h"
15 #include "remoting/host/client_session.h" 15 #include "remoting/host/client_session.h"
16 #include "remoting/host/desktop_environment.h" 16 #include "remoting/host/desktop_environment.h"
17 #include "remoting/host/heartbeat_sender.h" 17 #include "remoting/host/host_status_observer.h"
18 #include "remoting/jingle_glue/jingle_client.h" 18 #include "remoting/jingle_glue/jingle_client.h"
19 #include "remoting/jingle_glue/jingle_thread.h" 19 #include "remoting/jingle_glue/jingle_thread.h"
20 #include "remoting/protocol/session_manager.h" 20 #include "remoting/protocol/session_manager.h"
21 #include "remoting/protocol/connection_to_client.h" 21 #include "remoting/protocol/connection_to_client.h"
22 22
23 class Task; 23 class Task;
24 24
25 namespace remoting { 25 namespace remoting {
26 26
27 namespace protocol { 27 namespace protocol {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // 82 //
83 // |shutdown_task| is called if Start() has failed ot Shutdown() is called 83 // |shutdown_task| is called if Start() has failed ot Shutdown() is called
84 // and all related operations are completed. 84 // and all related operations are completed.
85 // 85 //
86 // This method can only be called once during the lifetime of this object. 86 // This method can only be called once during the lifetime of this object.
87 void Start(Task* shutdown_task); 87 void Start(Task* shutdown_task);
88 88
89 // Asynchronously shutdown the host process. 89 // Asynchronously shutdown the host process.
90 void Shutdown(); 90 void Shutdown();
91 91
92 void AddStatusObserver(const scoped_refptr<HostStatusObserver>& observer);
93
92 //////////////////////////////////////////////////////////////////////////// 94 ////////////////////////////////////////////////////////////////////////////
93 // protocol::ConnectionToClient::EventHandler implementations 95 // protocol::ConnectionToClient::EventHandler implementations
94 virtual void OnConnectionOpened(protocol::ConnectionToClient* client); 96 virtual void OnConnectionOpened(protocol::ConnectionToClient* client);
95 virtual void OnConnectionClosed(protocol::ConnectionToClient* client); 97 virtual void OnConnectionClosed(protocol::ConnectionToClient* client);
96 virtual void OnConnectionFailed(protocol::ConnectionToClient* client); 98 virtual void OnConnectionFailed(protocol::ConnectionToClient* client);
97 99
98 //////////////////////////////////////////////////////////////////////////// 100 ////////////////////////////////////////////////////////////////////////////
99 // JingleClient::Callback implementations 101 // JingleClient::Callback implementations
100 virtual void OnStateChange(JingleClient* client, JingleClient::State state); 102 virtual void OnStateChange(JingleClient* client, JingleClient::State state);
101 103
(...skipping 10 matching lines...) Expand all
112 protocol::SessionManager::IncomingSessionResponse* response); 114 protocol::SessionManager::IncomingSessionResponse* response);
113 115
114 // Sets desired configuration for the protocol. Ownership of the 116 // Sets desired configuration for the protocol. Ownership of the
115 // |config| is transferred to the object. Must be called before Start(). 117 // |config| is transferred to the object. Must be called before Start().
116 void set_protocol_config(protocol::CandidateSessionConfig* config); 118 void set_protocol_config(protocol::CandidateSessionConfig* config);
117 119
118 private: 120 private:
119 friend class base::RefCountedThreadSafe<ChromotingHost>; 121 friend class base::RefCountedThreadSafe<ChromotingHost>;
120 friend class ChromotingHostTest; 122 friend class ChromotingHostTest;
121 123
124 typedef std::vector<scoped_refptr<HostStatusObserver> > StatusObserverList;
125 typedef std::vector<scoped_refptr<ClientSession> > ClientList;
126
122 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config, 127 ChromotingHost(ChromotingHostContext* context, MutableHostConfig* config,
123 DesktopEnvironment* environment); 128 DesktopEnvironment* environment);
124 virtual ~ChromotingHost(); 129 virtual ~ChromotingHost();
125 130
126 enum State { 131 enum State {
127 kInitial, 132 kInitial,
128 kStarted, 133 kStarted,
129 kStopped, 134 kStopped,
130 }; 135 };
131 136
(...skipping 20 matching lines...) Expand all
152 scoped_ptr<DesktopEnvironment> desktop_environment_; 157 scoped_ptr<DesktopEnvironment> desktop_environment_;
153 158
154 scoped_ptr<SignalStrategy> signal_strategy_; 159 scoped_ptr<SignalStrategy> signal_strategy_;
155 160
156 // The libjingle client. This is used to connect to the talk network to 161 // The libjingle client. This is used to connect to the talk network to
157 // receive connection requests from chromoting client. 162 // receive connection requests from chromoting client.
158 scoped_refptr<JingleClient> jingle_client_; 163 scoped_refptr<JingleClient> jingle_client_;
159 164
160 scoped_refptr<protocol::SessionManager> session_manager_; 165 scoped_refptr<protocol::SessionManager> session_manager_;
161 166
162 // Objects that takes care of sending heartbeats to the chromoting bot. 167 StatusObserverList status_observers_;
163 scoped_refptr<HeartbeatSender> heartbeat_sender_;
164 168
165 AccessVerifier access_verifier_; 169 AccessVerifier access_verifier_;
166 170
167 // The connections to remote clients. 171 // The connections to remote clients.
168 std::vector<scoped_refptr<ClientSession> > clients_; 172 ClientList clients_;
169 173
170 // Session manager for the host process. 174 // Session manager for the host process.
171 scoped_refptr<ScreenRecorder> recorder_; 175 scoped_refptr<ScreenRecorder> recorder_;
172 176
173 // This task gets executed when this object fails to connect to the 177 // This task gets executed when this object fails to connect to the
174 // talk network or Shutdown() is called. 178 // talk network or Shutdown() is called.
175 scoped_ptr<Task> shutdown_task_; 179 scoped_ptr<Task> shutdown_task_;
176 180
177 // Tracks the internal state of the host. 181 // Tracks the internal state of the host.
178 // This variable is written on the main thread of ChromotingHostContext 182 // This variable is written on the main thread of ChromotingHostContext
179 // and read by jingle thread. 183 // and read by jingle thread.
180 State state_; 184 State state_;
181 185
182 // Lock is to lock the access to |state_|. 186 // Lock is to lock the access to |state_|.
183 base::Lock lock_; 187 base::Lock lock_;
184 188
185 // Configuration of the protocol. 189 // Configuration of the protocol.
186 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; 190 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_;
187 191
188 // Whether or not the host is currently curtained. 192 // Whether or not the host is currently curtained.
189 bool is_curtained_; 193 bool is_curtained_;
190 194
191 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); 195 DISALLOW_COPY_AND_ASSIGN(ChromotingHost);
192 }; 196 };
193 197
194 } // namespace remoting 198 } // namespace remoting
195 199
196 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ 200 #endif // REMOTING_HOST_CHROMOTING_HOST_H_
OLDNEW
« no previous file with comments | « chrome/service/remoting/chromoting_host_manager.cc ('k') | remoting/host/chromoting_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698