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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 // IPC::Listener implementation. | 241 // IPC::Listener implementation. |
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_WIN) |
252 host_user_interface_.reset(new HostUserInterface(context_.get())); | 252 host_user_interface_.reset(new HostUserInterface(context_.get())); |
Jamie
2012/08/24 21:40:35
Can you refactor a little so that we don't need to
Lambros
2012/08/27 20:26:44
Done.
| |
253 #elif defined(OS_MACOSX) | |
254 // Don't try to display any UI on top of the system's login screen as this | |
255 // is rejected by the Window Server on OS X 10.7.4, and prevents the | |
256 // capturer from working (http://crbug.com/140984). | |
257 base::mac::ScopedCFTypeRef<CFDictionaryRef> session( | |
258 CGSessionCopyCurrentDictionary()); | |
259 const void* logged_in = CFDictionaryGetValue(session, | |
260 kCGSessionLoginDoneKey); | |
Jamie
2012/08/24 21:40:35
We now use this in a couple of places. Is it worth
Lambros
2012/08/27 20:26:44
We should move this into a separate utility class,
| |
261 if (logged_in == kCFBooleanTrue) { | |
262 host_user_interface_.reset(new HostUserInterface(context_.get())); | |
263 } | |
253 #endif | 264 #endif |
254 | 265 |
255 StartWatchingPolicy(); | 266 StartWatchingPolicy(); |
256 | 267 |
257 #if defined(OS_MACOSX) || defined(OS_WIN) | 268 #if defined(OS_MACOSX) || defined(OS_WIN) |
258 context_->file_task_runner()->PostTask( | 269 context_->file_task_runner()->PostTask( |
259 FROM_HERE, | 270 FROM_HERE, |
260 base::Bind(&HostProcess::ListenForConfigChanges, | 271 base::Bind(&HostProcess::ListenForConfigChanges, |
261 base::Unretained(this))); | 272 base::Unretained(this))); |
262 #endif | 273 #endif |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 523 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
513 #endif | 524 #endif |
514 | 525 |
515 heartbeat_sender_.reset(new HeartbeatSender( | 526 heartbeat_sender_.reset(new HeartbeatSender( |
516 this, host_id_, signal_strategy_.get(), &key_pair_)); | 527 this, host_id_, signal_strategy_.get(), &key_pair_)); |
517 | 528 |
518 log_to_server_.reset( | 529 log_to_server_.reset( |
519 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); | 530 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); |
520 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); | 531 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); |
521 | 532 |
522 #if defined(OS_MACOSX) || defined(OS_WIN) | 533 if (host_user_interface_.get()) { |
523 host_user_interface_->Start( | 534 host_user_interface_->Start( |
524 host_, base::Bind(&HostProcess::OnDisconnectRequested, | 535 host_, base::Bind(&HostProcess::OnDisconnectRequested, |
525 base::Unretained(this))); | 536 base::Unretained(this))); |
526 #endif | 537 } |
527 | 538 |
528 host_->Start(); | 539 host_->Start(); |
529 | 540 |
530 CreateAuthenticatorFactory(); | 541 CreateAuthenticatorFactory(); |
531 } | 542 } |
532 | 543 |
533 void OnAuthFailed() { | 544 void OnAuthFailed() { |
534 Shutdown(kInvalidOauthCredentialsExitCode); | 545 Shutdown(kInvalidOauthCredentialsExitCode); |
535 } | 546 } |
536 | 547 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
731 user32.GetFunctionPointer("SetProcessDPIAware")); | 742 user32.GetFunctionPointer("SetProcessDPIAware")); |
732 set_process_dpi_aware(); | 743 set_process_dpi_aware(); |
733 } | 744 } |
734 | 745 |
735 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 746 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
736 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 747 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
737 return main(0, NULL); | 748 return main(0, NULL); |
738 } | 749 } |
739 | 750 |
740 #endif // defined(OS_WIN) | 751 #endif // defined(OS_WIN) |
OLD | NEW |