OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_AURA_MUS_PROPERTY_CONVERTER_H_ |
| 6 #define UI_AURA_MUS_PROPERTY_CONVERTER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 #include <string> |
| 12 #include <vector> |
| 13 |
| 14 #include "ui/aura/aura_export.h" |
| 15 |
| 16 namespace aura { |
| 17 |
| 18 class Window; |
| 19 |
| 20 // 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 // 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 // Window properties. |
| 25 class PropertyConverter { |
| 26 public: |
| 27 virtual ~PropertyConverter() {} |
| 28 |
| 29 // 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 |
| 31 // is only used locally. |
| 32 virtual bool ConvertPropertyForTransport( |
| 33 Window* window, |
| 34 const void* key, |
| 35 std::string* transport_name, |
| 36 std::unique_ptr<std::vector<uint8_t>>* transport_value) = 0; |
| 37 |
| 38 // Returns the transport name for a Window property. |
| 39 virtual std::string GetTransportNameForPropertyKey(const void* key) = 0; |
| 40 |
| 41 // 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 |
| 43 // be null. |
| 44 virtual void SetPropertyFromTransportValue( |
| 45 Window* window, |
| 46 const std::string& transport_name, |
| 47 const std::vector<uint8_t>* transport_data) = 0; |
| 48 }; |
| 49 |
| 50 } // namespace aura |
| 51 |
| 52 #endif // UI_AURA_MUS_PROPERTY_CONVERTER_H_ |
OLD | NEW |