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/curtain_mode.h" | 5 #include "remoting/host/curtain_mode.h" |
6 | 6 |
7 #include <X11/extensions/XInput.h> | 7 #include <X11/extensions/XInput.h> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 "X server"; | 40 "X server"; |
41 } | 41 } |
42 | 42 |
43 return activated; | 43 return activated; |
44 } | 44 } |
45 | 45 |
46 bool CurtainModeLinux::IsXvfbSession() { | 46 bool CurtainModeLinux::IsXvfbSession() { |
47 // Try to identify an Xvfb session. There's no way to query what X server we | 47 // Try to identify an Xvfb session. There's no way to query what X server we |
48 // are running under, so we check for the Xvfb input devices. | 48 // are running under, so we check for the Xvfb input devices. |
49 // TODO(rmsousa): Find a similar way to determine that the *output* is secure. | 49 // TODO(rmsousa): Find a similar way to determine that the *output* is secure. |
50 Display* display = XOpenDisplay(NULL); | 50 Display* display = XOpenDisplay(nullptr); |
51 int opcode, event, error; | 51 int opcode, event, error; |
52 if (!XQueryExtension(display, "XInputExtension", &opcode, &event, &error)) { | 52 if (!XQueryExtension(display, "XInputExtension", &opcode, &event, &error)) { |
53 // If XInput is not available, assume it is not an Xvfb session. | 53 // If XInput is not available, assume it is not an Xvfb session. |
54 LOG(ERROR) << "X Input extension not available: " << error; | 54 LOG(ERROR) << "X Input extension not available: " << error; |
55 XCloseDisplay(display); | 55 XCloseDisplay(display); |
56 return false; | 56 return false; |
57 } | 57 } |
58 int num_devices; | 58 int num_devices; |
59 XDeviceInfo* devices; | 59 XDeviceInfo* devices; |
60 bool found_xvfb_mouse = false; | 60 bool found_xvfb_mouse = false; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // static | 101 // static |
102 scoped_ptr<CurtainMode> CurtainMode::Create( | 102 scoped_ptr<CurtainMode> CurtainMode::Create( |
103 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 103 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
104 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 104 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
105 base::WeakPtr<ClientSessionControl> client_session_control) { | 105 base::WeakPtr<ClientSessionControl> client_session_control) { |
106 return make_scoped_ptr(new CurtainModeLinux()); | 106 return make_scoped_ptr(new CurtainModeLinux()); |
107 } | 107 } |
108 | 108 |
109 } // namespace remoting | 109 } // namespace remoting |
OLD | NEW |