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_environment.h" | 5 #include "remoting/host/desktop_environment.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "remoting/host/audio_capturer.h" | 9 #include "remoting/host/audio_capturer.h" |
10 #include "remoting/host/video_frame_capturer.h" | 10 #include "remoting/host/video_frame_capturer.h" |
11 #include "remoting/host/chromoting_host_context.h" | 11 #include "remoting/host/chromoting_host_context.h" |
12 #include "remoting/host/event_executor.h" | 12 #include "remoting/host/event_executor.h" |
13 | 13 |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 #include "remoting/host/session_event_executor_win.h" | 15 #include "remoting/host/session_event_executor_win.h" |
16 #endif | 16 #endif |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 // static | 20 // static |
21 scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create( | 21 scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create( |
22 ChromotingHostContext* context) { | 22 ChromotingHostContext* context) { |
23 scoped_ptr<VideoFrameCapturer> capturer(VideoFrameCapturer::Create()); | 23 scoped_ptr<VideoFrameCapturer> capturer(VideoFrameCapturer::Create()); |
24 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( | 24 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( |
25 context->desktop_task_runner(), context->ui_task_runner(), | 25 context->desktop_task_runner(), context->ui_task_runner()); |
26 capturer.get()); | |
27 scoped_ptr<AudioCapturer> audio_capturer = AudioCapturer::Create(); | 26 scoped_ptr<AudioCapturer> audio_capturer = AudioCapturer::Create(); |
28 | 27 |
29 if (capturer.get() == NULL || event_executor.get() == NULL) { | 28 if (capturer.get() == NULL || event_executor.get() == NULL) { |
30 LOG(ERROR) << "Unable to create DesktopEnvironment"; | 29 LOG(ERROR) << "Unable to create DesktopEnvironment"; |
31 return scoped_ptr<DesktopEnvironment>(); | 30 return scoped_ptr<DesktopEnvironment>(); |
32 } | 31 } |
33 | 32 |
34 return scoped_ptr<DesktopEnvironment>( | 33 return scoped_ptr<DesktopEnvironment>( |
35 new DesktopEnvironment(context, | 34 new DesktopEnvironment(context, |
36 capturer.Pass(), | 35 capturer.Pass(), |
37 event_executor.Pass(), | 36 event_executor.Pass(), |
38 audio_capturer.Pass())); | 37 audio_capturer.Pass())); |
39 } | 38 } |
40 | 39 |
41 // static | 40 // static |
42 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateForService( | 41 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateForService( |
43 ChromotingHostContext* context) { | 42 ChromotingHostContext* context) { |
44 scoped_ptr<VideoFrameCapturer> capturer(VideoFrameCapturer::Create()); | 43 scoped_ptr<VideoFrameCapturer> capturer(VideoFrameCapturer::Create()); |
45 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( | 44 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( |
46 context->desktop_task_runner(), context->ui_task_runner(), | 45 context->desktop_task_runner(), context->ui_task_runner()); |
47 capturer.get()); | |
48 scoped_ptr<AudioCapturer> audio_capturer = AudioCapturer::Create(); | 46 scoped_ptr<AudioCapturer> audio_capturer = AudioCapturer::Create(); |
49 | 47 |
50 if (capturer.get() == NULL || event_executor.get() == NULL) { | 48 if (capturer.get() == NULL || event_executor.get() == NULL) { |
51 LOG(ERROR) << "Unable to create DesktopEnvironment"; | 49 LOG(ERROR) << "Unable to create DesktopEnvironment"; |
52 return scoped_ptr<DesktopEnvironment>(); | 50 return scoped_ptr<DesktopEnvironment>(); |
53 } | 51 } |
54 | 52 |
55 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
56 event_executor.reset(new SessionEventExecutorWin( | 54 event_executor.reset(new SessionEventExecutorWin( |
57 context->desktop_task_runner(), | 55 context->desktop_task_runner(), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void DesktopEnvironment::OnSessionStarted( | 94 void DesktopEnvironment::OnSessionStarted( |
97 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 95 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
98 event_executor_->OnSessionStarted(client_clipboard.Pass()); | 96 event_executor_->OnSessionStarted(client_clipboard.Pass()); |
99 } | 97 } |
100 | 98 |
101 void DesktopEnvironment::OnSessionFinished() { | 99 void DesktopEnvironment::OnSessionFinished() { |
102 event_executor_->OnSessionFinished(); | 100 event_executor_->OnSessionFinished(); |
103 } | 101 } |
104 | 102 |
105 } // namespace remoting | 103 } // namespace remoting |
OLD | NEW |