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

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

Issue 2878133002: mash: Serialize ShelfIDs for property conversion and transport. (Closed)
Patch Set: Remove |user_windows_with_items_| entries in workaround; disable a test in mash. Created 3 years, 7 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
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // value of false indicates the value isn't known or the property type isn't 71 // value of false indicates the value isn't known or the property type isn't
72 // primitive. 72 // primitive.
73 bool GetPropertyValueFromTransportValue( 73 bool GetPropertyValueFromTransportValue(
74 const std::string& transport_name, 74 const std::string& transport_name,
75 const std::vector<uint8_t>& transport_data, 75 const std::vector<uint8_t>& transport_data,
76 PrimitiveType* value); 76 PrimitiveType* value);
77 77
78 // Register a property to support conversion between mus and aura. 78 // Register a property to support conversion between mus and aura.
79 // |validator| is a callback used to validate incoming values from 79 // |validator| is a callback used to validate incoming values from
80 // transport_data; if it returns false, the value is rejected. 80 // transport_data; if it returns false, the value is rejected.
81 // TODO(msw): Include type names in RegisterProperty function names.
81 template <typename T> 82 template <typename T>
82 void RegisterProperty( 83 void RegisterProperty(
83 const WindowProperty<T>* property, 84 const WindowProperty<T>* property,
84 const char* transport_name, 85 const char* transport_name,
85 const base::RepeatingCallback<bool(int64_t)>& validator) { 86 const base::RepeatingCallback<bool(int64_t)>& validator) {
86 PrimitiveProperty primitive_property; 87 PrimitiveProperty primitive_property;
87 primitive_property.property_name = property->name; 88 primitive_property.property_name = property->name;
88 primitive_property.transport_name = transport_name; 89 primitive_property.transport_name = transport_name;
89 primitive_property.default_value = 90 primitive_property.default_value =
90 ui::ClassPropertyCaster<T>::ToInt64(property->default_value); 91 ui::ClassPropertyCaster<T>::ToInt64(property->default_value);
91 primitive_property.validator = validator; 92 primitive_property.validator = validator;
92 primitive_properties_[property] = primitive_property; 93 primitive_properties_[property] = primitive_property;
93 transport_names_.insert(transport_name); 94 transport_names_.insert(transport_name);
94 } 95 }
95 96
96 // Specializations for properties to pointer types supporting mojo conversion. 97 // Register owned properties to support conversion between mus and aura.
98 // TODO(msw): Include type names in RegisterProperty function names.
James Cook 2017/05/15 16:37:23 Yeah, this would be good to do, given how much tim
msw 2017/05/15 19:21:32 Acknowledged.
97 void RegisterProperty(const WindowProperty<gfx::ImageSkia*>* property, 99 void RegisterProperty(const WindowProperty<gfx::ImageSkia*>* property,
98 const char* transport_name); 100 const char* transport_name);
99 void RegisterProperty(const WindowProperty<gfx::Rect*>* property, 101 void RegisterProperty(const WindowProperty<gfx::Rect*>* property,
100 const char* transport_name); 102 const char* transport_name);
101 void RegisterProperty(const WindowProperty<gfx::Size*>* property, 103 void RegisterProperty(const WindowProperty<gfx::Size*>* property,
102 const char* transport_name); 104 const char* transport_name);
103 void RegisterProperty(const WindowProperty<std::string*>* property, 105 void RegisterProperty(const WindowProperty<std::string*>* property,
104 const char* transport_name); 106 const char* transport_name);
105 void RegisterProperty(const WindowProperty<base::string16*>* property, 107 void RegisterProperty(const WindowProperty<base::string16*>* property,
106 const char* transport_name); 108 const char* transport_name);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 140
139 // Set of transport names supplied to RegisterProperty(). 141 // Set of transport names supplied to RegisterProperty().
140 std::set<std::string> transport_names_; 142 std::set<std::string> transport_names_;
141 143
142 DISALLOW_COPY_AND_ASSIGN(PropertyConverter); 144 DISALLOW_COPY_AND_ASSIGN(PropertyConverter);
143 }; 145 };
144 146
145 } // namespace aura 147 } // namespace aura
146 148
147 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_ 149 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698