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 #include "remoting/host/desktop_session_win.h" | 5 #include "remoting/host/desktop_session_win.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <sddl.h> | 8 #include <sddl.h> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForConsole( | 365 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForConsole( |
366 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 366 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
367 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 367 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
368 DaemonProcess* daemon_process, | 368 DaemonProcess* daemon_process, |
369 int id, | 369 int id, |
370 const ScreenResolution& resolution) { | 370 const ScreenResolution& resolution) { |
371 scoped_ptr<ConsoleSession> session(new ConsoleSession( | 371 scoped_ptr<ConsoleSession> session(new ConsoleSession( |
372 caller_task_runner, io_task_runner, daemon_process, id, | 372 caller_task_runner, io_task_runner, daemon_process, id, |
373 HostService::GetInstance())); | 373 HostService::GetInstance())); |
374 | 374 |
375 return session.Pass(); | 375 return std::move(session); |
376 } | 376 } |
377 | 377 |
378 // static | 378 // static |
379 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForVirtualTerminal( | 379 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForVirtualTerminal( |
380 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 380 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
381 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 381 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
382 DaemonProcess* daemon_process, | 382 DaemonProcess* daemon_process, |
383 int id, | 383 int id, |
384 const ScreenResolution& resolution) { | 384 const ScreenResolution& resolution) { |
385 scoped_ptr<RdpSession> session(new RdpSession( | 385 scoped_ptr<RdpSession> session(new RdpSession( |
386 caller_task_runner, io_task_runner, daemon_process, id, | 386 caller_task_runner, io_task_runner, daemon_process, id, |
387 HostService::GetInstance())); | 387 HostService::GetInstance())); |
388 if (!session->Initialize(resolution)) | 388 if (!session->Initialize(resolution)) |
389 return nullptr; | 389 return nullptr; |
390 | 390 |
391 return session.Pass(); | 391 return std::move(session); |
392 } | 392 } |
393 | 393 |
394 DesktopSessionWin::DesktopSessionWin( | 394 DesktopSessionWin::DesktopSessionWin( |
395 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 395 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
396 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 396 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
397 DaemonProcess* daemon_process, | 397 DaemonProcess* daemon_process, |
398 int id, | 398 int id, |
399 WtsTerminalMonitor* monitor) | 399 WtsTerminalMonitor* monitor) |
400 : DesktopSession(daemon_process, id), | 400 : DesktopSession(daemon_process, id), |
401 caller_task_runner_(caller_task_runner), | 401 caller_task_runner_(caller_task_runner), |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 529 |
530 session_attach_timer_.Stop(); | 530 session_attach_timer_.Stop(); |
531 | 531 |
532 scoped_ptr<base::CommandLine> target(new base::CommandLine(desktop_binary)); | 532 scoped_ptr<base::CommandLine> target(new base::CommandLine(desktop_binary)); |
533 target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeDesktop); | 533 target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeDesktop); |
534 // Copy the command line switches enabling verbose logging. | 534 // Copy the command line switches enabling verbose logging. |
535 target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), | 535 target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), |
536 kCopiedSwitchNames, arraysize(kCopiedSwitchNames)); | 536 kCopiedSwitchNames, arraysize(kCopiedSwitchNames)); |
537 | 537 |
538 // Create a delegate capable of launching a process in a different session. | 538 // Create a delegate capable of launching a process in a different session. |
539 scoped_ptr<WtsSessionProcessDelegate> delegate( | 539 scoped_ptr<WtsSessionProcessDelegate> delegate(new WtsSessionProcessDelegate( |
540 new WtsSessionProcessDelegate(io_task_runner_, | 540 io_task_runner_, std::move(target), launch_elevated, |
541 target.Pass(), | 541 base::WideToUTF8(kDaemonIpcSecurityDescriptor))); |
542 launch_elevated, | |
543 base::WideToUTF8( | |
544 kDaemonIpcSecurityDescriptor))); | |
545 if (!delegate->Initialize(session_id)) { | 542 if (!delegate->Initialize(session_id)) { |
546 TerminateSession(); | 543 TerminateSession(); |
547 return; | 544 return; |
548 } | 545 } |
549 | 546 |
550 // Create a launcher for the desktop process, using the per-session delegate. | 547 // Create a launcher for the desktop process, using the per-session delegate. |
551 launcher_.reset(new WorkerProcessLauncher(delegate.Pass(), this)); | 548 launcher_.reset(new WorkerProcessLauncher(std::move(delegate), this)); |
552 } | 549 } |
553 | 550 |
554 void DesktopSessionWin::OnSessionDetached() { | 551 void DesktopSessionWin::OnSessionDetached() { |
555 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 552 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
556 | 553 |
557 launcher_.reset(); | 554 launcher_.reset(); |
558 | 555 |
559 if (monitoring_notifications_) { | 556 if (monitoring_notifications_) { |
560 ReportElapsedTime("detached"); | 557 ReportElapsedTime("detached"); |
561 | 558 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 exploded.hour, | 595 exploded.hour, |
599 exploded.minute, | 596 exploded.minute, |
600 exploded.second, | 597 exploded.second, |
601 exploded.millisecond, | 598 exploded.millisecond, |
602 passed.c_str()); | 599 passed.c_str()); |
603 | 600 |
604 last_timestamp_ = now; | 601 last_timestamp_ = now; |
605 } | 602 } |
606 | 603 |
607 } // namespace remoting | 604 } // namespace remoting |
OLD | NEW |