| OLD | NEW |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Register a property to support conversion between mus and aura. | 55 // Register a property to support conversion between mus and aura. |
| 56 template<typename T> | 56 template<typename T> |
| 57 void RegisterProperty(const WindowProperty<T>* property, | 57 void RegisterProperty(const WindowProperty<T>* property, |
| 58 const char* transport_name) { | 58 const char* transport_name) { |
| 59 primitive_properties_[property] = | 59 primitive_properties_[property] = |
| 60 PropertyNames(property->name, transport_name); | 60 PropertyNames(property->name, transport_name); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Specializations for properties to pointer types supporting mojo conversion. | 63 // Specializations for properties to pointer types supporting mojo conversion. |
| 64 void RegisterProperty(const WindowProperty<gfx::ImageSkia*>* property, |
| 65 const char* transport_name); |
| 64 void RegisterProperty(const WindowProperty<gfx::Rect*>* property, | 66 void RegisterProperty(const WindowProperty<gfx::Rect*>* property, |
| 65 const char* transport_name); | 67 const char* transport_name); |
| 66 void RegisterProperty(const WindowProperty<std::string*>* property, | 68 void RegisterProperty(const WindowProperty<std::string*>* property, |
| 67 const char* transport_name); | 69 const char* transport_name); |
| 68 void RegisterProperty(const WindowProperty<base::string16*>* property, | 70 void RegisterProperty(const WindowProperty<base::string16*>* property, |
| 69 const char* transport_name); | 71 const char* transport_name); |
| 70 | 72 |
| 71 private: | 73 private: |
| 72 // A pair with the aura::WindowProperty::name and the mus property name. | 74 // A pair with the aura::WindowProperty::name and the mus property name. |
| 73 using PropertyNames = std::pair<const char*, const char*>; | 75 using PropertyNames = std::pair<const char*, const char*>; |
| 74 // A map of aura::WindowProperty<T> to its aura and mus property names. | 76 // A map of aura::WindowProperty<T> to its aura and mus property names. |
| 75 // This supports the internal codepaths for primitive types, eg. T=bool. | 77 // This supports the internal codepaths for primitive types, eg. T=bool. |
| 76 std::map<const void*, PropertyNames> primitive_properties_; | 78 std::map<const void*, PropertyNames> primitive_properties_; |
| 77 | 79 |
| 78 // Maps of aura::WindowProperty<T> to their mus property names. | 80 // Maps of aura::WindowProperty<T> to their mus property names. |
| 79 // This supports types that can be serialized for Mojo, eg. T=std::string*. | 81 // This supports types that can be serialized for Mojo, eg. T=std::string*. |
| 82 std::map<const WindowProperty<gfx::ImageSkia*>*, const char*> |
| 83 image_properties_; |
| 80 std::map<const WindowProperty<gfx::Rect*>*, const char*> rect_properties_; | 84 std::map<const WindowProperty<gfx::Rect*>*, const char*> rect_properties_; |
| 81 std::map<const WindowProperty<std::string*>*, const char*> string_properties_; | 85 std::map<const WindowProperty<std::string*>*, const char*> string_properties_; |
| 82 std::map<const WindowProperty<base::string16*>*, const char*> | 86 std::map<const WindowProperty<base::string16*>*, const char*> |
| 83 string16_properties_; | 87 string16_properties_; |
| 84 | 88 |
| 85 DISALLOW_COPY_AND_ASSIGN(PropertyConverter); | 89 DISALLOW_COPY_AND_ASSIGN(PropertyConverter); |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 } // namespace aura | 92 } // namespace aura |
| 89 | 93 |
| 90 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_ | 94 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_ |
| OLD | NEW |