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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 return false; | 759 return false; |
760 } | 760 } |
761 | 761 |
762 MatchUSBID::MatchUSBID(const std::string& arg) : MatchCriteria(arg) { | 762 MatchUSBID::MatchUSBID(const std::string& arg) : MatchCriteria(arg) { |
763 // Check each pattern and split valid ones into vids and pids. | 763 // Check each pattern and split valid ones into vids and pids. |
764 for (size_t i = 0; i < args_.size(); ++i) { | 764 for (size_t i = 0; i < args_.size(); ++i) { |
765 if (!IsValidPattern(args_[i])) { | 765 if (!IsValidPattern(args_[i])) { |
766 LOG(ERROR) << "Invalid USB ID: " << args_[i]; | 766 LOG(ERROR) << "Invalid USB ID: " << args_[i]; |
767 continue; | 767 continue; |
768 } | 768 } |
769 std::vector<std::string> tokens; | 769 std::vector<std::string> tokens = base::SplitString( |
770 base::SplitString(args_[i], ':', &tokens); | 770 args_[i], ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
771 vid_patterns_.push_back(base::StringToLowerASCII(tokens[0])); | 771 vid_patterns_.push_back(base::StringToLowerASCII(tokens[0])); |
772 pid_patterns_.push_back(base::StringToLowerASCII(tokens[1])); | 772 pid_patterns_.push_back(base::StringToLowerASCII(tokens[1])); |
773 } | 773 } |
774 if (vid_patterns_.empty()) { | 774 if (vid_patterns_.empty()) { |
775 LOG(ERROR) << "No valid USB ID pattern found, will be ignored: \"" << arg | 775 LOG(ERROR) << "No valid USB ID pattern found, will be ignored: \"" << arg |
776 << "\""; | 776 << "\""; |
777 } | 777 } |
778 } | 778 } |
779 | 779 |
780 bool MatchUSBID::Match(const DevicePtr device) { | 780 bool MatchUSBID::Match(const DevicePtr device) { |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 const GesturesPropProvider kGesturePropProvider = { | 1542 const GesturesPropProvider kGesturePropProvider = { |
1543 GesturesPropFunctionsWrapper::CreateInt, | 1543 GesturesPropFunctionsWrapper::CreateInt, |
1544 GesturesPropFunctionsWrapper::CreateShort, | 1544 GesturesPropFunctionsWrapper::CreateShort, |
1545 GesturesPropFunctionsWrapper::CreateBool, | 1545 GesturesPropFunctionsWrapper::CreateBool, |
1546 GesturesPropFunctionsWrapper::CreateString, | 1546 GesturesPropFunctionsWrapper::CreateString, |
1547 GesturesPropFunctionsWrapper::CreateReal, | 1547 GesturesPropFunctionsWrapper::CreateReal, |
1548 GesturesPropFunctionsWrapper::RegisterHandlers, | 1548 GesturesPropFunctionsWrapper::RegisterHandlers, |
1549 GesturesPropFunctionsWrapper::Free}; | 1549 GesturesPropFunctionsWrapper::Free}; |
1550 | 1550 |
1551 } // namespace ui | 1551 } // namespace ui |
OLD | NEW |