| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "remoting/host/network_settings.h" | 43 #include "remoting/host/network_settings.h" |
| 44 #include "remoting/host/policy_hack/policy_watcher.h" | 44 #include "remoting/host/policy_hack/policy_watcher.h" |
| 45 #include "remoting/host/session_manager_factory.h" | 45 #include "remoting/host/session_manager_factory.h" |
| 46 #include "remoting/host/signaling_connector.h" | 46 #include "remoting/host/signaling_connector.h" |
| 47 #include "remoting/host/usage_stats_consent.h" | 47 #include "remoting/host/usage_stats_consent.h" |
| 48 #include "remoting/host/video_frame_capturer.h" | 48 #include "remoting/host/video_frame_capturer.h" |
| 49 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 49 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
| 50 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 50 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
| 51 | 51 |
| 52 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
| 53 #include "base/mac/scoped_cftyperef.h" |
| 53 #include "base/mac/scoped_nsautorelease_pool.h" | 54 #include "base/mac/scoped_nsautorelease_pool.h" |
| 54 #include "remoting/host/sighup_listener_mac.h" | 55 #include "remoting/host/sighup_listener_mac.h" |
| 55 #endif | 56 #endif |
| 56 // N.B. OS_WIN is defined by including src/base headers. | 57 // N.B. OS_WIN is defined by including src/base headers. |
| 57 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 58 #include <commctrl.h> | 59 #include <commctrl.h> |
| 59 #endif | 60 #endif |
| 60 #if defined(TOOLKIT_GTK) | 61 #if defined(TOOLKIT_GTK) |
| 61 #include "ui/gfx/gtk_util.h" | 62 #include "ui/gfx/gtk_util.h" |
| 62 #endif | 63 #endif |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 *key_pair_.private_key(), host_secret_hash_)); | 203 *key_pair_.private_key(), host_secret_hash_)); |
| 203 host_->SetAuthenticatorFactory(factory.Pass()); | 204 host_->SetAuthenticatorFactory(factory.Pass()); |
| 204 } | 205 } |
| 205 | 206 |
| 206 int Run() { | 207 int Run() { |
| 207 if (!LoadConfig()) { | 208 if (!LoadConfig()) { |
| 208 return kInvalidHostConfigurationExitCode; | 209 return kInvalidHostConfigurationExitCode; |
| 209 } | 210 } |
| 210 | 211 |
| 211 #if defined(OS_MACOSX) || defined(OS_WIN) | 212 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 212 host_user_interface_.reset(new HostUserInterface(context_.get())); | 213 bool want_user_interface = true; |
| 213 #endif | 214 |
| 215 #if defined(OS_MACOSX) |
| 216 // Don't try to display any UI on top of the system's login screen as this |
| 217 // is rejected by the Window Server on OS X 10.7.4, and prevents the |
| 218 // capturer from working (http://crbug.com/140984). |
| 219 base::mac::ScopedCFTypeRef<CFDictionaryRef> session( |
| 220 CGSessionCopyCurrentDictionary()); |
| 221 const void* logged_in = CFDictionaryGetValue(session, |
| 222 kCGSessionLoginDoneKey); |
| 223 if (logged_in != kCFBooleanTrue) { |
| 224 want_user_interface = false; |
| 225 } |
| 226 #endif // OS_MACOSX |
| 227 |
| 228 if (want_user_interface) { |
| 229 host_user_interface_.reset(new HostUserInterface(context_.get())); |
| 230 } |
| 231 #endif // OS_MACOSX || OS_WIN |
| 214 | 232 |
| 215 StartWatchingPolicy(); | 233 StartWatchingPolicy(); |
| 216 | 234 |
| 217 #if defined(OS_MACOSX) || defined(OS_WIN) | 235 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 218 context_->file_task_runner()->PostTask( | 236 context_->file_task_runner()->PostTask( |
| 219 FROM_HERE, | 237 FROM_HERE, |
| 220 base::Bind(&HostProcess::ListenForConfigChanges, | 238 base::Bind(&HostProcess::ListenForConfigChanges, |
| 221 base::Unretained(this))); | 239 base::Unretained(this))); |
| 222 #endif | 240 #endif |
| 223 message_loop_.Run(); | 241 message_loop_.Run(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 #endif | 452 #endif |
| 435 | 453 |
| 436 heartbeat_sender_.reset(new HeartbeatSender( | 454 heartbeat_sender_.reset(new HeartbeatSender( |
| 437 this, host_id_, signal_strategy_.get(), &key_pair_)); | 455 this, host_id_, signal_strategy_.get(), &key_pair_)); |
| 438 | 456 |
| 439 log_to_server_.reset( | 457 log_to_server_.reset( |
| 440 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); | 458 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); |
| 441 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); | 459 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); |
| 442 | 460 |
| 443 #if defined(OS_MACOSX) || defined(OS_WIN) | 461 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 444 host_user_interface_->Start( | 462 if (host_user_interface_.get()) { |
| 445 host_, base::Bind(&HostProcess::OnDisconnectRequested, | 463 host_user_interface_->Start( |
| 446 base::Unretained(this))); | 464 host_, base::Bind(&HostProcess::OnDisconnectRequested, |
| 465 base::Unretained(this))); |
| 466 } |
| 447 #endif | 467 #endif |
| 448 | 468 |
| 449 host_->Start(); | 469 host_->Start(); |
| 450 | 470 |
| 451 CreateAuthenticatorFactory(); | 471 CreateAuthenticatorFactory(); |
| 452 } | 472 } |
| 453 | 473 |
| 454 void OnAuthFailed() { | 474 void OnAuthFailed() { |
| 455 Shutdown(kInvalidOauthCredentialsExitCode); | 475 Shutdown(kInvalidOauthCredentialsExitCode); |
| 456 } | 476 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 user32.GetFunctionPointer("SetProcessDPIAware")); | 667 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 648 set_process_dpi_aware(); | 668 set_process_dpi_aware(); |
| 649 } | 669 } |
| 650 | 670 |
| 651 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 671 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 652 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 672 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 653 return main(0, NULL); | 673 return main(0, NULL); |
| 654 } | 674 } |
| 655 | 675 |
| 656 #endif // defined(OS_WIN) | 676 #endif // defined(OS_WIN) |
| OLD | NEW |