| 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 <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" |
| 14 #include "ui/aura/aura_export.h" | 15 #include "ui/aura/aura_export.h" |
| 15 | 16 |
| 16 namespace aura { | 17 namespace aura { |
| 17 | 18 |
| 18 class Window; | 19 class Window; |
| 19 | 20 |
| 20 // PropertyConverter is used to convert Window properties for transport to the | 21 // PropertyConverter is used to convert Window properties for transport to the |
| 21 // mus window server and back. Any time a property changes from one side it is | 22 // mus window server and back. Any time a property changes from one side it is |
| 22 // mapped to the other using this class. Not all Window properties need to map | 23 // mapped to the other using this class. Not all Window properties need to map |
| 23 // to server properties, and similarly not all transport properties need map to | 24 // to server properties, and similarly not all transport properties need map to |
| 24 // Window properties. | 25 // Window properties. |
| 25 class PropertyConverter { | 26 class AURA_EXPORT PropertyConverter { |
| 26 public: | 27 public: |
| 27 virtual ~PropertyConverter() {} | 28 PropertyConverter(); |
| 29 virtual ~PropertyConverter(); |
| 28 | 30 |
| 29 // Maps a property on the Window to a property pushed to the server. Return | 31 // Maps a property on the Window to a property pushed to the server. Return |
| 30 // true if the property should be sent to the server, false if the property | 32 // true if the property should be sent to the server, false if the property |
| 31 // is only used locally. | 33 // is only used locally. |
| 32 virtual bool ConvertPropertyForTransport( | 34 virtual bool ConvertPropertyForTransport( |
| 33 Window* window, | 35 Window* window, |
| 34 const void* key, | 36 const void* key, |
| 35 std::string* transport_name, | 37 std::string* transport_name, |
| 36 std::unique_ptr<std::vector<uint8_t>>* transport_value) = 0; | 38 std::unique_ptr<std::vector<uint8_t>>* transport_value); |
| 37 | 39 |
| 38 // Returns the transport name for a Window property. | 40 // Returns the transport name for a Window property. |
| 39 virtual std::string GetTransportNameForPropertyKey(const void* key) = 0; | 41 virtual std::string GetTransportNameForPropertyKey(const void* key); |
| 40 | 42 |
| 41 // Applies a value from the server to |window|. |transport_name| is the | 43 // Applies a value from the server to |window|. |transport_name| is the |
| 42 // name of the property and |transport_data| the value. |transport_data| may | 44 // name of the property and |transport_data| the value. |transport_data| may |
| 43 // be null. | 45 // be null. |
| 44 virtual void SetPropertyFromTransportValue( | 46 virtual void SetPropertyFromTransportValue( |
| 45 Window* window, | 47 Window* window, |
| 46 const std::string& transport_name, | 48 const std::string& transport_name, |
| 47 const std::vector<uint8_t>* transport_data) = 0; | 49 const std::vector<uint8_t>* transport_data); |
| 50 |
| 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(PropertyConverter); |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 } // namespace aura | 55 } // namespace aura |
| 51 | 56 |
| 52 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_ | 57 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_ |
| OLD | NEW |