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 17 matching lines...) Expand all Loading... |
28 #include "base/logging.h" | 28 #include "base/logging.h" |
29 #include "base/message_loop.h" | 29 #include "base/message_loop.h" |
30 #include "base/path_service.h" | 30 #include "base/path_service.h" |
31 #include "base/test/mock_chrome_application_mac.h" | 31 #include "base/test/mock_chrome_application_mac.h" |
32 #include "base/threading/thread.h" | 32 #include "base/threading/thread.h" |
33 #include "crypto/nss_util.h" | 33 #include "crypto/nss_util.h" |
34 #include "remoting/base/constants.h" | 34 #include "remoting/base/constants.h" |
35 #include "remoting/host/capturer_fake.h" | 35 #include "remoting/host/capturer_fake.h" |
36 #include "remoting/host/chromoting_host.h" | 36 #include "remoting/host/chromoting_host.h" |
37 #include "remoting/host/chromoting_host_context.h" | 37 #include "remoting/host/chromoting_host_context.h" |
38 #include "remoting/host/continue_window.h" | |
39 #include "remoting/host/curtain.h" | |
40 #include "remoting/host/desktop_environment.h" | 38 #include "remoting/host/desktop_environment.h" |
41 #include "remoting/host/disconnect_window.h" | |
42 #include "remoting/host/event_executor.h" | 39 #include "remoting/host/event_executor.h" |
43 #include "remoting/host/heartbeat_sender.h" | 40 #include "remoting/host/heartbeat_sender.h" |
44 #include "remoting/host/host_secret.h" | 41 #include "remoting/host/host_secret.h" |
45 #include "remoting/host/local_input_monitor.h" | 42 #include "remoting/host/it2me_host_user_interface.h" |
46 #include "remoting/host/log_to_server.h" | 43 #include "remoting/host/log_to_server.h" |
47 #include "remoting/host/json_host_config.h" | 44 #include "remoting/host/json_host_config.h" |
48 #include "remoting/host/register_support_host_request.h" | 45 #include "remoting/host/register_support_host_request.h" |
49 #include "remoting/proto/video.pb.h" | 46 #include "remoting/proto/video.pb.h" |
50 | 47 |
51 #if defined(TOOLKIT_USES_GTK) | 48 #if defined(TOOLKIT_USES_GTK) |
52 #include "ui/gfx/gtk_util.h" | 49 #include "ui/gfx/gtk_util.h" |
53 #elif defined(OS_MACOSX) | 50 #elif defined(OS_MACOSX) |
54 #include "base/mac/scoped_nsautorelease_pool.h" | 51 #include "base/mac/scoped_nsautorelease_pool.h" |
55 #elif defined(OS_WIN) | 52 #elif defined(OS_WIN) |
56 // TODO(garykac) Make simple host into a proper GUI app on Windows so that we | 53 // TODO(garykac) Make simple host into a proper GUI app on Windows so that we |
57 // have an hModule for the dialog resource. | 54 // have an hModule for the dialog resource. |
58 HMODULE g_hModule = NULL; | 55 HMODULE g_hModule = NULL; |
59 #endif | 56 #endif |
60 | 57 |
61 using remoting::ChromotingHost; | 58 using remoting::ChromotingHost; |
62 using remoting::DesktopEnvironment; | 59 using remoting::DesktopEnvironment; |
63 using remoting::kChromotingTokenDefaultServiceName; | 60 using remoting::kChromotingTokenDefaultServiceName; |
64 using remoting::kXmppAuthServiceConfigPath; | 61 using remoting::kXmppAuthServiceConfigPath; |
| 62 using remoting::It2MeHostUserInterface; |
65 using remoting::protocol::CandidateSessionConfig; | 63 using remoting::protocol::CandidateSessionConfig; |
66 using remoting::protocol::ChannelConfig; | 64 using remoting::protocol::ChannelConfig; |
67 using std::string; | 65 using std::string; |
68 using std::wstring; | 66 using std::wstring; |
69 | 67 |
70 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
71 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json"; | 69 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json"; |
72 const wchar_t kHomeDrive[] = L"HOMEDRIVE"; | 70 const wchar_t kHomeDrive[] = L"HOMEDRIVE"; |
73 const wchar_t kHomePath[] = L"HOMEPATH"; | 71 const wchar_t kHomePath[] = L"HOMEPATH"; |
74 // TODO(sergeyu): Use environment utils from base/environment.h. | 72 // TODO(sergeyu): Use environment utils from base/environment.h. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 context.network_message_loop())); | 145 context.network_message_loop())); |
148 | 146 |
149 // Construct a chromoting host. | 147 // Construct a chromoting host. |
150 scoped_ptr<DesktopEnvironment> desktop_environment; | 148 scoped_ptr<DesktopEnvironment> desktop_environment; |
151 if (fake_) { | 149 if (fake_) { |
152 remoting::Capturer* capturer = | 150 remoting::Capturer* capturer = |
153 new remoting::CapturerFake(); | 151 new remoting::CapturerFake(); |
154 remoting::EventExecutor* event_executor = | 152 remoting::EventExecutor* event_executor = |
155 remoting::EventExecutor::Create(context.desktop_message_loop(), | 153 remoting::EventExecutor::Create(context.desktop_message_loop(), |
156 capturer); | 154 capturer); |
157 remoting::Curtain* curtain = remoting::Curtain::Create(); | |
158 remoting::DisconnectWindow* disconnect_window = | |
159 remoting::DisconnectWindow::Create(); | |
160 remoting::ContinueWindow* continue_window = | |
161 remoting::ContinueWindow::Create(); | |
162 remoting::LocalInputMonitor* local_input_monitor = | |
163 remoting::LocalInputMonitor::Create(); | |
164 desktop_environment.reset( | 155 desktop_environment.reset( |
165 new DesktopEnvironment(&context, capturer, event_executor, curtain, | 156 new DesktopEnvironment(&context, capturer, event_executor)); |
166 disconnect_window, continue_window, | |
167 local_input_monitor)); | |
168 } else { | 157 } else { |
169 desktop_environment.reset(DesktopEnvironment::Create(&context)); | 158 desktop_environment.reset(DesktopEnvironment::Create(&context)); |
170 } | 159 } |
171 | 160 |
172 host_ = ChromotingHost::Create( | 161 host_ = ChromotingHost::Create( |
173 &context, config, desktop_environment.get(), false); | 162 &context, config, desktop_environment.get(), false); |
174 host_->set_it2me(is_it2me_); | 163 host_->set_it2me(is_it2me_); |
175 | 164 |
| 165 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface; |
| 166 if (is_it2me_) { |
| 167 it2me_host_user_interface.reset(new It2MeHostUserInterface(host_, |
| 168 &context)); |
| 169 it2me_host_user_interface->Init(); |
| 170 host_->AddStatusObserver(it2me_host_user_interface.get()); |
| 171 } |
| 172 |
176 if (protocol_config_.get()) { | 173 if (protocol_config_.get()) { |
177 host_->set_protocol_config(protocol_config_.release()); | 174 host_->set_protocol_config(protocol_config_.release()); |
178 } | 175 } |
179 | 176 |
180 if (is_it2me_) { | 177 if (is_it2me_) { |
181 host_->AddStatusObserver(register_request.get()); | 178 host_->AddStatusObserver(register_request.get()); |
182 } else { | 179 } else { |
183 // Initialize HeartbeatSender. | 180 // Initialize HeartbeatSender. |
184 heartbeat_sender.reset( | 181 heartbeat_sender.reset( |
185 new remoting::HeartbeatSender(context.network_message_loop(), | 182 new remoting::HeartbeatSender(context.network_message_loop(), |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 LOG(ERROR) << "Unknown video codec: " << video_codec; | 295 LOG(ERROR) << "Unknown video codec: " << video_codec; |
299 return 1; | 296 return 1; |
300 } | 297 } |
301 config->mutable_video_configs()->push_back(ChannelConfig( | 298 config->mutable_video_configs()->push_back(ChannelConfig( |
302 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 299 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
303 simple_host.set_protocol_config(config.release()); | 300 simple_host.set_protocol_config(config.release()); |
304 } | 301 } |
305 | 302 |
306 return simple_host.Run(); | 303 return simple_host.Run(); |
307 } | 304 } |
OLD | NEW |