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