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/ozone/evdev/libgestures_glue/gesture_property_provider.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" |
6 | 6 |
7 #include <gestures/gestures.h> | 7 #include <gestures/gestures.h> |
8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
9 | 9 |
10 #include <fnmatch.h> | 10 #include <fnmatch.h> |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 if (it == device_map_.end()) | 870 if (it == device_map_.end()) |
871 return false; | 871 return false; |
872 return IsDeviceOfType(it->second, type); | 872 return IsDeviceOfType(it->second, type); |
873 } | 873 } |
874 | 874 |
875 GesturesProp* GesturePropertyProvider::GetProperty(const DeviceId device_id, | 875 GesturesProp* GesturePropertyProvider::GetProperty(const DeviceId device_id, |
876 const std::string& name) { | 876 const std::string& name) { |
877 return FindProperty(device_id, name); | 877 return FindProperty(device_id, name); |
878 } | 878 } |
879 | 879 |
880 std::vector<std::string> GesturePropertyProvider::GetPropertyNamesById( | |
881 const DeviceId device_id) { | |
882 internal::GestureDevicePropertyData* device_data = | |
883 device_data_map_.get(device_id); | |
884 if (!device_data) | |
885 return std::vector<std::string>(); | |
886 | |
887 // Dump all property names of the device. | |
888 std::vector<std::string> names; | |
889 for (internal::ScopedPropertiesMap::const_iterator it = | |
890 device_data->properties.begin(); | |
891 it != device_data->properties.end(); ++it) | |
892 names.push_back(it->first); | |
893 return names; | |
894 } | |
895 | |
896 std::string GesturePropertyProvider::GetDeviceNameById( | |
897 const DeviceId device_id) { | |
898 DeviceMap::const_iterator it = device_map_.find(device_id); | |
899 if (it == device_map_.end()) | |
900 return std::string(); | |
901 return std::string(it->second->info.name); | |
902 } | |
903 | |
904 void GesturePropertyProvider::RegisterDevice(const DeviceId id, | 880 void GesturePropertyProvider::RegisterDevice(const DeviceId id, |
905 const DevicePtr device) { | 881 const DevicePtr device) { |
906 DeviceMap::const_iterator it = device_map_.find(id); | 882 DeviceMap::const_iterator it = device_map_.find(id); |
907 if (it != device_map_.end()) | 883 if (it != device_map_.end()) |
908 return; | 884 return; |
909 | 885 |
910 // Setup data-structures. | 886 // Setup data-structures. |
911 device_map_[id] = device; | 887 device_map_[id] = device; |
912 device_data_map_.set(id, | 888 device_data_map_.set(id, |
913 scoped_ptr<internal::GestureDevicePropertyData>( | 889 scoped_ptr<internal::GestureDevicePropertyData>( |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 const GesturesPropProvider kGesturePropProvider = { | 1500 const GesturesPropProvider kGesturePropProvider = { |
1525 GesturesPropFunctionsWrapper::CreateInt, | 1501 GesturesPropFunctionsWrapper::CreateInt, |
1526 GesturesPropFunctionsWrapper::CreateShort, | 1502 GesturesPropFunctionsWrapper::CreateShort, |
1527 GesturesPropFunctionsWrapper::CreateBool, | 1503 GesturesPropFunctionsWrapper::CreateBool, |
1528 GesturesPropFunctionsWrapper::CreateString, | 1504 GesturesPropFunctionsWrapper::CreateString, |
1529 GesturesPropFunctionsWrapper::CreateReal, | 1505 GesturesPropFunctionsWrapper::CreateReal, |
1530 GesturesPropFunctionsWrapper::RegisterHandlers, | 1506 GesturesPropFunctionsWrapper::RegisterHandlers, |
1531 GesturesPropFunctionsWrapper::Free}; | 1507 GesturesPropFunctionsWrapper::Free}; |
1532 | 1508 |
1533 } // namespace ui | 1509 } // namespace ui |
OLD | NEW |