| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 virtual bool OnMessageReceived(const IPC::Message& message) { | 242 virtual bool OnMessageReceived(const IPC::Message& message) { |
| 243 return false; | 243 return false; |
| 244 } | 244 } |
| 245 | 245 |
| 246 int Run() { | 246 int Run() { |
| 247 if (!LoadConfig()) { | 247 if (!LoadConfig()) { |
| 248 return kInvalidHostConfigurationExitCode; | 248 return kInvalidHostConfigurationExitCode; |
| 249 } | 249 } |
| 250 | 250 |
| 251 #if defined(OS_MACOSX) || defined(OS_WIN) | 251 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 252 host_user_interface_.reset(new HostUserInterface(context_.get())); | 252 bool want_user_interface = true; |
| 253 #endif | 253 |
| 254 #if defined(OS_MACOSX) |
| 255 // Don't try to display any UI on top of the system's login screen as this |
| 256 // is rejected by the Window Server on OS X 10.7.4, and prevents the |
| 257 // capturer from working (http://crbug.com/140984). |
| 258 base::mac::ScopedCFTypeRef<CFDictionaryRef> session( |
| 259 CGSessionCopyCurrentDictionary()); |
| 260 const void* logged_in = CFDictionaryGetValue(session, |
| 261 kCGSessionLoginDoneKey); |
| 262 if (logged_in != kCFBooleanTrue) { |
| 263 want_user_interface = false; |
| 264 } |
| 265 #endif // OS_MACOSX |
| 266 |
| 267 if (want_user_interface) { |
| 268 host_user_interface_.reset(new HostUserInterface(context_.get())); |
| 269 } |
| 270 #endif // OS_MACOSX || OS_WIN |
| 254 | 271 |
| 255 StartWatchingPolicy(); | 272 StartWatchingPolicy(); |
| 256 | 273 |
| 257 #if defined(OS_MACOSX) || defined(OS_WIN) | 274 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 258 context_->file_task_runner()->PostTask( | 275 context_->file_task_runner()->PostTask( |
| 259 FROM_HERE, | 276 FROM_HERE, |
| 260 base::Bind(&HostProcess::ListenForConfigChanges, | 277 base::Bind(&HostProcess::ListenForConfigChanges, |
| 261 base::Unretained(this))); | 278 base::Unretained(this))); |
| 262 #endif | 279 #endif |
| 263 message_loop_.Run(); | 280 message_loop_.Run(); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 #endif | 530 #endif |
| 514 | 531 |
| 515 heartbeat_sender_.reset(new HeartbeatSender( | 532 heartbeat_sender_.reset(new HeartbeatSender( |
| 516 this, host_id_, signal_strategy_.get(), &key_pair_)); | 533 this, host_id_, signal_strategy_.get(), &key_pair_)); |
| 517 | 534 |
| 518 log_to_server_.reset( | 535 log_to_server_.reset( |
| 519 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); | 536 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); |
| 520 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); | 537 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); |
| 521 | 538 |
| 522 #if defined(OS_MACOSX) || defined(OS_WIN) | 539 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 523 host_user_interface_->Start( | 540 if (host_user_interface_.get()) { |
| 524 host_, base::Bind(&HostProcess::OnDisconnectRequested, | 541 host_user_interface_->Start( |
| 525 base::Unretained(this))); | 542 host_, base::Bind(&HostProcess::OnDisconnectRequested, |
| 543 base::Unretained(this))); |
| 544 } |
| 526 #endif | 545 #endif |
| 527 | 546 |
| 528 host_->Start(); | 547 host_->Start(); |
| 529 | 548 |
| 530 CreateAuthenticatorFactory(); | 549 CreateAuthenticatorFactory(); |
| 531 } | 550 } |
| 532 | 551 |
| 533 void OnAuthFailed() { | 552 void OnAuthFailed() { |
| 534 Shutdown(kInvalidOauthCredentialsExitCode); | 553 Shutdown(kInvalidOauthCredentialsExitCode); |
| 535 } | 554 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 user32.GetFunctionPointer("SetProcessDPIAware")); | 750 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 732 set_process_dpi_aware(); | 751 set_process_dpi_aware(); |
| 733 } | 752 } |
| 734 | 753 |
| 735 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 754 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 736 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 755 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 737 return main(0, NULL); | 756 return main(0, NULL); |
| 738 } | 757 } |
| 739 | 758 |
| 740 #endif // defined(OS_WIN) | 759 #endif // defined(OS_WIN) |
| OLD | NEW |