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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 access_verifier.reset(support_access_verifier.release()); | 156 access_verifier.reset(support_access_verifier.release()); |
158 } else { | 157 } else { |
159 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( | 158 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( |
160 new remoting::SelfAccessVerifier()); | 159 new remoting::SelfAccessVerifier()); |
161 if (!self_access_verifier->Init(config)) | 160 if (!self_access_verifier->Init(config)) |
162 return 1; | 161 return 1; |
163 access_verifier.reset(self_access_verifier.release()); | 162 access_verifier.reset(self_access_verifier.release()); |
164 } | 163 } |
165 | 164 |
166 // Construct a chromoting host. | 165 // Construct a chromoting host. |
167 logger_.reset(new remoting::Logger()); | |
168 scoped_ptr<DesktopEnvironment> desktop_environment; | 166 scoped_ptr<DesktopEnvironment> desktop_environment; |
169 if (fake_) { | 167 if (fake_) { |
170 remoting::Capturer* capturer = | 168 remoting::Capturer* capturer = |
171 new remoting::CapturerFake(); | 169 new remoting::CapturerFake(); |
172 remoting::EventExecutor* event_executor = | 170 remoting::EventExecutor* event_executor = |
173 remoting::EventExecutor::Create(context.desktop_message_loop(), | 171 remoting::EventExecutor::Create(context.desktop_message_loop(), |
174 capturer); | 172 capturer); |
175 remoting::Curtain* curtain = remoting::Curtain::Create(); | 173 remoting::Curtain* curtain = remoting::Curtain::Create(); |
176 remoting::DisconnectWindow* disconnect_window = | 174 remoting::DisconnectWindow* disconnect_window = |
177 remoting::DisconnectWindow::Create(); | 175 remoting::DisconnectWindow::Create(); |
178 remoting::ContinueWindow* continue_window = | 176 remoting::ContinueWindow* continue_window = |
179 remoting::ContinueWindow::Create(); | 177 remoting::ContinueWindow::Create(); |
180 remoting::LocalInputMonitor* local_input_monitor = | 178 remoting::LocalInputMonitor* local_input_monitor = |
181 remoting::LocalInputMonitor::Create(); | 179 remoting::LocalInputMonitor::Create(); |
182 desktop_environment.reset( | 180 desktop_environment.reset( |
183 new DesktopEnvironment(&context, capturer, event_executor, curtain, | 181 new DesktopEnvironment(&context, capturer, event_executor, curtain, |
184 disconnect_window, continue_window, | 182 disconnect_window, continue_window, |
185 local_input_monitor)); | 183 local_input_monitor)); |
186 } else { | 184 } else { |
187 desktop_environment.reset(DesktopEnvironment::Create(&context)); | 185 desktop_environment.reset(DesktopEnvironment::Create(&context)); |
188 } | 186 } |
189 | 187 |
190 host_ = ChromotingHost::Create(&context, config, desktop_environment.get(), | 188 host_ = ChromotingHost::Create(&context, config, desktop_environment.get(), |
191 access_verifier.release(), logger_.get(), | 189 access_verifier.release(), false); |
192 false); | |
193 host_->set_it2me(is_it2me_); | 190 host_->set_it2me(is_it2me_); |
194 | 191 |
195 if (protocol_config_.get()) { | 192 if (protocol_config_.get()) { |
196 host_->set_protocol_config(protocol_config_.release()); | 193 host_->set_protocol_config(protocol_config_.release()); |
197 } | 194 } |
198 | 195 |
199 if (is_it2me_) { | 196 if (is_it2me_) { |
200 host_->AddStatusObserver(register_request.get()); | 197 host_->AddStatusObserver(register_request.get()); |
201 } else { | 198 } else { |
202 // Initialize HeartbeatSender. | 199 // Initialize HeartbeatSender. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 252 |
256 #if defined(OS_WIN) | 253 #if defined(OS_WIN) |
257 wstring home_path = GetEnvironmentVar(kHomeDrive); | 254 wstring home_path = GetEnvironmentVar(kHomeDrive); |
258 home_path += GetEnvironmentVar(kHomePath); | 255 home_path += GetEnvironmentVar(kHomePath); |
259 #else | 256 #else |
260 string home_path = GetEnvironmentVar(base::env_vars::kHome); | 257 string home_path = GetEnvironmentVar(base::env_vars::kHome); |
261 #endif | 258 #endif |
262 return FilePath(home_path).Append(kDefaultConfigPath); | 259 return FilePath(home_path).Append(kDefaultConfigPath); |
263 } | 260 } |
264 | 261 |
265 scoped_ptr<remoting::Logger> logger_; | |
266 | |
267 FilePath config_path_; | 262 FilePath config_path_; |
268 bool fake_; | 263 bool fake_; |
269 bool is_it2me_; | 264 bool is_it2me_; |
270 scoped_ptr<CandidateSessionConfig> protocol_config_; | 265 scoped_ptr<CandidateSessionConfig> protocol_config_; |
271 | 266 |
272 scoped_refptr<ChromotingHost> host_; | 267 scoped_refptr<ChromotingHost> host_; |
273 }; | 268 }; |
274 | 269 |
275 int main(int argc, char** argv) { | 270 int main(int argc, char** argv) { |
276 // Needed for the Mac, so we don't leak objects when threads are created. | 271 // Needed for the Mac, so we don't leak objects when threads are created. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 LOG(ERROR) << "Unknown video codec: " << video_codec; | 320 LOG(ERROR) << "Unknown video codec: " << video_codec; |
326 return 1; | 321 return 1; |
327 } | 322 } |
328 config->mutable_video_configs()->push_back(ChannelConfig( | 323 config->mutable_video_configs()->push_back(ChannelConfig( |
329 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 324 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
330 simple_host.set_protocol_config(config.release()); | 325 simple_host.set_protocol_config(config.release()); |
331 } | 326 } |
332 | 327 |
333 return simple_host.Run(); | 328 return simple_host.Run(); |
334 } | 329 } |
OLD | NEW |