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

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

Issue 2538633002: Adds a couple more properties to the property converter (Closed)
Patch Set: cleanup Created 4 years, 1 month 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
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_;

Powered by Google App Engine
This is Rietveld 408576698