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/logging.h" | |
11 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "remoting/base/logging.h" |
12 #include "remoting/host/client_session_control.h" | 12 #include "remoting/host/client_session_control.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 | 15 |
16 class CurtainModeLinux : public CurtainMode { | 16 class CurtainModeLinux : public CurtainMode { |
17 public: | 17 public: |
18 CurtainModeLinux(); | 18 CurtainModeLinux(); |
19 | 19 |
20 // Overriden from CurtainMode. | 20 // Overriden from CurtainMode. |
21 virtual bool Activate() OVERRIDE; | 21 virtual bool Activate() OVERRIDE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 bool found_xvfb_keyboard = false; | 61 bool found_xvfb_keyboard = false; |
62 bool found_other_devices = false; | 62 bool found_other_devices = false; |
63 devices = XListInputDevices(display, &num_devices); | 63 devices = XListInputDevices(display, &num_devices); |
64 for (int i = 0; i < num_devices; i++) { | 64 for (int i = 0; i < num_devices; i++) { |
65 XDeviceInfo* device_info = &devices[i]; | 65 XDeviceInfo* device_info = &devices[i]; |
66 if (device_info->use == IsXExtensionPointer) { | 66 if (device_info->use == IsXExtensionPointer) { |
67 if (strcmp(device_info->name, "Xvfb mouse") == 0) { | 67 if (strcmp(device_info->name, "Xvfb mouse") == 0) { |
68 found_xvfb_mouse = true; | 68 found_xvfb_mouse = true; |
69 } else if (strcmp(device_info->name, "Virtual core XTEST pointer") != 0) { | 69 } else if (strcmp(device_info->name, "Virtual core XTEST pointer") != 0) { |
70 found_other_devices = true; | 70 found_other_devices = true; |
71 LOG(INFO) << "Non Xvfb mouse found: " << device_info->name; | 71 HOST_LOG << "Non Xvfb mouse found: " << device_info->name; |
72 } | 72 } |
73 } else if (device_info->use == IsXExtensionKeyboard) { | 73 } else if (device_info->use == IsXExtensionKeyboard) { |
74 if (strcmp(device_info->name, "Xvfb keyboard") == 0) { | 74 if (strcmp(device_info->name, "Xvfb keyboard") == 0) { |
75 found_xvfb_keyboard = true; | 75 found_xvfb_keyboard = true; |
76 } else if (strcmp(device_info->name, | 76 } else if (strcmp(device_info->name, |
77 "Virtual core XTEST keyboard") != 0) { | 77 "Virtual core XTEST keyboard") != 0) { |
78 found_other_devices = true; | 78 found_other_devices = true; |
79 LOG(INFO) << "Non Xvfb keyboard found: " << device_info->name; | 79 HOST_LOG << "Non Xvfb keyboard found: " << device_info->name; |
80 } | 80 } |
81 } else if (device_info->use == IsXPointer) { | 81 } else if (device_info->use == IsXPointer) { |
82 if (strcmp(device_info->name, "Virtual core pointer") != 0) { | 82 if (strcmp(device_info->name, "Virtual core pointer") != 0) { |
83 found_other_devices = true; | 83 found_other_devices = true; |
84 LOG(INFO) << "Non Xvfb mouse found: " << device_info->name; | 84 HOST_LOG << "Non Xvfb mouse found: " << device_info->name; |
85 } | 85 } |
86 } else if (device_info->use == IsXKeyboard) { | 86 } else if (device_info->use == IsXKeyboard) { |
87 if (strcmp(device_info->name, "Virtual core keyboard") != 0) { | 87 if (strcmp(device_info->name, "Virtual core keyboard") != 0) { |
88 found_other_devices = true; | 88 found_other_devices = true; |
89 LOG(INFO) << "Non Xvfb keyboard found: " << device_info->name; | 89 HOST_LOG << "Non Xvfb keyboard found: " << device_info->name; |
90 } | 90 } |
91 } else { | 91 } else { |
92 found_other_devices = true; | 92 found_other_devices = true; |
93 LOG(INFO) << "Non Xvfb device found: " << device_info->name; | 93 HOST_LOG << "Non Xvfb device found: " << device_info->name; |
94 } | 94 } |
95 } | 95 } |
96 XFreeDeviceList(devices); | 96 XFreeDeviceList(devices); |
97 XCloseDisplay(display); | 97 XCloseDisplay(display); |
98 return found_xvfb_mouse && found_xvfb_keyboard && !found_other_devices; | 98 return found_xvfb_mouse && found_xvfb_keyboard && !found_other_devices; |
99 } | 99 } |
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 scoped_ptr<CurtainMode>(new CurtainModeLinux()); | 106 return scoped_ptr<CurtainMode>(new CurtainModeLinux()); |
107 } | 107 } |
108 | 108 |
109 } // namespace remoting | 109 } // namespace remoting |
OLD | NEW |