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

Side by Side Diff: ui/aura/mus/property_converter.h

Issue 2694213003: mash: wires up shadows for mash (Closed)
Patch Set: defaults test Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « services/ui/ws/window_manager_state.cc ('k') | ui/aura/mus/property_converter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_AURA_MUS_PROPERTY_CONVERTER_H_ 5 #ifndef UI_AURA_MUS_PROPERTY_CONVERTER_H_
6 #define UI_AURA_MUS_PROPERTY_CONVERTER_H_ 6 #define UI_AURA_MUS_PROPERTY_CONVERTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 18 matching lines...) Expand all
29 // to server properties, and similarly not all transport properties need map to 29 // to server properties, and similarly not all transport properties need map to
30 // Window properties. 30 // Window properties.
31 class AURA_EXPORT PropertyConverter { 31 class AURA_EXPORT PropertyConverter {
32 public: 32 public:
33 // All primitive values are stored using this type. 33 // All primitive values are stored using this type.
34 using PrimitiveType = int64_t; 34 using PrimitiveType = int64_t;
35 35
36 PropertyConverter(); 36 PropertyConverter();
37 ~PropertyConverter(); 37 ~PropertyConverter();
38 38
39 // Returns true if RegisterProperty() has been called with the specified
40 // transport name.
41 bool IsTransportNameRegistered(const std::string& name) const;
42
39 // Maps a property on the Window to a property pushed to the server. Return 43 // Maps a property on the Window to a property pushed to the server. Return
40 // true if the property should be sent to the server, false if the property 44 // true if the property should be sent to the server, false if the property
41 // is only used locally. 45 // is only used locally.
42 bool ConvertPropertyForTransport( 46 bool ConvertPropertyForTransport(
43 Window* window, 47 Window* window,
44 const void* key, 48 const void* key,
45 std::string* transport_name, 49 std::string* transport_name,
46 std::unique_ptr<std::vector<uint8_t>>* transport_value); 50 std::unique_ptr<std::vector<uint8_t>>* transport_value);
47 51
48 // Returns the transport name for a Window property. 52 // Returns the transport name for a Window property.
(...skipping 17 matching lines...) Expand all
66 const std::vector<uint8_t>& transport_data, 70 const std::vector<uint8_t>& transport_data,
67 PrimitiveType* value); 71 PrimitiveType* value);
68 72
69 // Register a property to support conversion between mus and aura. 73 // Register a property to support conversion between mus and aura.
70 template<typename T> 74 template<typename T>
71 void RegisterProperty(const WindowProperty<T>* property, 75 void RegisterProperty(const WindowProperty<T>* property,
72 const char* transport_name) { 76 const char* transport_name) {
73 PrimitiveProperty primitive_property; 77 PrimitiveProperty primitive_property;
74 primitive_property.property_name = property->name; 78 primitive_property.property_name = property->name;
75 primitive_property.transport_name = transport_name; 79 primitive_property.transport_name = transport_name;
76 primitive_property.default_value = property->default_value; 80 primitive_property.default_value =
81 ui::ClassPropertyCaster<T>::ToInt64(property->default_value);
77 primitive_properties_[property] = primitive_property; 82 primitive_properties_[property] = primitive_property;
83 transport_names_.insert(transport_name);
78 } 84 }
79 85
80 // Specializations for properties to pointer types supporting mojo conversion. 86 // Specializations for properties to pointer types supporting mojo conversion.
81 void RegisterProperty(const WindowProperty<gfx::ImageSkia*>* property, 87 void RegisterProperty(const WindowProperty<gfx::ImageSkia*>* property,
82 const char* transport_name); 88 const char* transport_name);
83 void RegisterProperty(const WindowProperty<gfx::Rect*>* property, 89 void RegisterProperty(const WindowProperty<gfx::Rect*>* property,
84 const char* transport_name); 90 const char* transport_name);
85 void RegisterProperty(const WindowProperty<gfx::Size*>* property, 91 void RegisterProperty(const WindowProperty<gfx::Size*>* property,
86 const char* transport_name); 92 const char* transport_name);
87 void RegisterProperty(const WindowProperty<std::string*>* property, 93 void RegisterProperty(const WindowProperty<std::string*>* property,
(...skipping 19 matching lines...) Expand all
107 // Maps of aura::WindowProperty<T> to their mus property names. 113 // Maps of aura::WindowProperty<T> to their mus property names.
108 // This supports types that can be serialized for Mojo, eg. T=std::string*. 114 // This supports types that can be serialized for Mojo, eg. T=std::string*.
109 std::map<const WindowProperty<gfx::ImageSkia*>*, const char*> 115 std::map<const WindowProperty<gfx::ImageSkia*>*, const char*>
110 image_properties_; 116 image_properties_;
111 std::map<const WindowProperty<gfx::Rect*>*, const char*> rect_properties_; 117 std::map<const WindowProperty<gfx::Rect*>*, const char*> rect_properties_;
112 std::map<const WindowProperty<gfx::Size*>*, const char*> size_properties_; 118 std::map<const WindowProperty<gfx::Size*>*, const char*> size_properties_;
113 std::map<const WindowProperty<std::string*>*, const char*> string_properties_; 119 std::map<const WindowProperty<std::string*>*, const char*> string_properties_;
114 std::map<const WindowProperty<base::string16*>*, const char*> 120 std::map<const WindowProperty<base::string16*>*, const char*>
115 string16_properties_; 121 string16_properties_;
116 122
123 // Set of transport names supplied to RegisterProperty().
124 std::set<std::string> transport_names_;
125
117 DISALLOW_COPY_AND_ASSIGN(PropertyConverter); 126 DISALLOW_COPY_AND_ASSIGN(PropertyConverter);
118 }; 127 };
119 128
120 } // namespace aura 129 } // namespace aura
121 130
122 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_ 131 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_
OLDNEW
« no previous file with comments | « services/ui/ws/window_manager_state.cc ('k') | ui/aura/mus/property_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698