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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 scoped_ptr<Capturer> capturer(Capturer::Create()); | 23 scoped_ptr<Capturer> capturer(Capturer::Create()); |
24 scoped_ptr<protocol::HostEventStub> 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 return scoped_ptr<DesktopEnvironment>( |
| 34 new DesktopEnvironment(context, |
| 35 capturer.Pass(), |
| 36 event_executor.Pass())); |
| 37 } |
| 38 |
| 39 // static |
| 40 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateForService( |
| 41 ChromotingHostContext* context) { |
| 42 scoped_ptr<Capturer> capturer(Capturer::Create()); |
| 43 scoped_ptr<protocol::HostEventStub> event_executor = |
| 44 EventExecutor::Create(context->desktop_message_loop(), |
| 45 capturer.get()); |
| 46 |
| 47 if (capturer.get() == NULL || event_executor.get() == NULL) { |
| 48 LOG(ERROR) << "Unable to create DesktopEnvironment"; |
| 49 return scoped_ptr<DesktopEnvironment>(); |
| 50 } |
| 51 |
33 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
34 event_executor.reset(new SessionEventExecutorWin( | 53 event_executor.reset(new SessionEventExecutorWin( |
35 context->desktop_message_loop(), | 54 context->desktop_message_loop(), |
36 context->io_message_loop(), | 55 context->io_message_loop(), |
37 event_executor.Pass())); | 56 event_executor.Pass())); |
38 #endif | 57 #endif |
39 | 58 |
40 return scoped_ptr<DesktopEnvironment>( | 59 return scoped_ptr<DesktopEnvironment>( |
41 new DesktopEnvironment(context, | 60 new DesktopEnvironment(context, |
42 capturer.Pass(), | 61 capturer.Pass(), |
(...skipping 18 matching lines...) Expand all Loading... |
61 : host_(NULL), | 80 : host_(NULL), |
62 context_(context), | 81 context_(context), |
63 capturer_(capturer.Pass()), | 82 capturer_(capturer.Pass()), |
64 event_executor_(event_executor.Pass()) { | 83 event_executor_(event_executor.Pass()) { |
65 } | 84 } |
66 | 85 |
67 DesktopEnvironment::~DesktopEnvironment() { | 86 DesktopEnvironment::~DesktopEnvironment() { |
68 } | 87 } |
69 | 88 |
70 } // namespace remoting | 89 } // namespace remoting |
OLD | NEW |