Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/devices/x11/device_data_manager_x11.h" | 5 #include "ui/events/devices/x11/device_data_manager_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/XInput.h> | 7 #include <X11/extensions/XInput.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/bind.h" | |
| 14 #include "base/bind_helpers.h" | |
| 13 #include "base/logging.h" | 15 #include "base/logging.h" |
| 14 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 15 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 16 #include "ui/events/devices/keyboard_device.h" | 18 #include "ui/events/devices/keyboard_device.h" |
| 17 #include "ui/events/devices/x11/device_list_cache_x11.h" | 19 #include "ui/events/devices/x11/device_list_cache_x11.h" |
| 18 #include "ui/events/devices/x11/touch_factory_x11.h" | 20 #include "ui/events/devices/x11/touch_factory_x11.h" |
| 19 #include "ui/events/event_constants.h" | 21 #include "ui/events/event_constants.h" |
| 20 #include "ui/events/event_switches.h" | 22 #include "ui/events/event_switches.h" |
| 21 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 23 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
| 22 #include "ui/gfx/display.h" | 24 #include "ui/gfx/display.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 | 125 |
| 124 bool DeviceDataManagerX11::IsTouchDataType(const int type) { | 126 bool DeviceDataManagerX11::IsTouchDataType(const int type) { |
| 125 return (type >= kTouchDataTypeStart) && (type <= kTouchDataTypeEnd); | 127 return (type >= kTouchDataTypeStart) && (type <= kTouchDataTypeEnd); |
| 126 } | 128 } |
| 127 | 129 |
| 128 // static | 130 // static |
| 129 void DeviceDataManagerX11::CreateInstance() { | 131 void DeviceDataManagerX11::CreateInstance() { |
| 130 if (instance()) | 132 if (instance()) |
| 131 return; | 133 return; |
| 132 | 134 |
| 133 new DeviceDataManagerX11(); | 135 DeviceDataManagerX11* device_data_manager = new DeviceDataManagerX11(); |
| 136 base::AtExitManager::RegisterTask( | |
| 137 base::Bind(&base::DeletePointer<DeviceDataManager>, device_data_manager)); | |
|
sadrul
2015/06/27 07:09:05
Can we avoid setting a callback here, and explicit
| |
| 138 | |
| 139 set_instance(device_data_manager); | |
| 134 } | 140 } |
| 135 | 141 |
| 136 // static | 142 // static |
| 137 DeviceDataManagerX11* DeviceDataManagerX11::GetInstance() { | 143 DeviceDataManagerX11* DeviceDataManagerX11::GetInstance() { |
| 138 return static_cast<DeviceDataManagerX11*>(DeviceDataManager::GetInstance()); | 144 return static_cast<DeviceDataManagerX11*>(DeviceDataManager::GetInstance()); |
| 139 } | 145 } |
| 140 | 146 |
| 141 DeviceDataManagerX11::DeviceDataManagerX11() | 147 DeviceDataManagerX11::DeviceDataManagerX11() |
| 142 : xi_opcode_(-1), | 148 : xi_opcode_(-1), |
| 143 atom_cache_(gfx::GetXDisplay(), kCachedAtoms), | 149 atom_cache_(gfx::GetXDisplay(), kCachedAtoms), |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 } else { | 776 } else { |
| 771 keyboards.erase(it); | 777 keyboards.erase(it); |
| 772 ++blocked_iter; | 778 ++blocked_iter; |
| 773 } | 779 } |
| 774 } | 780 } |
| 775 // Notify base class of updated list. | 781 // Notify base class of updated list. |
| 776 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 782 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
| 777 } | 783 } |
| 778 | 784 |
| 779 } // namespace ui | 785 } // namespace ui |
| OLD | NEW |