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 3 // found in the LICENSE file. 4 5 #include "remoting/host/win/session_desktop_environment.h" 6 7 #include "base/logging.h" 8 #include "base/single_thread_task_runner.h" 9 #include "remoting/host/audio_capturer.h" 10 #include "remoting/host/input_injector.h" 11 #include "remoting/host/screen_controls.h" 12 #include "remoting/host/win/session_input_injector.h" 13 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" 14 15 namespace remoting { 16 17 SessionDesktopEnvironment::~SessionDesktopEnvironment() { 18 } 19 20 scoped_ptr<InputInjector> SessionDesktopEnvironment::CreateInputInjector() { 21 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 22 23 scoped_ptr<InputInjector> input_injector = InputInjector::Create( 24 input_task_runner(), ui_task_runner()); 25 input_injector.reset(new SessionInputInjectorWin(input_task_runner(), 26 input_injector.Pass(), 27 ui_task_runner(), 28 inject_sas_)); 29 return input_injector.Pass(); 30 } 31 32 SessionDesktopEnvironment::SessionDesktopEnvironment( 33 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 34 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 35 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 36 const base::Closure& inject_sas) 37 : Me2MeDesktopEnvironment(caller_task_runner, 38 input_task_runner, 39 ui_task_runner), 40 inject_sas_(inject_sas) { 41 } 42 43 SessionDesktopEnvironmentFactory::SessionDesktopEnvironmentFactory( 44 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 45 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 46 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 47 const base::Closure& inject_sas) 48 : Me2MeDesktopEnvironmentFactory(caller_task_runner, 49 input_task_runner, 50 ui_task_runner), 51 inject_sas_(inject_sas) { 52 DCHECK(caller_task_runner->BelongsToCurrentThread()); 53 } 54 55 SessionDesktopEnvironmentFactory::~SessionDesktopEnvironmentFactory() { 56 } 57 58 scoped_ptr<DesktopEnvironment> SessionDesktopEnvironmentFactory::Create( 59 base::WeakPtr<ClientSessionControl> client_session_control) { 60 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 61 62 scoped_ptr<SessionDesktopEnvironment> desktop_environment( 63 new SessionDesktopEnvironment(caller_task_runner(), 64 input_task_runner(), 65 ui_task_runner(), 66 inject_sas_)); 67 if (!desktop_environment->InitializeSecurity(client_session_control, 68 curtain_enabled())) { 69 return scoped_ptr<DesktopEnvironment>(); 70 } 71 72 return desktop_environment.PassAs<DesktopEnvironment>(); 73 } 74 75 } // namespace remoting 76