| 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 <fnmatch.h> | 7 #include <fnmatch.h> |
| 8 #include <gestures/gestures.h> | 8 #include <gestures/gestures.h> |
| 9 #include <libevdev/libevdev.h> | 9 #include <libevdev/libevdev.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 | 1034 |
| 1035 // Break the content into sections, lines and then pieces. | 1035 // Break the content into sections, lines and then pieces. |
| 1036 // Sections are delimited by the "EndSection" keyword. | 1036 // Sections are delimited by the "EndSection" keyword. |
| 1037 // Lines are delimited by "\n". | 1037 // Lines are delimited by "\n". |
| 1038 // Pieces are delimited by all white-spaces. | 1038 // Pieces are delimited by all white-spaces. |
| 1039 std::vector<std::string> sections; | 1039 std::vector<std::string> sections; |
| 1040 base::SplitStringUsingSubstr(content, "EndSection", §ions); | 1040 base::SplitStringUsingSubstr(content, "EndSection", §ions); |
| 1041 for (size_t i = 0; i < sections.size(); ++i) { | 1041 for (size_t i = 0; i < sections.size(); ++i) { |
| 1042 // Create a new configuration section. | 1042 // Create a new configuration section. |
| 1043 configurations_.push_back( | 1043 configurations_.push_back( |
| 1044 base::WrapUnique(new internal::ConfigurationSection())); | 1044 base::MakeUnique<internal::ConfigurationSection>()); |
| 1045 internal::ConfigurationSection* config = configurations_.back().get(); | 1045 internal::ConfigurationSection* config = configurations_.back().get(); |
| 1046 | 1046 |
| 1047 // Break the section into lines. | 1047 // Break the section into lines. |
| 1048 base::StringTokenizer lines(sections[i], "\n"); | 1048 base::StringTokenizer lines(sections[i], "\n"); |
| 1049 bool is_input_class_section = true; | 1049 bool is_input_class_section = true; |
| 1050 bool has_checked_section_type = false; | 1050 bool has_checked_section_type = false; |
| 1051 while (is_input_class_section && lines.GetNext()) { | 1051 while (is_input_class_section && lines.GetNext()) { |
| 1052 // Parse the line w.r.t. the xorg-conf format. | 1052 // Parse the line w.r.t. the xorg-conf format. |
| 1053 std::string line(lines.token()); | 1053 std::string line(lines.token()); |
| 1054 | 1054 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 configurations_.pop_back(); | 1190 configurations_.pop_back(); |
| 1191 } | 1191 } |
| 1192 } | 1192 } |
| 1193 } | 1193 } |
| 1194 | 1194 |
| 1195 std::unique_ptr<internal::MatchCriteria> | 1195 std::unique_ptr<internal::MatchCriteria> |
| 1196 GesturePropertyProvider::CreateMatchCriteria(const std::string& match_type, | 1196 GesturePropertyProvider::CreateMatchCriteria(const std::string& match_type, |
| 1197 const std::string& arg) { | 1197 const std::string& arg) { |
| 1198 DVLOG(2) << "Creating match criteria: (" << match_type << ", " << arg << ")"; | 1198 DVLOG(2) << "Creating match criteria: (" << match_type << ", " << arg << ")"; |
| 1199 if (match_type == "MatchProduct") | 1199 if (match_type == "MatchProduct") |
| 1200 return base::WrapUnique(new internal::MatchProduct(arg)); | 1200 return base::MakeUnique<internal::MatchProduct>(arg); |
| 1201 if (match_type == "MatchDevicePath") | 1201 if (match_type == "MatchDevicePath") |
| 1202 return base::WrapUnique(new internal::MatchDevicePath(arg)); | 1202 return base::MakeUnique<internal::MatchDevicePath>(arg); |
| 1203 if (match_type == "MatchUSBID") | 1203 if (match_type == "MatchUSBID") |
| 1204 return base::WrapUnique(new internal::MatchUSBID(arg)); | 1204 return base::MakeUnique<internal::MatchUSBID>(arg); |
| 1205 if (match_type == "MatchIsPointer") | 1205 if (match_type == "MatchIsPointer") |
| 1206 return base::WrapUnique(new internal::MatchIsPointer(arg)); | 1206 return base::MakeUnique<internal::MatchIsPointer>(arg); |
| 1207 if (match_type == "MatchIsTouchpad") | 1207 if (match_type == "MatchIsTouchpad") |
| 1208 return base::WrapUnique(new internal::MatchIsTouchpad(arg)); | 1208 return base::MakeUnique<internal::MatchIsTouchpad>(arg); |
| 1209 if (match_type == "MatchIsTouchscreen") | 1209 if (match_type == "MatchIsTouchscreen") |
| 1210 return base::WrapUnique(new internal::MatchIsTouchscreen(arg)); | 1210 return base::MakeUnique<internal::MatchIsTouchscreen>(arg); |
| 1211 NOTREACHED(); | 1211 NOTREACHED(); |
| 1212 return NULL; | 1212 return NULL; |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 std::unique_ptr<GesturesProp> GesturePropertyProvider::CreateDefaultProperty( | 1215 std::unique_ptr<GesturesProp> GesturePropertyProvider::CreateDefaultProperty( |
| 1216 const std::string& name, | 1216 const std::string& name, |
| 1217 const std::string& value) { | 1217 const std::string& value) { |
| 1218 // Our parsing rule: | 1218 // Our parsing rule: |
| 1219 // 1. No hex or oct number is accepted. | 1219 // 1. No hex or oct number is accepted. |
| 1220 // 2. All numbers will be stored as double. | 1220 // 2. All numbers will be stored as double. |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 const GesturesPropProvider kGesturePropProvider = { | 1545 const GesturesPropProvider kGesturePropProvider = { |
| 1546 GesturesPropFunctionsWrapper::CreateInt, | 1546 GesturesPropFunctionsWrapper::CreateInt, |
| 1547 GesturesPropFunctionsWrapper::CreateShort, | 1547 GesturesPropFunctionsWrapper::CreateShort, |
| 1548 GesturesPropFunctionsWrapper::CreateBool, | 1548 GesturesPropFunctionsWrapper::CreateBool, |
| 1549 GesturesPropFunctionsWrapper::CreateString, | 1549 GesturesPropFunctionsWrapper::CreateString, |
| 1550 GesturesPropFunctionsWrapper::CreateReal, | 1550 GesturesPropFunctionsWrapper::CreateReal, |
| 1551 GesturesPropFunctionsWrapper::RegisterHandlers, | 1551 GesturesPropFunctionsWrapper::RegisterHandlers, |
| 1552 GesturesPropFunctionsWrapper::Free}; | 1552 GesturesPropFunctionsWrapper::Free}; |
| 1553 | 1553 |
| 1554 } // namespace ui | 1554 } // namespace ui |
| OLD | NEW |