OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/capturer.h" | 9 #include "remoting/host/capturer.h" |
10 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.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) |
| 15 #include "remoting/host/session_event_executor_win.h" |
| 16 #endif |
| 17 |
14 namespace remoting { | 18 namespace remoting { |
15 | 19 |
16 // static | 20 // static |
17 DesktopEnvironment* DesktopEnvironment::Create(ChromotingHostContext* context) { | 21 scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create( |
| 22 ChromotingHostContext* context) { |
18 scoped_ptr<Capturer> capturer(Capturer::Create()); | 23 scoped_ptr<Capturer> capturer(Capturer::Create()); |
19 scoped_ptr<EventExecutor> event_executor( | 24 scoped_ptr<protocol::InputStub> event_executor = |
20 EventExecutor::Create(context->desktop_message_loop(), capturer.get())); | 25 EventExecutor::Create(context->desktop_message_loop(), |
| 26 capturer.get()); |
21 | 27 |
22 if (capturer.get() == NULL || event_executor.get() == NULL) { | 28 if (capturer.get() == NULL || event_executor.get() == NULL) { |
23 LOG(ERROR) << "Unable to create DesktopEnvironment"; | 29 LOG(ERROR) << "Unable to create DesktopEnvironment"; |
24 return NULL; | 30 return scoped_ptr<DesktopEnvironment>(); |
25 } | 31 } |
26 | 32 |
27 return new DesktopEnvironment(context, | 33 #if defined(OS_WIN) |
28 capturer.release(), | 34 event_executor.reset(new SessionEventExecutorWin( |
29 event_executor.release()); | 35 context->desktop_message_loop(), |
| 36 context->io_message_loop(), |
| 37 event_executor.Pass())); |
| 38 #endif |
| 39 |
| 40 return scoped_ptr<DesktopEnvironment>( |
| 41 new DesktopEnvironment(context, |
| 42 capturer.Pass(), |
| 43 event_executor.Pass())); |
30 } | 44 } |
31 | 45 |
32 DesktopEnvironment::DesktopEnvironment(ChromotingHostContext* context, | 46 // static |
33 Capturer* capturer, | 47 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateFake( |
34 EventExecutor* event_executor) | 48 ChromotingHostContext* context, |
| 49 scoped_ptr<Capturer> capturer, |
| 50 scoped_ptr<protocol::InputStub> event_executor) { |
| 51 return scoped_ptr<DesktopEnvironment>( |
| 52 new DesktopEnvironment(context, |
| 53 capturer.Pass(), |
| 54 event_executor.Pass())); |
| 55 } |
| 56 |
| 57 DesktopEnvironment::DesktopEnvironment( |
| 58 ChromotingHostContext* context, |
| 59 scoped_ptr<Capturer> capturer, |
| 60 scoped_ptr<protocol::InputStub> event_executor) |
35 : host_(NULL), | 61 : host_(NULL), |
36 context_(context), | 62 context_(context), |
37 capturer_(capturer), | 63 capturer_(capturer.Pass()), |
38 event_executor_(event_executor) { | 64 event_executor_(event_executor.Pass()) { |
39 } | 65 } |
40 | 66 |
41 DesktopEnvironment::~DesktopEnvironment() { | 67 DesktopEnvironment::~DesktopEnvironment() { |
42 } | 68 } |
43 | 69 |
44 } // namespace remoting | 70 } // namespace remoting |
OLD | NEW |