| 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/local_input_monitor.h" | 41 #include "remoting/host/it2me_host_user_interface.h" |
| 45 #include "remoting/host/log_to_server.h" | 42 #include "remoting/host/log_to_server.h" |
| 46 #include "remoting/host/json_host_config.h" | 43 #include "remoting/host/json_host_config.h" |
| 47 #include "remoting/host/register_support_host_request.h" | 44 #include "remoting/host/register_support_host_request.h" |
| 48 #include "remoting/host/self_access_verifier.h" | 45 #include "remoting/host/self_access_verifier.h" |
| 49 #include "remoting/host/support_access_verifier.h" | 46 #include "remoting/host/support_access_verifier.h" |
| 50 #include "remoting/proto/video.pb.h" | 47 #include "remoting/proto/video.pb.h" |
| 51 | 48 |
| 52 #if defined(TOOLKIT_USES_GTK) | 49 #if defined(TOOLKIT_USES_GTK) |
| 53 #include "ui/gfx/gtk_util.h" | 50 #include "ui/gfx/gtk_util.h" |
| 54 #elif defined(OS_MACOSX) | 51 #elif defined(OS_MACOSX) |
| 55 #include "base/mac/scoped_nsautorelease_pool.h" | 52 #include "base/mac/scoped_nsautorelease_pool.h" |
| 56 #elif defined(OS_WIN) | 53 #elif defined(OS_WIN) |
| 57 // TODO(garykac) Make simple host into a proper GUI app on Windows so that we | 54 // TODO(garykac) Make simple host into a proper GUI app on Windows so that we |
| 58 // have an hModule for the dialog resource. | 55 // have an hModule for the dialog resource. |
| 59 HMODULE g_hModule = NULL; | 56 HMODULE g_hModule = NULL; |
| 60 #endif | 57 #endif |
| 61 | 58 |
| 62 using remoting::ChromotingHost; | 59 using remoting::ChromotingHost; |
| 63 using remoting::DesktopEnvironment; | 60 using remoting::DesktopEnvironment; |
| 64 using remoting::kChromotingTokenDefaultServiceName; | 61 using remoting::kChromotingTokenDefaultServiceName; |
| 65 using remoting::kXmppAuthServiceConfigPath; | 62 using remoting::kXmppAuthServiceConfigPath; |
| 63 using remoting::It2MeHostUserInterface; |
| 66 using remoting::protocol::CandidateSessionConfig; | 64 using remoting::protocol::CandidateSessionConfig; |
| 67 using remoting::protocol::ChannelConfig; | 65 using remoting::protocol::ChannelConfig; |
| 68 using std::string; | 66 using std::string; |
| 69 using std::wstring; | 67 using std::wstring; |
| 70 | 68 |
| 71 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
| 72 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json"; | 70 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json"; |
| 73 const wchar_t kHomeDrive[] = L"HOMEDRIVE"; | 71 const wchar_t kHomeDrive[] = L"HOMEDRIVE"; |
| 74 const wchar_t kHomePath[] = L"HOMEPATH"; | 72 const wchar_t kHomePath[] = L"HOMEPATH"; |
| 75 // TODO(sergeyu): Use environment utils from base/environment.h. | 73 // TODO(sergeyu): Use environment utils from base/environment.h. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 context.network_message_loop())); | 157 context.network_message_loop())); |
| 160 | 158 |
| 161 // Construct a chromoting host. | 159 // Construct a chromoting host. |
| 162 scoped_ptr<DesktopEnvironment> desktop_environment; | 160 scoped_ptr<DesktopEnvironment> desktop_environment; |
| 163 if (fake_) { | 161 if (fake_) { |
| 164 remoting::Capturer* capturer = | 162 remoting::Capturer* capturer = |
| 165 new remoting::CapturerFake(); | 163 new remoting::CapturerFake(); |
| 166 remoting::EventExecutor* event_executor = | 164 remoting::EventExecutor* event_executor = |
| 167 remoting::EventExecutor::Create(context.desktop_message_loop(), | 165 remoting::EventExecutor::Create(context.desktop_message_loop(), |
| 168 capturer); | 166 capturer); |
| 169 remoting::Curtain* curtain = remoting::Curtain::Create(); | |
| 170 remoting::DisconnectWindow* disconnect_window = | |
| 171 remoting::DisconnectWindow::Create(); | |
| 172 remoting::ContinueWindow* continue_window = | |
| 173 remoting::ContinueWindow::Create(); | |
| 174 remoting::LocalInputMonitor* local_input_monitor = | |
| 175 remoting::LocalInputMonitor::Create(); | |
| 176 desktop_environment.reset( | 167 desktop_environment.reset( |
| 177 new DesktopEnvironment(&context, capturer, event_executor, curtain, | 168 new DesktopEnvironment(&context, capturer, event_executor)); |
| 178 disconnect_window, continue_window, | |
| 179 local_input_monitor)); | |
| 180 } else { | 169 } else { |
| 181 desktop_environment.reset(DesktopEnvironment::Create(&context)); | 170 desktop_environment.reset(DesktopEnvironment::Create(&context)); |
| 182 } | 171 } |
| 183 | 172 |
| 184 host_ = ChromotingHost::Create(&context, config, desktop_environment.get(), | 173 host_ = ChromotingHost::Create(&context, config, desktop_environment.get(), |
| 185 access_verifier.release(), false); | 174 access_verifier.release(), false); |
| 186 host_->set_it2me(is_it2me_); | 175 host_->set_it2me(is_it2me_); |
| 187 | 176 |
| 177 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface; |
| 178 if (is_it2me_) { |
| 179 it2me_host_user_interface.reset(new It2MeHostUserInterface(host_, |
| 180 &context)); |
| 181 it2me_host_user_interface->Init(); |
| 182 host_->AddStatusObserver(it2me_host_user_interface.get()); |
| 183 } |
| 184 |
| 188 if (protocol_config_.get()) { | 185 if (protocol_config_.get()) { |
| 189 host_->set_protocol_config(protocol_config_.release()); | 186 host_->set_protocol_config(protocol_config_.release()); |
| 190 } | 187 } |
| 191 | 188 |
| 192 if (is_it2me_) { | 189 if (is_it2me_) { |
| 193 host_->AddStatusObserver(register_request.get()); | 190 host_->AddStatusObserver(register_request.get()); |
| 194 } else { | 191 } else { |
| 195 // Initialize HeartbeatSender. | 192 // Initialize HeartbeatSender. |
| 196 heartbeat_sender.reset( | 193 heartbeat_sender.reset( |
| 197 new remoting::HeartbeatSender(context.network_message_loop(), | 194 new remoting::HeartbeatSender(context.network_message_loop(), |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 LOG(ERROR) << "Unknown video codec: " << video_codec; | 308 LOG(ERROR) << "Unknown video codec: " << video_codec; |
| 312 return 1; | 309 return 1; |
| 313 } | 310 } |
| 314 config->mutable_video_configs()->push_back(ChannelConfig( | 311 config->mutable_video_configs()->push_back(ChannelConfig( |
| 315 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 312 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
| 316 simple_host.set_protocol_config(config.release()); | 313 simple_host.set_protocol_config(config.release()); |
| 317 } | 314 } |
| 318 | 315 |
| 319 return simple_host.Run(); | 316 return simple_host.Run(); |
| 320 } | 317 } |
| OLD | NEW |