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

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

Issue 2635983005: Add PropertyConverter support for non-zero default primitive values. (Closed)
Patch Set: 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') | ui/aura/mus/property_converter.cc » ('J')
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..1c02aad7fd97af25f397f4738c49bb5a2ab37ec0 100644
--- a/ui/aura/mus/property_converter.h
+++ b/ui/aura/mus/property_converter.h
@@ -70,8 +70,9 @@ 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);
+ primitive_properties_.insert(std::pair<const void*, PrimitiveProperty>(
+ property, PrimitiveProperty(property->name, transport_name,
+ property->default_value)));
}
// Specializations for properties to pointer types supporting mojo conversion.
@@ -87,11 +88,23 @@ 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 {
+ PrimitiveProperty(const char* property_name,
+ const char* transport_name,
+ const PrimitiveType default_value);
+
+ // The aura::WindowProperty::name used for storage.
+ const char* property_name;
+ // The mus property name used for transport.
+ const char* transport_name;
+ // The aura::WindowProperty::default_value stored using PrimitiveType.
+ PrimitiveType default_value;
+ };
+
+ // 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') | ui/aura/mus/property_converter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698