OLD | NEW |
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 // This is an application of a minimal host process in a Chromoting | 5 // This is an application of a minimal host process in a Chromoting |
6 // system. It serves the purpose of gluing different pieces together | 6 // system. It serves the purpose of gluing different pieces together |
7 // to make a functional host process for testing. | 7 // to make a functional host process for testing. |
8 // | 8 // |
9 // It peforms the following functionality: | 9 // It peforms the following functionality: |
10 // 1. Connect to the GTalk network and register the machine as a host. | 10 // 1. Connect to the GTalk network and register the machine as a host. |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "base/file_path.h" | 27 #include "base/file_path.h" |
28 #include "base/logging.h" | 28 #include "base/logging.h" |
29 #include "base/mac/scoped_nsautorelease_pool.h" | 29 #include "base/mac/scoped_nsautorelease_pool.h" |
30 #include "base/message_loop.h" | 30 #include "base/message_loop.h" |
31 #include "base/path_service.h" | 31 #include "base/path_service.h" |
32 #include "base/test/mock_chrome_application_mac.h" | 32 #include "base/test/mock_chrome_application_mac.h" |
33 #include "base/threading/thread.h" | 33 #include "base/threading/thread.h" |
34 #include "crypto/nss_util.h" | 34 #include "crypto/nss_util.h" |
35 #include "media/base/media.h" | 35 #include "media/base/media.h" |
36 #include "remoting/base/constants.h" | 36 #include "remoting/base/constants.h" |
37 #include "remoting/base/logger.h" | |
38 #include "remoting/base/tracer.h" | 37 #include "remoting/base/tracer.h" |
39 #include "remoting/host/capturer_fake.h" | 38 #include "remoting/host/capturer_fake.h" |
40 #include "remoting/host/chromoting_host.h" | 39 #include "remoting/host/chromoting_host.h" |
41 #include "remoting/host/chromoting_host_context.h" | 40 #include "remoting/host/chromoting_host_context.h" |
42 #include "remoting/host/continue_window.h" | 41 #include "remoting/host/continue_window.h" |
43 #include "remoting/host/curtain.h" | 42 #include "remoting/host/curtain.h" |
44 #include "remoting/host/desktop_environment.h" | 43 #include "remoting/host/desktop_environment.h" |
45 #include "remoting/host/disconnect_window.h" | 44 #include "remoting/host/disconnect_window.h" |
46 #include "remoting/host/event_executor.h" | 45 #include "remoting/host/event_executor.h" |
47 #include "remoting/host/heartbeat_sender.h" | 46 #include "remoting/host/heartbeat_sender.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } else { | 168 } else { |
170 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( | 169 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( |
171 new remoting::SelfAccessVerifier()); | 170 new remoting::SelfAccessVerifier()); |
172 if (!self_access_verifier->Init(config)) | 171 if (!self_access_verifier->Init(config)) |
173 return 1; | 172 return 1; |
174 access_verifier.reset(self_access_verifier.release()); | 173 access_verifier.reset(self_access_verifier.release()); |
175 } | 174 } |
176 | 175 |
177 // Construct a chromoting host. | 176 // Construct a chromoting host. |
178 scoped_refptr<ChromotingHost> host; | 177 scoped_refptr<ChromotingHost> host; |
179 logger_.reset(new remoting::Logger()); | |
180 if (fake_) { | 178 if (fake_) { |
181 remoting::Capturer* capturer = | 179 remoting::Capturer* capturer = |
182 new remoting::CapturerFake(); | 180 new remoting::CapturerFake(); |
183 remoting::EventExecutor* event_executor = | 181 remoting::EventExecutor* event_executor = |
184 remoting::EventExecutor::Create(context.desktop_message_loop(), | 182 remoting::EventExecutor::Create(context.desktop_message_loop(), |
185 capturer); | 183 capturer); |
186 remoting::Curtain* curtain = remoting::Curtain::Create(); | 184 remoting::Curtain* curtain = remoting::Curtain::Create(); |
187 remoting::DisconnectWindow* disconnect_window = | 185 remoting::DisconnectWindow* disconnect_window = |
188 remoting::DisconnectWindow::Create(); | 186 remoting::DisconnectWindow::Create(); |
189 remoting::ContinueWindow* continue_window = | 187 remoting::ContinueWindow* continue_window = |
190 remoting::ContinueWindow::Create(); | 188 remoting::ContinueWindow::Create(); |
191 remoting::LocalInputMonitor* local_input_monitor = | 189 remoting::LocalInputMonitor* local_input_monitor = |
192 remoting::LocalInputMonitor::Create(); | 190 remoting::LocalInputMonitor::Create(); |
193 host = ChromotingHost::Create( | 191 host = ChromotingHost::Create( |
194 &context, config, | 192 &context, config, |
195 new DesktopEnvironment(&context, capturer, event_executor, curtain, | 193 new DesktopEnvironment(&context, capturer, event_executor, curtain, |
196 disconnect_window, continue_window, | 194 disconnect_window, continue_window, |
197 local_input_monitor), | 195 local_input_monitor), |
198 access_verifier.release(), logger_.get()); | 196 access_verifier.release()); |
199 } else { | 197 } else { |
200 host = ChromotingHost::Create(&context, config, | 198 host = ChromotingHost::Create(&context, config, |
201 access_verifier.release(), logger_.get()); | 199 access_verifier.release()); |
202 } | 200 } |
203 host->set_it2me(is_it2me_); | 201 host->set_it2me(is_it2me_); |
204 | 202 |
205 if (protocol_config_.get()) { | 203 if (protocol_config_.get()) { |
206 host->set_protocol_config(protocol_config_.release()); | 204 host->set_protocol_config(protocol_config_.release()); |
207 } | 205 } |
208 | 206 |
209 if (is_it2me_) { | 207 if (is_it2me_) { |
210 host->AddStatusObserver(register_request.get()); | 208 host->AddStatusObserver(register_request.get()); |
211 } else { | 209 } else { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 243 |
246 #if defined(OS_WIN) | 244 #if defined(OS_WIN) |
247 wstring home_path = GetEnvironmentVar(kHomeDrive); | 245 wstring home_path = GetEnvironmentVar(kHomeDrive); |
248 home_path += GetEnvironmentVar(kHomePath); | 246 home_path += GetEnvironmentVar(kHomePath); |
249 #else | 247 #else |
250 string home_path = GetEnvironmentVar(base::env_vars::kHome); | 248 string home_path = GetEnvironmentVar(base::env_vars::kHome); |
251 #endif | 249 #endif |
252 return FilePath(home_path).Append(kDefaultConfigPath); | 250 return FilePath(home_path).Append(kDefaultConfigPath); |
253 } | 251 } |
254 | 252 |
255 scoped_ptr<remoting::Logger> logger_; | |
256 | |
257 FilePath config_path_; | 253 FilePath config_path_; |
258 bool fake_; | 254 bool fake_; |
259 bool is_it2me_; | 255 bool is_it2me_; |
260 scoped_ptr<CandidateSessionConfig> protocol_config_; | 256 scoped_ptr<CandidateSessionConfig> protocol_config_; |
261 }; | 257 }; |
262 | 258 |
263 int main(int argc, char** argv) { | 259 int main(int argc, char** argv) { |
264 // Needed for the Mac, so we don't leak objects when threads are created. | 260 // Needed for the Mac, so we don't leak objects when threads are created. |
265 base::mac::ScopedNSAutoreleasePool pool; | 261 base::mac::ScopedNSAutoreleasePool pool; |
266 | 262 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 LOG(ERROR) << "Unknown video codec: " << video_codec; | 309 LOG(ERROR) << "Unknown video codec: " << video_codec; |
314 return 1; | 310 return 1; |
315 } | 311 } |
316 config->mutable_video_configs()->push_back(ChannelConfig( | 312 config->mutable_video_configs()->push_back(ChannelConfig( |
317 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 313 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
318 simple_host.set_protocol_config(config.release()); | 314 simple_host.set_protocol_config(config.release()); |
319 } | 315 } |
320 | 316 |
321 return simple_host.Run(); | 317 return simple_host.Run(); |
322 } | 318 } |
OLD | NEW |