Chromium Code Reviews| Index: ui/aura/mus/property_converter.h |
| diff --git a/ui/aura/mus/property_converter.h b/ui/aura/mus/property_converter.h |
| index 51c190be2becbde17470516bb644a07c0de23778..2df342e6dfdd10a20d6447f7fe14fa4a47f32e11 100644 |
| --- a/ui/aura/mus/property_converter.h |
| +++ b/ui/aura/mus/property_converter.h |
| @@ -18,6 +18,7 @@ |
| namespace gfx { |
| class Rect; |
| +class Size; |
| } |
| namespace aura { |
| @@ -29,9 +30,18 @@ namespace aura { |
| // Window properties. |
| class AURA_EXPORT PropertyConverter { |
| public: |
| + // All primitive values are represented as this |
|
msw
2016/11/29 01:15:45
nit: trailing period; optionally "are stored using
sky
2016/11/29 04:19:36
Done.
|
| + using PrimitiveType = int64_t; |
| + |
| PropertyConverter(); |
| ~PropertyConverter(); |
| + // Convenience for calling SetPropertyFromTransportValue() for all the entries |
| + // in |properties|. |
| + void ApplyAllTransportProperties( |
| + Window* window, |
| + const std::map<std::string, std::vector<uint8_t>>& properties); |
| + |
| // Maps a property on the Window to a property pushed to the server. Return |
| // true if the property should be sent to the server, false if the property |
| // is only used locally. |
| @@ -52,6 +62,15 @@ class AURA_EXPORT PropertyConverter { |
| const std::string& transport_name, |
| const std::vector<uint8_t>* transport_data); |
| + // Returns the value for a particular transport value. All primitives are |
| + // serialized as a PrimitiveType, so this function may be used for any |
| + // primitive. Returns true on success and sets |value| accordingly. A return |
| + // value of false indicates the value isn't known. |
|
msw
2016/11/29 01:15:45
"or the property type isn't primitive."
sky
2016/11/29 04:19:36
Done.
|
| + bool GetPropertyValueFromTransformValue( |
|
msw
2016/11/29 01:15:45
s/Transform/Transport/?
sky
2016/11/29 04:19:36
Wow! And I just started wearing glasses. Apparentl
|
| + const std::string& transport_name, |
| + const std::vector<uint8_t>& transport_data, |
| + PrimitiveType* value); |
| + |
| // Register a property to support conversion between mus and aura. |
| template<typename T> |
| void RegisterProperty(const WindowProperty<T>* property, |
| @@ -65,6 +84,8 @@ class AURA_EXPORT PropertyConverter { |
| const char* transport_name); |
| void RegisterProperty(const WindowProperty<gfx::Rect*>* property, |
| const char* transport_name); |
| + void RegisterProperty(const WindowProperty<gfx::Size*>* property, |
| + const char* transport_name); |
| void RegisterProperty(const WindowProperty<std::string*>* property, |
| const char* transport_name); |
| void RegisterProperty(const WindowProperty<base::string16*>* property, |
| @@ -82,6 +103,7 @@ class AURA_EXPORT PropertyConverter { |
| std::map<const WindowProperty<gfx::ImageSkia*>*, const char*> |
| image_properties_; |
| std::map<const WindowProperty<gfx::Rect*>*, const char*> rect_properties_; |
| + std::map<const WindowProperty<gfx::Size*>*, const char*> size_properties_; |
| std::map<const WindowProperty<std::string*>*, const char*> string_properties_; |
| std::map<const WindowProperty<base::string16*>*, const char*> |
| string16_properties_; |