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

Unified Diff: ui/aura/mus/property_converter.h

Issue 2635983005: Add PropertyConverter support for non-zero default primitive values. (Closed)
Patch Set: Revise PrimitiveProperty struct to try fixing Windows link. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/aura/mus/property_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/property_converter.h
diff --git a/ui/aura/mus/property_converter.h b/ui/aura/mus/property_converter.h
index 8a2c7697cd04523f5adae8acf49f97a655819802..68222213bb5df317bd33f64f5e146c263f66ab86 100644
--- a/ui/aura/mus/property_converter.h
+++ b/ui/aura/mus/property_converter.h
@@ -70,8 +70,11 @@ class AURA_EXPORT PropertyConverter {
template<typename T>
void RegisterProperty(const WindowProperty<T>* property,
const char* transport_name) {
- primitive_properties_[property] =
- PropertyNames(property->name, transport_name);
+ PrimitiveProperty primitive_property;
+ primitive_property.property_name = property->name;
+ primitive_property.transport_name = transport_name;
+ primitive_property.default_value = property->default_value;
+ primitive_properties_[property] = primitive_property;
}
// Specializations for properties to pointer types supporting mojo conversion.
@@ -87,11 +90,19 @@ class AURA_EXPORT PropertyConverter {
const char* transport_name);
private:
- // A pair with the aura::WindowProperty::name and the mus property name.
- using PropertyNames = std::pair<const char*, const char*>;
- // A map of aura::WindowProperty<T> to its aura and mus property names.
+ // Contains data needed to store and convert primitive-type properties.
+ struct PrimitiveProperty {
+ // The aura::WindowProperty::name used for storage.
+ const char* property_name = nullptr;
+ // The mus property name used for transport.
+ const char* transport_name = nullptr;
+ // The aura::WindowProperty::default_value stored using PrimitiveType.
+ PrimitiveType default_value = 0;
+ };
+
+ // A map of aura::WindowProperty<T> to PrimitiveProperty structs.
// This supports the internal codepaths for primitive types, eg. T=bool.
- std::map<const void*, PropertyNames> primitive_properties_;
+ std::map<const void*, PrimitiveProperty> primitive_properties_;
// Maps of aura::WindowProperty<T> to their mus property names.
// This supports types that can be serialized for Mojo, eg. T=std::string*.
« no previous file with comments | « no previous file | ui/aura/mus/property_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698