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 internal::ScopedPropertiesMap::const_iterator it = | |
achuithb
2015/01/22 20:42:12
Move this to the initializer of the for loop below
Shecky Lin
2015/01/23 07:46:46
Done.
| |
890 device_data->properties.begin(); | |
891 for (; 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 | |
880 void GesturePropertyProvider::RegisterDevice(const DeviceId id, | 904 void GesturePropertyProvider::RegisterDevice(const DeviceId id, |
881 const DevicePtr device) { | 905 const DevicePtr device) { |
882 DeviceMap::const_iterator it = device_map_.find(id); | 906 DeviceMap::const_iterator it = device_map_.find(id); |
883 if (it != device_map_.end()) | 907 if (it != device_map_.end()) |
884 return; | 908 return; |
885 | 909 |
886 // Setup data-structures. | 910 // Setup data-structures. |
887 device_map_[id] = device; | 911 device_map_[id] = device; |
888 device_data_map_.set(id, | 912 device_data_map_.set(id, |
889 scoped_ptr<internal::GestureDevicePropertyData>( | 913 scoped_ptr<internal::GestureDevicePropertyData>( |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1500 const GesturesPropProvider kGesturePropProvider = { | 1524 const GesturesPropProvider kGesturePropProvider = { |
1501 GesturesPropFunctionsWrapper::CreateInt, | 1525 GesturesPropFunctionsWrapper::CreateInt, |
1502 GesturesPropFunctionsWrapper::CreateShort, | 1526 GesturesPropFunctionsWrapper::CreateShort, |
1503 GesturesPropFunctionsWrapper::CreateBool, | 1527 GesturesPropFunctionsWrapper::CreateBool, |
1504 GesturesPropFunctionsWrapper::CreateString, | 1528 GesturesPropFunctionsWrapper::CreateString, |
1505 GesturesPropFunctionsWrapper::CreateReal, | 1529 GesturesPropFunctionsWrapper::CreateReal, |
1506 GesturesPropFunctionsWrapper::RegisterHandlers, | 1530 GesturesPropFunctionsWrapper::RegisterHandlers, |
1507 GesturesPropFunctionsWrapper::Free}; | 1531 GesturesPropFunctionsWrapper::Free}; |
1508 | 1532 |
1509 } // namespace ui | 1533 } // namespace ui |
OLD | NEW |