Compute can_use_lcd_text using property trees.
[chromium-blink-merge.git] / remoting / host / it2me_desktop_environment.cc
blob96c11ce96b315049679e3c499c4f005b9969c8bb
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
3 // found in the LICENSE file.
5 #include "remoting/host/it2me_desktop_environment.h"
7 #include "base/logging.h"
8 #include "base/single_thread_task_runner.h"
9 #include "remoting/host/client_session_control.h"
10 #include "remoting/host/host_window.h"
11 #include "remoting/host/host_window_proxy.h"
12 #include "remoting/host/local_input_monitor.h"
14 #if defined(OS_POSIX)
15 #include <sys/types.h>
16 #include <unistd.h>
17 #endif // defined(OS_POSIX)
19 namespace remoting {
21 It2MeDesktopEnvironment::~It2MeDesktopEnvironment() {
22 DCHECK(caller_task_runner()->BelongsToCurrentThread());
25 It2MeDesktopEnvironment::It2MeDesktopEnvironment(
26 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
27 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
28 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
29 base::WeakPtr<ClientSessionControl> client_session_control,
30 bool supports_touch_events)
31 : BasicDesktopEnvironment(caller_task_runner,
32 input_task_runner,
33 ui_task_runner,
34 supports_touch_events) {
35 DCHECK(caller_task_runner->BelongsToCurrentThread());
37 // Create the local input monitor.
38 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner,
39 input_task_runner,
40 ui_task_runner,
41 client_session_control);
43 // The host UI should be created on the UI thread.
44 bool want_user_interface = true;
45 #if defined(OS_MACOSX)
46 // Don't try to display any UI on top of the system's login screen as this
47 // is rejected by the Window Server on OS X 10.7.4, and prevents the
48 // capturer from working (http://crbug.com/140984).
50 // TODO(lambroslambrou): Use a better technique of detecting whether we're
51 // running in the LoginWindow context, and refactor this into a separate
52 // function to be used here and in CurtainMode::ActivateCurtain().
53 want_user_interface = getuid() != 0;
54 #endif // defined(OS_MACOSX)
56 // Create the continue and disconnect windows.
57 if (want_user_interface) {
58 continue_window_ = HostWindow::CreateContinueWindow();
59 continue_window_.reset(new HostWindowProxy(
60 caller_task_runner,
61 ui_task_runner,
62 continue_window_.Pass()));
63 continue_window_->Start(client_session_control);
65 disconnect_window_ = HostWindow::CreateDisconnectWindow();
66 disconnect_window_.reset(new HostWindowProxy(
67 caller_task_runner,
68 ui_task_runner,
69 disconnect_window_.Pass()));
70 disconnect_window_->Start(client_session_control);
74 It2MeDesktopEnvironmentFactory::It2MeDesktopEnvironmentFactory(
75 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
76 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
77 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
78 : BasicDesktopEnvironmentFactory(caller_task_runner,
79 input_task_runner,
80 ui_task_runner) {
83 It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() {
86 scoped_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create(
87 base::WeakPtr<ClientSessionControl> client_session_control) {
88 DCHECK(caller_task_runner()->BelongsToCurrentThread());
90 return make_scoped_ptr(new It2MeDesktopEnvironment(caller_task_runner(),
91 input_task_runner(),
92 ui_task_runner(),
93 client_session_control,
94 supports_touch_events()));
97 } // namespace remoting