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_context.h" | 10 #include "remoting/host/chromoting_host_context.h" |
11 #include "remoting/host/event_executor.h" | 11 #include "remoting/host/event_executor.h" |
12 | 12 |
13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
14 #include "remoting/host/session_event_executor_win.h" | 14 #include "remoting/host/session_event_executor_win.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 // static | 19 // static |
20 scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create( | 20 scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create( |
21 ChromotingHostContext* context) { | 21 ChromotingHostContext* context) { |
22 scoped_ptr<Capturer> capturer(Capturer::Create()); | 22 scoped_ptr<Capturer> capturer(Capturer::Create()); |
23 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( | 23 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( |
24 context->desktop_message_loop()->message_loop_proxy(), | 24 context->desktop_task_runner(), context->ui_task_runner(), |
25 context->ui_message_loop(), capturer.get()); | 25 capturer.get()); |
26 | 26 |
27 if (capturer.get() == NULL || event_executor.get() == NULL) { | 27 if (capturer.get() == NULL || event_executor.get() == NULL) { |
28 LOG(ERROR) << "Unable to create DesktopEnvironment"; | 28 LOG(ERROR) << "Unable to create DesktopEnvironment"; |
29 return scoped_ptr<DesktopEnvironment>(); | 29 return scoped_ptr<DesktopEnvironment>(); |
30 } | 30 } |
31 | 31 |
32 return scoped_ptr<DesktopEnvironment>( | 32 return scoped_ptr<DesktopEnvironment>( |
33 new DesktopEnvironment(context, | 33 new DesktopEnvironment(context, |
34 capturer.Pass(), | 34 capturer.Pass(), |
35 event_executor.Pass())); | 35 event_executor.Pass())); |
36 } | 36 } |
37 | 37 |
38 // static | 38 // static |
39 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateForService( | 39 scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateForService( |
40 ChromotingHostContext* context) { | 40 ChromotingHostContext* context) { |
41 scoped_ptr<Capturer> capturer(Capturer::Create()); | 41 scoped_ptr<Capturer> capturer(Capturer::Create()); |
42 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( | 42 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( |
43 context->desktop_message_loop()->message_loop_proxy(), | 43 context->desktop_task_runner(), |
44 context->ui_message_loop(), capturer.get()); | 44 context->ui_task_runner(), capturer.get()); |
Wez
2012/06/19 03:47:08
nit: Re-wrap this similarly the the Create() versi
Sergey Ulanov
2012/06/19 18:16:09
Done.
| |
45 | 45 |
46 if (capturer.get() == NULL || event_executor.get() == NULL) { | 46 if (capturer.get() == NULL || event_executor.get() == NULL) { |
47 LOG(ERROR) << "Unable to create DesktopEnvironment"; | 47 LOG(ERROR) << "Unable to create DesktopEnvironment"; |
48 return scoped_ptr<DesktopEnvironment>(); | 48 return scoped_ptr<DesktopEnvironment>(); |
49 } | 49 } |
50 | 50 |
51 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
52 event_executor.reset(new SessionEventExecutorWin( | 52 event_executor.reset(new SessionEventExecutorWin( |
53 context->desktop_message_loop(), | 53 context->desktop_message_loop(), |
54 context->file_message_loop(), | 54 context->file_message_loop(), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 void DesktopEnvironment::OnSessionStarted( | 87 void DesktopEnvironment::OnSessionStarted( |
88 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 88 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
89 event_executor_->OnSessionStarted(client_clipboard.Pass()); | 89 event_executor_->OnSessionStarted(client_clipboard.Pass()); |
90 } | 90 } |
91 | 91 |
92 void DesktopEnvironment::OnSessionFinished() { | 92 void DesktopEnvironment::OnSessionFinished() { |
93 event_executor_->OnSessionFinished(); | 93 event_executor_->OnSessionFinished(); |
94 } | 94 } |
95 | 95 |
96 } // namespace remoting | 96 } // namespace remoting |
OLD | NEW |