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/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(USE_CHROMOTING_IPC) | 14 #if defined(USE_CHROMOTING_IPC) |
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<Capturer> capturer(Capturer::Create()); | 23 scoped_ptr<Capturer> capturer(Capturer::Create()); |
24 scoped_ptr<protocol::InputStub> event_executor = | 24 scoped_ptr<protocol::HostEventStub> event_executor = |
25 EventExecutor::Create(context->desktop_message_loop(), | 25 EventExecutor::Create(context->desktop_message_loop(), |
26 capturer.get()); | 26 capturer.get()); |
27 | 27 |
28 if (capturer.get() == NULL || event_executor.get() == NULL) { | 28 if (capturer.get() == NULL || event_executor.get() == NULL) { |
29 LOG(ERROR) << "Unable to create DesktopEnvironment"; | 29 LOG(ERROR) << "Unable to create DesktopEnvironment"; |
30 return scoped_ptr<DesktopEnvironment>(); | 30 return scoped_ptr<DesktopEnvironment>(); |
31 } | 31 } |
32 | 32 |
33 #if defined(USE_CHROMOTING_IPC) | 33 #if defined(USE_CHROMOTING_IPC) |
34 event_executor.reset(new SessionEventExecutorWin( | 34 event_executor.reset(new SessionEventExecutorWin( |
35 context->desktop_message_loop(), | 35 context->desktop_message_loop(), |
36 context->io_message_loop(), | 36 context->io_message_loop(), |
37 event_executor.Pass())); | 37 event_executor.Pass())); |
38 #endif | 38 #endif |
39 | 39 |
40 return scoped_ptr<DesktopEnvironment>( | 40 return scoped_ptr<DesktopEnvironment>( |
41 new DesktopEnvironment(context, | 41 new DesktopEnvironment(context, |
42 capturer.Pass(), | 42 capturer.Pass(), |
43 event_executor.Pass())); | 43 event_executor.Pass())); |
44 } | 44 } |
45 | 45 |
46 // static | 46 // static |
47 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateFake( | 47 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateFake( |
48 ChromotingHostContext* context, | 48 ChromotingHostContext* context, |
49 scoped_ptr<Capturer> capturer, | 49 scoped_ptr<Capturer> capturer, |
50 scoped_ptr<protocol::InputStub> event_executor) { | 50 scoped_ptr<protocol::HostEventStub> event_executor) { |
51 return scoped_ptr<DesktopEnvironment>( | 51 return scoped_ptr<DesktopEnvironment>( |
52 new DesktopEnvironment(context, | 52 new DesktopEnvironment(context, |
53 capturer.Pass(), | 53 capturer.Pass(), |
54 event_executor.Pass())); | 54 event_executor.Pass())); |
55 } | 55 } |
56 | 56 |
57 DesktopEnvironment::DesktopEnvironment( | 57 DesktopEnvironment::DesktopEnvironment( |
58 ChromotingHostContext* context, | 58 ChromotingHostContext* context, |
59 scoped_ptr<Capturer> capturer, | 59 scoped_ptr<Capturer> capturer, |
60 scoped_ptr<protocol::InputStub> event_executor) | 60 scoped_ptr<protocol::HostEventStub> event_executor) |
61 : host_(NULL), | 61 : host_(NULL), |
62 context_(context), | 62 context_(context), |
63 capturer_(capturer.Pass()), | 63 capturer_(capturer.Pass()), |
64 event_executor_(event_executor.Pass()) { | 64 event_executor_(event_executor.Pass()) { |
65 } | 65 } |
66 | 66 |
67 DesktopEnvironment::~DesktopEnvironment() { | 67 DesktopEnvironment::~DesktopEnvironment() { |
68 } | 68 } |
69 | 69 |
70 } // namespace remoting | 70 } // namespace remoting |
OLD | NEW |