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 |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 touch_devices.begin(), touch_devices.end(), touch_device_id); | 705 touch_devices.begin(), touch_devices.end(), touch_device_id); |
706 return it != touch_devices.end() && it->type == INPUT_DEVICE_INTERNAL; | 706 return it != touch_devices.end() && it->type == INPUT_DEVICE_INTERNAL; |
707 #endif // defined(OS_CHROMEOS) | 707 #endif // defined(OS_CHROMEOS) |
708 return false; | 708 return false; |
709 } | 709 } |
710 | 710 |
711 void DeviceDataManagerX11::SetDisabledKeyboardAllowedKeys( | 711 void DeviceDataManagerX11::SetDisabledKeyboardAllowedKeys( |
712 scoped_ptr<std::set<KeyboardCode> > excepted_keys) { | 712 scoped_ptr<std::set<KeyboardCode> > excepted_keys) { |
713 DCHECK(!excepted_keys.get() || | 713 DCHECK(!excepted_keys.get() || |
714 !blocked_keyboard_allowed_keys_.get()); | 714 !blocked_keyboard_allowed_keys_.get()); |
715 blocked_keyboard_allowed_keys_ = excepted_keys.Pass(); | 715 blocked_keyboard_allowed_keys_ = std::move(excepted_keys); |
716 } | 716 } |
717 | 717 |
718 void DeviceDataManagerX11::DisableDevice(int deviceid) { | 718 void DeviceDataManagerX11::DisableDevice(int deviceid) { |
719 blocked_devices_.set(deviceid, true); | 719 blocked_devices_.set(deviceid, true); |
720 // TODO(rsadam@): Support blocking touchscreen devices. | 720 // TODO(rsadam@): Support blocking touchscreen devices. |
721 std::vector<KeyboardDevice> keyboards = keyboard_devices(); | 721 std::vector<KeyboardDevice> keyboards = keyboard_devices(); |
722 std::vector<KeyboardDevice>::iterator it = | 722 std::vector<KeyboardDevice>::iterator it = |
723 FindDeviceWithId(keyboards.begin(), keyboards.end(), deviceid); | 723 FindDeviceWithId(keyboards.begin(), keyboards.end(), deviceid); |
724 if (it != std::end(keyboards)) { | 724 if (it != std::end(keyboards)) { |
725 blocked_keyboards_.insert( | 725 blocked_keyboards_.insert( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } else { | 784 } else { |
785 keyboards.erase(it); | 785 keyboards.erase(it); |
786 ++blocked_iter; | 786 ++blocked_iter; |
787 } | 787 } |
788 } | 788 } |
789 // Notify base class of updated list. | 789 // Notify base class of updated list. |
790 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); | 790 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); |
791 } | 791 } |
792 | 792 |
793 } // namespace ui | 793 } // namespace ui |
OLD | NEW |