OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/it2me_desktop_environment.h" | 5 #include "remoting/host/it2me_desktop_environment.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "remoting/host/client_session_control.h" | 9 #include "remoting/host/client_session_control.h" |
10 #include "remoting/host/host_window.h" | 10 #include "remoting/host/host_window.h" |
11 #include "remoting/host/host_window_proxy.h" | 11 #include "remoting/host/host_window_proxy.h" |
12 #include "remoting/host/local_input_monitor.h" | 12 #include "remoting/host/local_input_monitor.h" |
13 | 13 |
14 #if defined(OS_POSIX) | 14 #if defined(OS_POSIX) |
15 #include <sys/types.h> | 15 #include <sys/types.h> |
16 #include <unistd.h> | 16 #include <unistd.h> |
17 #endif // defined(OS_POSIX) | 17 #endif // defined(OS_POSIX) |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 It2MeDesktopEnvironment::~It2MeDesktopEnvironment() { | 21 It2MeDesktopEnvironment::~It2MeDesktopEnvironment() { |
22 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 22 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
23 } | 23 } |
24 | 24 |
25 It2MeDesktopEnvironment::It2MeDesktopEnvironment( | 25 It2MeDesktopEnvironment::It2MeDesktopEnvironment( |
26 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 26 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
27 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 27 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
28 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 28 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
29 base::WeakPtr<ClientSessionControl> client_session_control, | 29 base::WeakPtr<ClientSessionControl> client_session_control) |
30 const UiStrings& ui_strings) | |
31 : BasicDesktopEnvironment(caller_task_runner, | 30 : BasicDesktopEnvironment(caller_task_runner, |
32 input_task_runner, | 31 input_task_runner, |
33 ui_task_runner) { | 32 ui_task_runner) { |
34 DCHECK(caller_task_runner->BelongsToCurrentThread()); | 33 DCHECK(caller_task_runner->BelongsToCurrentThread()); |
35 | 34 |
36 // Create the local input monitor. | 35 // Create the local input monitor. |
37 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner, | 36 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner, |
38 input_task_runner, | 37 input_task_runner, |
39 ui_task_runner, | 38 ui_task_runner, |
40 client_session_control); | 39 client_session_control); |
41 | 40 |
42 // The host UI should be created on the UI thread. | 41 // The host UI should be created on the UI thread. |
43 bool want_user_interface = true; | 42 bool want_user_interface = true; |
44 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
45 // Don't try to display any UI on top of the system's login screen as this | 44 // Don't try to display any UI on top of the system's login screen as this |
46 // is rejected by the Window Server on OS X 10.7.4, and prevents the | 45 // is rejected by the Window Server on OS X 10.7.4, and prevents the |
47 // capturer from working (http://crbug.com/140984). | 46 // capturer from working (http://crbug.com/140984). |
48 | 47 |
49 // TODO(lambroslambrou): Use a better technique of detecting whether we're | 48 // TODO(lambroslambrou): Use a better technique of detecting whether we're |
50 // running in the LoginWindow context, and refactor this into a separate | 49 // running in the LoginWindow context, and refactor this into a separate |
51 // function to be used here and in CurtainMode::ActivateCurtain(). | 50 // function to be used here and in CurtainMode::ActivateCurtain(). |
52 want_user_interface = getuid() != 0; | 51 want_user_interface = getuid() != 0; |
53 #endif // defined(OS_MACOSX) | 52 #endif // defined(OS_MACOSX) |
54 | 53 |
55 // Create the continue and disconnect windows. | 54 // Create the continue and disconnect windows. |
56 if (want_user_interface) { | 55 if (want_user_interface) { |
57 continue_window_ = HostWindow::CreateContinueWindow(ui_strings); | 56 continue_window_ = HostWindow::CreateContinueWindow(); |
58 continue_window_.reset(new HostWindowProxy( | 57 continue_window_.reset(new HostWindowProxy( |
59 caller_task_runner, | 58 caller_task_runner, |
60 ui_task_runner, | 59 ui_task_runner, |
61 continue_window_.Pass())); | 60 continue_window_.Pass())); |
62 continue_window_->Start(client_session_control); | 61 continue_window_->Start(client_session_control); |
63 | 62 |
64 disconnect_window_ = HostWindow::CreateDisconnectWindow(ui_strings); | 63 disconnect_window_ = HostWindow::CreateDisconnectWindow(); |
65 disconnect_window_.reset(new HostWindowProxy( | 64 disconnect_window_.reset(new HostWindowProxy( |
66 caller_task_runner, | 65 caller_task_runner, |
67 ui_task_runner, | 66 ui_task_runner, |
68 disconnect_window_.Pass())); | 67 disconnect_window_.Pass())); |
69 disconnect_window_->Start(client_session_control); | 68 disconnect_window_->Start(client_session_control); |
70 } | 69 } |
71 } | 70 } |
72 | 71 |
73 It2MeDesktopEnvironmentFactory::It2MeDesktopEnvironmentFactory( | 72 It2MeDesktopEnvironmentFactory::It2MeDesktopEnvironmentFactory( |
74 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 73 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
75 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
76 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 75 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
77 const UiStrings& ui_strings) | |
78 : BasicDesktopEnvironmentFactory(caller_task_runner, | 76 : BasicDesktopEnvironmentFactory(caller_task_runner, |
79 input_task_runner, | 77 input_task_runner, |
80 ui_task_runner, | 78 ui_task_runner) { |
81 ui_strings) { | |
82 } | 79 } |
83 | 80 |
84 It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() { | 81 It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() { |
85 } | 82 } |
86 | 83 |
87 scoped_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create( | 84 scoped_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create( |
88 base::WeakPtr<ClientSessionControl> client_session_control) { | 85 base::WeakPtr<ClientSessionControl> client_session_control) { |
89 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 86 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
90 | 87 |
91 return scoped_ptr<DesktopEnvironment>( | 88 return scoped_ptr<DesktopEnvironment>( |
92 new It2MeDesktopEnvironment(caller_task_runner(), | 89 new It2MeDesktopEnvironment(caller_task_runner(), |
93 input_task_runner(), | 90 input_task_runner(), |
94 ui_task_runner(), | 91 ui_task_runner(), |
95 client_session_control, | 92 client_session_control)); |
96 ui_strings())); | |
97 } | 93 } |
98 | 94 |
99 } // namespace remoting | 95 } // namespace remoting |
OLD | NEW |