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

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

Issue 2499933003: Expand aura::PropertyConverter support. (Closed)
Patch Set: Revert to std::string. 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 4fd2512dca5e5f44b0551ded7e3b195350fc934f..5a9b4cf2723857ce3d4285dc96b86243c45eb1e8 100644
--- a/ui/aura/mus/property_converter.h
+++ b/ui/aura/mus/property_converter.h
@@ -7,16 +7,20 @@
#include <stdint.h>
+#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "ui/aura/aura_export.h"
+#include "ui/aura/window.h"
-namespace aura {
+namespace gfx {
+class Rect;
+}
-class Window;
+namespace aura {
// PropertyConverter is used to convert Window properties for transport to the
// mus window server and back. Any time a property changes from one side it is
@@ -26,29 +30,45 @@ class Window;
class AURA_EXPORT PropertyConverter {
public:
PropertyConverter();
- virtual ~PropertyConverter();
+ ~PropertyConverter();
// 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.
- virtual bool ConvertPropertyForTransport(
+ bool ConvertPropertyForTransport(
Window* window,
const void* key,
std::string* transport_name,
std::unique_ptr<std::vector<uint8_t>>* transport_value);
// Returns the transport name for a Window property.
- virtual std::string GetTransportNameForPropertyKey(const void* key);
+ std::string GetTransportNameForPropertyKey(const void* key);
// Applies a value from the server to |window|. |transport_name| is the
// name of the property and |transport_data| the value. |transport_data| may
// be null.
- virtual void SetPropertyFromTransportValue(
+ void SetPropertyFromTransportValue(
Window* window,
const std::string& transport_name,
const std::vector<uint8_t>* transport_data);
+ void RegisterPrimitiveProperty(const void* key,
sky 2016/11/16 17:56:13 Document what |key| is. Or better yet, is it possi
msw 2016/11/16 22:47:45 Done.
+ const char* aura_name,
+ const char* transport_name);
+ void RegisterRectProperty(const WindowProperty<gfx::Rect*>* property,
+ const char* transport_name);
+ void RegisterStringProperty(const WindowProperty<std::string*>* property,
+ const char* transport_name);
+
private:
+ // A map of primitive property keys to their aura and mus property names.
+ typedef std::pair<const char*, const char*> PropertyNames;
sky 2016/11/16 17:56:13 using?
msw 2016/11/16 22:47:45 Done.
+ std::map<const void*, PropertyNames> primitive_properties_;
sky 2016/11/16 17:56:13 Document what the key is as it isn't readily obvio
msw 2016/11/16 22:47:45 Done.
+
+ // Maps of some aura window properties to their mus property names.
+ std::map<const WindowProperty<gfx::Rect*>*, const char*> rect_properties_;
+ std::map<const WindowProperty<std::string*>*, const char*> string_properties_;
+
DISALLOW_COPY_AND_ASSIGN(PropertyConverter);
};

Powered by Google App Engine
This is Rietveld 408576698