Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(923)

Side by Side Diff: ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <gestures/gestures.h> 8 #include <gestures/gestures.h>
8 #include <libevdev/libevdev.h> 9 #include <libevdev/libevdev.h>
9
10 #include <fnmatch.h>
11 #include <stdint.h> 10 #include <stdint.h>
12 #include <string.h> 11 #include <string.h>
12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
16 #include "base/files/file_enumerator.h" 16 #include "base/files/file_enumerator.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/ptr_util.h"
20 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_split.h" 22 #include "base/strings/string_split.h"
22 #include "base/strings/string_tokenizer.h" 23 #include "base/strings/string_tokenizer.h"
23 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
24 #include "base/strings/stringize_macros.h" 25 #include "base/strings/stringize_macros.h"
25 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
26 #include "ui/events/ozone/evdev/libgestures_glue/gesture_feedback.h" 27 #include "ui/events/ozone/evdev/libgestures_glue/gesture_feedback.h"
27 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr os.h" 28 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr os.h"
28 29
29 // GesturesProp implementation. 30 // GesturesProp implementation.
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 605 }
605 return os; 606 return os;
606 } 607 }
607 608
608 namespace ui { 609 namespace ui {
609 namespace internal { 610 namespace internal {
610 611
611 // Mapping table from a property name to its corresponding GesturesProp 612 // Mapping table from a property name to its corresponding GesturesProp
612 // object pointer. 613 // object pointer.
613 typedef base::hash_map<std::string, GesturesProp*> PropertiesMap; 614 typedef base::hash_map<std::string, GesturesProp*> PropertiesMap;
614 typedef base::ScopedPtrHashMap<std::string, scoped_ptr<GesturesProp>> 615 typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<GesturesProp>>
615 ScopedPropertiesMap; 616 ScopedPropertiesMap;
616 617
617 // Struct holding properties of a device. 618 // Struct holding properties of a device.
618 // 619 //
619 // Note that we can't define it in GesturePropertyProvider as a nested class 620 // Note that we can't define it in GesturePropertyProvider as a nested class
620 // because ScopedPtrHashMap will require us to expose the GestureProp's 621 // because ScopedPtrHashMap will require us to expose the GestureProp's
621 // destructor so that it can instantiate the object. This is something we 622 // destructor so that it can instantiate the object. This is something we
622 // don't want to do. 623 // don't want to do.
623 struct GestureDevicePropertyData { 624 struct GestureDevicePropertyData {
624 GestureDevicePropertyData() {} 625 GestureDevicePropertyData() {}
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 ~MatchIsTouchscreen() override {} 710 ~MatchIsTouchscreen() override {}
710 bool Match(const DevicePtr device) override; 711 bool Match(const DevicePtr device) override;
711 }; 712 };
712 713
713 // Struct for sections in xorg conf files. 714 // Struct for sections in xorg conf files.
714 struct ConfigurationSection { 715 struct ConfigurationSection {
715 typedef ui::GesturePropertyProvider::DevicePtr DevicePtr; 716 typedef ui::GesturePropertyProvider::DevicePtr DevicePtr;
716 ConfigurationSection() {} 717 ConfigurationSection() {}
717 bool Match(const DevicePtr device); 718 bool Match(const DevicePtr device);
718 std::string identifier; 719 std::string identifier;
719 std::vector<scoped_ptr<MatchCriteria>> criterias; 720 std::vector<std::unique_ptr<MatchCriteria>> criterias;
720 std::vector<scoped_ptr<GesturesProp>> properties; 721 std::vector<std::unique_ptr<GesturesProp>> properties;
721 }; 722 };
722 723
723 MatchCriteria::MatchCriteria(const std::string& arg) { 724 MatchCriteria::MatchCriteria(const std::string& arg) {
724 // TODO(sheckylin): Should we trim all tokens here? 725 // TODO(sheckylin): Should we trim all tokens here?
725 args_ = base::SplitString( 726 args_ = base::SplitString(
726 arg, "|", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 727 arg, "|", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
727 if (args_.empty()) { 728 if (args_.empty()) {
728 LOG(ERROR) << "Empty match pattern found, will evaluate to the default " 729 LOG(ERROR) << "Empty match pattern found, will evaluate to the default "
729 "value (true): \"" << arg << "\""; 730 "value (true): \"" << arg << "\"";
730 } 731 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 } 926 }
926 927
927 void GesturePropertyProvider::RegisterDevice(const DeviceId id, 928 void GesturePropertyProvider::RegisterDevice(const DeviceId id,
928 const DevicePtr device) { 929 const DevicePtr device) {
929 DeviceMap::const_iterator it = device_map_.find(id); 930 DeviceMap::const_iterator it = device_map_.find(id);
930 if (it != device_map_.end()) 931 if (it != device_map_.end())
931 return; 932 return;
932 933
933 // Setup data-structures. 934 // Setup data-structures.
934 device_map_[id] = device; 935 device_map_[id] = device;
935 device_data_map_.set(id, 936 device_data_map_.set(id, std::unique_ptr<internal::GestureDevicePropertyData>(
936 scoped_ptr<internal::GestureDevicePropertyData>( 937 new internal::GestureDevicePropertyData));
937 new internal::GestureDevicePropertyData));
938 938
939 // Gather default property values for the device from the parsed conf files. 939 // Gather default property values for the device from the parsed conf files.
940 SetupDefaultProperties(id, device); 940 SetupDefaultProperties(id, device);
941 return; 941 return;
942 } 942 }
943 943
944 void GesturePropertyProvider::UnregisterDevice(const DeviceId id) { 944 void GesturePropertyProvider::UnregisterDevice(const DeviceId id) {
945 DeviceMap::const_iterator it = device_map_.find(id); 945 DeviceMap::const_iterator it = device_map_.find(id);
946 if (it == device_map_.end()) 946 if (it == device_map_.end())
947 return; 947 return;
948 device_data_map_.erase(id); 948 device_data_map_.erase(id);
949 device_map_.erase(it); 949 device_map_.erase(it);
950 } 950 }
951 951
952 void GesturePropertyProvider::AddProperty(const DeviceId device_id, 952 void GesturePropertyProvider::AddProperty(
953 const std::string& name, 953 const DeviceId device_id,
954 scoped_ptr<GesturesProp> property) { 954 const std::string& name,
955 std::unique_ptr<GesturesProp> property) {
955 // The look-up should never fail because ideally a property can only be 956 // The look-up should never fail because ideally a property can only be
956 // created with GesturesPropCreate* functions from the gesture lib side. 957 // created with GesturesPropCreate* functions from the gesture lib side.
957 // Therefore, we simply return on failure. 958 // Therefore, we simply return on failure.
958 internal::GestureDevicePropertyData* device_data = 959 internal::GestureDevicePropertyData* device_data =
959 device_data_map_.get(device_id); 960 device_data_map_.get(device_id);
960 if (device_data) 961 if (device_data)
961 device_data->properties.set(name, std::move(property)); 962 device_data->properties.set(name, std::move(property));
962 } 963 }
963 964
964 void GesturePropertyProvider::DeleteProperty(const DeviceId device_id, 965 void GesturePropertyProvider::DeleteProperty(const DeviceId device_id,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1034
1034 // Break the content into sections, lines and then pieces. 1035 // Break the content into sections, lines and then pieces.
1035 // Sections are delimited by the "EndSection" keyword. 1036 // Sections are delimited by the "EndSection" keyword.
1036 // Lines are delimited by "\n". 1037 // Lines are delimited by "\n".
1037 // Pieces are delimited by all white-spaces. 1038 // Pieces are delimited by all white-spaces.
1038 std::vector<std::string> sections; 1039 std::vector<std::string> sections;
1039 base::SplitStringUsingSubstr(content, "EndSection", &sections); 1040 base::SplitStringUsingSubstr(content, "EndSection", &sections);
1040 for (size_t i = 0; i < sections.size(); ++i) { 1041 for (size_t i = 0; i < sections.size(); ++i) {
1041 // Create a new configuration section. 1042 // Create a new configuration section.
1042 configurations_.push_back( 1043 configurations_.push_back(
1043 make_scoped_ptr(new internal::ConfigurationSection())); 1044 base::WrapUnique(new internal::ConfigurationSection()));
1044 internal::ConfigurationSection* config = configurations_.back().get(); 1045 internal::ConfigurationSection* config = configurations_.back().get();
1045 1046
1046 // Break the section into lines. 1047 // Break the section into lines.
1047 base::StringTokenizer lines(sections[i], "\n"); 1048 base::StringTokenizer lines(sections[i], "\n");
1048 bool is_input_class_section = true; 1049 bool is_input_class_section = true;
1049 bool has_checked_section_type = false; 1050 bool has_checked_section_type = false;
1050 while (is_input_class_section && lines.GetNext()) { 1051 while (is_input_class_section && lines.GetNext()) {
1051 // Parse the line w.r.t. the xorg-conf format. 1052 // Parse the line w.r.t. the xorg-conf format.
1052 std::string line(lines.token()); 1053 std::string line(lines.token());
1053 1054
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 DVLOG(2) << "Identifier: " << arg; 1107 DVLOG(2) << "Identifier: " << arg;
1107 config->identifier = arg; 1108 config->identifier = arg;
1108 next_is_identifier = false; 1109 next_is_identifier = false;
1109 break; 1110 break;
1110 } else if (next_is_option_name) { 1111 } else if (next_is_option_name) {
1111 // TODO(sheckylin): Support option "Ignore". 1112 // TODO(sheckylin): Support option "Ignore".
1112 option_name = arg; 1113 option_name = arg;
1113 next_is_option_value = true; 1114 next_is_option_value = true;
1114 next_is_option_name = false; 1115 next_is_option_name = false;
1115 } else if (next_is_option_value) { 1116 } else if (next_is_option_value) {
1116 scoped_ptr<GesturesProp> property = 1117 std::unique_ptr<GesturesProp> property =
1117 CreateDefaultProperty(option_name, arg); 1118 CreateDefaultProperty(option_name, arg);
1118 if (property) 1119 if (property)
1119 config->properties.push_back(std::move(property)); 1120 config->properties.push_back(std::move(property));
1120 next_is_option_value = false; 1121 next_is_option_value = false;
1121 break; 1122 break;
1122 } else if (next_is_match_criteria) { 1123 } else if (next_is_match_criteria) {
1123 // Skip all match types that are not supported. 1124 // Skip all match types that are not supported.
1124 if (IsMatchTypeSupported(match_type)) { 1125 if (IsMatchTypeSupported(match_type)) {
1125 scoped_ptr<internal::MatchCriteria> criteria = 1126 std::unique_ptr<internal::MatchCriteria> criteria =
1126 CreateMatchCriteria(match_type, arg); 1127 CreateMatchCriteria(match_type, arg);
1127 if (criteria) 1128 if (criteria)
1128 config->criterias.push_back(std::move(criteria)); 1129 config->criterias.push_back(std::move(criteria));
1129 } 1130 }
1130 next_is_match_criteria = false; 1131 next_is_match_criteria = false;
1131 break; 1132 break;
1132 } 1133 }
1133 } else { 1134 } else {
1134 // If the section type hasn't been decided yet, look for it. 1135 // If the section type hasn't been decided yet, look for it.
1135 // Otherwise, look for valid entries according to the spec. 1136 // Otherwise, look for valid entries according to the spec.
(...skipping 27 matching lines...) Expand all
1163 LOG(ERROR) << "Error parsing line: " << lines.token(); 1164 LOG(ERROR) << "Error parsing line: " << lines.token();
1164 has_error = true; 1165 has_error = true;
1165 } 1166 }
1166 break; 1167 break;
1167 } 1168 }
1168 } 1169 }
1169 1170
1170 // The value of a boolean option is skipped (default is true). 1171 // The value of a boolean option is skipped (default is true).
1171 if (!has_error && (next_is_option_value || next_is_match_criteria)) { 1172 if (!has_error && (next_is_option_value || next_is_match_criteria)) {
1172 if (next_is_option_value) { 1173 if (next_is_option_value) {
1173 scoped_ptr<GesturesProp> property = 1174 std::unique_ptr<GesturesProp> property =
1174 CreateDefaultProperty(option_name, "on"); 1175 CreateDefaultProperty(option_name, "on");
1175 if (property) 1176 if (property)
1176 config->properties.push_back(std::move(property)); 1177 config->properties.push_back(std::move(property));
1177 } else if (IsMatchTypeSupported(match_type) && 1178 } else if (IsMatchTypeSupported(match_type) &&
1178 IsMatchDeviceType(match_type)) { 1179 IsMatchDeviceType(match_type)) {
1179 scoped_ptr<internal::MatchCriteria> criteria = 1180 std::unique_ptr<internal::MatchCriteria> criteria =
1180 CreateMatchCriteria(match_type, "on"); 1181 CreateMatchCriteria(match_type, "on");
1181 if (criteria) 1182 if (criteria)
1182 config->criterias.push_back(std::move(criteria)); 1183 config->criterias.push_back(std::move(criteria));
1183 } 1184 }
1184 } 1185 }
1185 } 1186 }
1186 1187
1187 // Remove useless config sections. 1188 // Remove useless config sections.
1188 if (!is_input_class_section || 1189 if (!is_input_class_section ||
1189 (config->criterias.empty() && config->properties.empty())) { 1190 (config->criterias.empty() && config->properties.empty())) {
1190 configurations_.pop_back(); 1191 configurations_.pop_back();
1191 } 1192 }
1192 } 1193 }
1193 } 1194 }
1194 1195
1195 scoped_ptr<internal::MatchCriteria> 1196 std::unique_ptr<internal::MatchCriteria>
1196 GesturePropertyProvider::CreateMatchCriteria(const std::string& match_type, 1197 GesturePropertyProvider::CreateMatchCriteria(const std::string& match_type,
1197 const std::string& arg) { 1198 const std::string& arg) {
1198 DVLOG(2) << "Creating match criteria: (" << match_type << ", " << arg << ")"; 1199 DVLOG(2) << "Creating match criteria: (" << match_type << ", " << arg << ")";
1199 if (match_type == "MatchProduct") 1200 if (match_type == "MatchProduct")
1200 return make_scoped_ptr(new internal::MatchProduct(arg)); 1201 return base::WrapUnique(new internal::MatchProduct(arg));
1201 if (match_type == "MatchDevicePath") 1202 if (match_type == "MatchDevicePath")
1202 return make_scoped_ptr(new internal::MatchDevicePath(arg)); 1203 return base::WrapUnique(new internal::MatchDevicePath(arg));
1203 if (match_type == "MatchUSBID") 1204 if (match_type == "MatchUSBID")
1204 return make_scoped_ptr(new internal::MatchUSBID(arg)); 1205 return base::WrapUnique(new internal::MatchUSBID(arg));
1205 if (match_type == "MatchIsPointer") 1206 if (match_type == "MatchIsPointer")
1206 return make_scoped_ptr(new internal::MatchIsPointer(arg)); 1207 return base::WrapUnique(new internal::MatchIsPointer(arg));
1207 if (match_type == "MatchIsTouchpad") 1208 if (match_type == "MatchIsTouchpad")
1208 return make_scoped_ptr(new internal::MatchIsTouchpad(arg)); 1209 return base::WrapUnique(new internal::MatchIsTouchpad(arg));
1209 if (match_type == "MatchIsTouchscreen") 1210 if (match_type == "MatchIsTouchscreen")
1210 return make_scoped_ptr(new internal::MatchIsTouchscreen(arg)); 1211 return base::WrapUnique(new internal::MatchIsTouchscreen(arg));
1211 NOTREACHED(); 1212 NOTREACHED();
1212 return NULL; 1213 return NULL;
1213 } 1214 }
1214 1215
1215 scoped_ptr<GesturesProp> GesturePropertyProvider::CreateDefaultProperty( 1216 std::unique_ptr<GesturesProp> GesturePropertyProvider::CreateDefaultProperty(
1216 const std::string& name, 1217 const std::string& name,
1217 const std::string& value) { 1218 const std::string& value) {
1218 // Our parsing rule: 1219 // Our parsing rule:
1219 // 1. No hex or oct number is accepted. 1220 // 1. No hex or oct number is accepted.
1220 // 2. All numbers will be stored as double. 1221 // 2. All numbers will be stored as double.
1221 // 3. Array elements can be separated by both white-spaces or commas. 1222 // 3. Array elements can be separated by both white-spaces or commas.
1222 // 4. A token is treated as numeric either if it is one of the special 1223 // 4. A token is treated as numeric either if it is one of the special
1223 // keywords for boolean values (on, true, yes, off, false, no) or if 1224 // keywords for boolean values (on, true, yes, off, false, no) or if
1224 // base::StringToDouble succeeds. 1225 // base::StringToDouble succeeds.
1225 // 5. The property is treated as numeric if and only if all of its elements 1226 // 5. The property is treated as numeric if and only if all of its elements
(...skipping 25 matching lines...) Expand all
1251 bool success = base::StringToDouble(token, &real_result); 1252 bool success = base::StringToDouble(token, &real_result);
1252 if (!success) { 1253 if (!success) {
1253 is_all_numeric = false; 1254 is_all_numeric = false;
1254 break; 1255 break;
1255 } 1256 }
1256 numbers.push_back(real_result); 1257 numbers.push_back(real_result);
1257 } 1258 }
1258 1259
1259 // Create the GesturesProp. Array properties need to contain at least one 1260 // Create the GesturesProp. Array properties need to contain at least one
1260 // number and may contain numbers only. 1261 // number and may contain numbers only.
1261 scoped_ptr<GesturesProp> property; 1262 std::unique_ptr<GesturesProp> property;
1262 if (is_all_numeric && numbers.size()) { 1263 if (is_all_numeric && numbers.size()) {
1263 property.reset(new GesturesDoubleProp(name, numbers.size(), NULL, 1264 property.reset(new GesturesDoubleProp(name, numbers.size(), NULL,
1264 numbers.data(), NULL)); 1265 numbers.data(), NULL));
1265 } else { 1266 } else {
1266 property.reset(new GesturesStringProp(name, NULL, value.c_str(), NULL)); 1267 property.reset(new GesturesStringProp(name, NULL, value.c_str(), NULL));
1267 } 1268 }
1268 1269
1269 DVLOG(2) << "Prop: " << *property; 1270 DVLOG(2) << "Prop: " << *property;
1270 // The function will always succeed for now but it may change later if we 1271 // The function will always succeed for now but it may change later if we
1271 // specify some name or args as invalid. 1272 // specify some name or args as invalid.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 1333
1333 GesturesProp* GesturesPropFunctionsWrapper::CreateString(void* device_data, 1334 GesturesProp* GesturesPropFunctionsWrapper::CreateString(void* device_data,
1334 const char* name, 1335 const char* name,
1335 const char** value, 1336 const char** value,
1336 const char* init) { 1337 const char* init) {
1337 GesturesProp* default_property = NULL; 1338 GesturesProp* default_property = NULL;
1338 if (!PreCreateProperty(device_data, name, &default_property)) 1339 if (!PreCreateProperty(device_data, name, &default_property))
1339 return NULL; 1340 return NULL;
1340 GesturesProp* property = 1341 GesturesProp* property =
1341 new GesturesStringProp(name, value, init, default_property); 1342 new GesturesStringProp(name, value, init, default_property);
1342 PostCreateProperty(device_data, name, make_scoped_ptr(property)); 1343 PostCreateProperty(device_data, name, base::WrapUnique(property));
1343 return property; 1344 return property;
1344 } 1345 }
1345 1346
1346 void GesturesPropFunctionsWrapper::RegisterHandlers( 1347 void GesturesPropFunctionsWrapper::RegisterHandlers(
1347 void* device_data, 1348 void* device_data,
1348 GesturesProp* property, 1349 GesturesProp* property,
1349 void* handler_data, 1350 void* handler_data,
1350 GesturesPropGetHandler get, 1351 GesturesPropGetHandler get,
1351 GesturesPropSetHandler set) { 1352 GesturesPropSetHandler set) {
1352 // Sanity checks 1353 // Sanity checks
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 size_t count, 1455 size_t count,
1455 const T* init) { 1456 const T* init) {
1456 // Create the property. Use the default property value if possible. 1457 // Create the property. Use the default property value if possible.
1457 GesturesProp* default_property = NULL; 1458 GesturesProp* default_property = NULL;
1458 if (!PreCreateProperty(device_data, name, &default_property)) 1459 if (!PreCreateProperty(device_data, name, &default_property))
1459 return NULL; 1460 return NULL;
1460 GesturesProp* property = 1461 GesturesProp* property =
1461 new PROPTYPE(name, count, value, init, default_property); 1462 new PROPTYPE(name, count, value, init, default_property);
1462 1463
1463 // Start tracking the property in the provider. 1464 // Start tracking the property in the provider.
1464 PostCreateProperty(device_data, name, make_scoped_ptr(property)); 1465 PostCreateProperty(device_data, name, base::WrapUnique(property));
1465 return property; 1466 return property;
1466 } 1467 }
1467 1468
1468 bool GesturesPropFunctionsWrapper::PreCreateProperty( 1469 bool GesturesPropFunctionsWrapper::PreCreateProperty(
1469 void* device_data, 1470 void* device_data,
1470 const char* name, 1471 const char* name,
1471 GesturesProp** default_property) { 1472 GesturesProp** default_property) {
1472 GesturePropertyProvider* provider = GetPropertyProvider(device_data); 1473 GesturePropertyProvider* provider = GetPropertyProvider(device_data);
1473 GesturePropertyProvider::DeviceId device_id = GetDeviceId(device_data); 1474 GesturePropertyProvider::DeviceId device_id = GetDeviceId(device_data);
1474 1475
(...skipping 14 matching lines...) Expand all
1489 } 1490 }
1490 1491
1491 // Return the found default property from conf files (could be NULL). 1492 // Return the found default property from conf files (could be NULL).
1492 *default_property = provider->GetDefaultProperty(device_id, name); 1493 *default_property = provider->GetDefaultProperty(device_id, name);
1493 return true; 1494 return true;
1494 } 1495 }
1495 1496
1496 void GesturesPropFunctionsWrapper::PostCreateProperty( 1497 void GesturesPropFunctionsWrapper::PostCreateProperty(
1497 void* device_data, 1498 void* device_data,
1498 const char* name, 1499 const char* name,
1499 scoped_ptr<GesturesProp> property) { 1500 std::unique_ptr<GesturesProp> property) {
1500 // Log the creation. 1501 // Log the creation.
1501 DVLOG(3) << "Created active prop: " << *property; 1502 DVLOG(3) << "Created active prop: " << *property;
1502 1503
1503 // Add the property to the gesture property provider. The gesture property 1504 // Add the property to the gesture property provider. The gesture property
1504 // provider will own it from now on. 1505 // provider will own it from now on.
1505 GesturePropertyProvider* provider = GetPropertyProvider(device_data); 1506 GesturePropertyProvider* provider = GetPropertyProvider(device_data);
1506 provider->AddProperty(GetDeviceId(device_data), name, std::move(property)); 1507 provider->AddProperty(GetDeviceId(device_data), name, std::move(property));
1507 } 1508 }
1508 1509
1509 GesturesProp* GesturesPropFunctionsWrapper::CreateIntSingle(void* device_data, 1510 GesturesProp* GesturesPropFunctionsWrapper::CreateIntSingle(void* device_data,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 const GesturesPropProvider kGesturePropProvider = { 1546 const GesturesPropProvider kGesturePropProvider = {
1546 GesturesPropFunctionsWrapper::CreateInt, 1547 GesturesPropFunctionsWrapper::CreateInt,
1547 GesturesPropFunctionsWrapper::CreateShort, 1548 GesturesPropFunctionsWrapper::CreateShort,
1548 GesturesPropFunctionsWrapper::CreateBool, 1549 GesturesPropFunctionsWrapper::CreateBool,
1549 GesturesPropFunctionsWrapper::CreateString, 1550 GesturesPropFunctionsWrapper::CreateString,
1550 GesturesPropFunctionsWrapper::CreateReal, 1551 GesturesPropFunctionsWrapper::CreateReal,
1551 GesturesPropFunctionsWrapper::RegisterHandlers, 1552 GesturesPropFunctionsWrapper::RegisterHandlers,
1552 GesturesPropFunctionsWrapper::Free}; 1553 GesturesPropFunctionsWrapper::Free};
1553 1554
1554 } // namespace ui 1555 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698