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" | |
37 #include "remoting/base/tracer.h" | 38 #include "remoting/base/tracer.h" |
38 #include "remoting/host/capturer_fake.h" | 39 #include "remoting/host/capturer_fake.h" |
39 #include "remoting/host/chromoting_host.h" | 40 #include "remoting/host/chromoting_host.h" |
40 #include "remoting/host/chromoting_host_context.h" | 41 #include "remoting/host/chromoting_host_context.h" |
41 #include "remoting/host/continue_window.h" | 42 #include "remoting/host/continue_window.h" |
42 #include "remoting/host/curtain.h" | 43 #include "remoting/host/curtain.h" |
43 #include "remoting/host/desktop_environment.h" | 44 #include "remoting/host/desktop_environment.h" |
44 #include "remoting/host/disconnect_window.h" | 45 #include "remoting/host/disconnect_window.h" |
45 #include "remoting/host/event_executor.h" | 46 #include "remoting/host/event_executor.h" |
46 #include "remoting/host/heartbeat_sender.h" | 47 #include "remoting/host/heartbeat_sender.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 } else { | 169 } else { |
169 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( | 170 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( |
170 new remoting::SelfAccessVerifier()); | 171 new remoting::SelfAccessVerifier()); |
171 if (!self_access_verifier->Init(config)) | 172 if (!self_access_verifier->Init(config)) |
172 return 1; | 173 return 1; |
173 access_verifier.reset(self_access_verifier.release()); | 174 access_verifier.reset(self_access_verifier.release()); |
174 } | 175 } |
175 | 176 |
176 // Construct a chromoting host. | 177 // Construct a chromoting host. |
177 scoped_refptr<ChromotingHost> host; | 178 scoped_refptr<ChromotingHost> host; |
179 logger_.reset(new remoting::Logger()); | |
178 if (fake_) { | 180 if (fake_) { |
179 remoting::Capturer* capturer = | 181 remoting::Capturer* capturer = |
180 new remoting::CapturerFake(); | 182 new remoting::CapturerFake(); |
181 remoting::EventExecutor* event_executor = | 183 remoting::EventExecutor* event_executor = |
182 remoting::EventExecutor::Create(context.desktop_message_loop(), | 184 remoting::EventExecutor::Create(context.desktop_message_loop(), |
183 capturer); | 185 capturer); |
184 remoting::Curtain* curtain = remoting::Curtain::Create(); | 186 remoting::Curtain* curtain = remoting::Curtain::Create(); |
185 remoting::DisconnectWindow* disconnect_window = | 187 remoting::DisconnectWindow* disconnect_window = |
186 remoting::DisconnectWindow::Create(); | 188 remoting::DisconnectWindow::Create(); |
187 remoting::ContinueWindow* continue_window = | 189 remoting::ContinueWindow* continue_window = |
188 remoting::ContinueWindow::Create(); | 190 remoting::ContinueWindow::Create(); |
189 remoting::LocalInputMonitor* local_input_monitor = | 191 remoting::LocalInputMonitor* local_input_monitor = |
190 remoting::LocalInputMonitor::Create(); | 192 remoting::LocalInputMonitor::Create(); |
191 host = ChromotingHost::Create( | 193 host = ChromotingHost::Create( |
192 &context, config, | 194 &context, config, |
193 new DesktopEnvironment(capturer, event_executor, curtain, | 195 new DesktopEnvironment(capturer, event_executor, curtain, |
194 disconnect_window, continue_window, | 196 disconnect_window, continue_window, |
195 local_input_monitor), | 197 local_input_monitor), |
196 access_verifier.release()); | 198 access_verifier.release(), logger_.get()); |
dmac
2011/06/26 14:34:44
do you actually need to call get here and below? C
garykac
2011/06/27 21:24:20
When using it, yes. But here is tries to pass scop
| |
197 } else { | 199 } else { |
198 host = ChromotingHost::Create(&context, config, | 200 host = ChromotingHost::Create(&context, config, |
199 access_verifier.release()); | 201 access_verifier.release(), logger_.get()); |
200 } | 202 } |
201 host->set_it2me(is_it2me_); | 203 host->set_it2me(is_it2me_); |
202 | 204 |
203 if (protocol_config_.get()) { | 205 if (protocol_config_.get()) { |
204 host->set_protocol_config(protocol_config_.release()); | 206 host->set_protocol_config(protocol_config_.release()); |
205 } | 207 } |
206 | 208 |
207 if (is_it2me_) { | 209 if (is_it2me_) { |
208 host->AddStatusObserver(register_request.get()); | 210 host->AddStatusObserver(register_request.get()); |
209 } else { | 211 } else { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 | 245 |
244 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
245 wstring home_path = GetEnvironmentVar(kHomeDrive); | 247 wstring home_path = GetEnvironmentVar(kHomeDrive); |
246 home_path += GetEnvironmentVar(kHomePath); | 248 home_path += GetEnvironmentVar(kHomePath); |
247 #else | 249 #else |
248 string home_path = GetEnvironmentVar(base::env_vars::kHome); | 250 string home_path = GetEnvironmentVar(base::env_vars::kHome); |
249 #endif | 251 #endif |
250 return FilePath(home_path).Append(kDefaultConfigPath); | 252 return FilePath(home_path).Append(kDefaultConfigPath); |
251 } | 253 } |
252 | 254 |
255 scoped_ptr<remoting::Logger> logger_; | |
256 | |
253 FilePath config_path_; | 257 FilePath config_path_; |
254 bool fake_; | 258 bool fake_; |
255 bool is_it2me_; | 259 bool is_it2me_; |
256 scoped_ptr<CandidateSessionConfig> protocol_config_; | 260 scoped_ptr<CandidateSessionConfig> protocol_config_; |
257 }; | 261 }; |
258 | 262 |
259 int main(int argc, char** argv) { | 263 int main(int argc, char** argv) { |
260 // Needed for the Mac, so we don't leak objects when threads are created. | 264 // Needed for the Mac, so we don't leak objects when threads are created. |
261 base::mac::ScopedNSAutoreleasePool pool; | 265 base::mac::ScopedNSAutoreleasePool pool; |
262 | 266 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 LOG(ERROR) << "Unknown video codec: " << video_codec; | 313 LOG(ERROR) << "Unknown video codec: " << video_codec; |
310 return 1; | 314 return 1; |
311 } | 315 } |
312 config->mutable_video_configs()->push_back(ChannelConfig( | 316 config->mutable_video_configs()->push_back(ChannelConfig( |
313 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 317 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
314 simple_host.set_protocol_config(config.release()); | 318 simple_host.set_protocol_config(config.release()); |
315 } | 319 } |
316 | 320 |
317 return simple_host.Run(); | 321 return simple_host.Run(); |
318 } | 322 } |
OLD | NEW |