| 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_WINDOW_PORT_H_ | 5 #ifndef UI_AURA_WINDOW_PORT_H_ |
| 6 #define UI_AURA_WINDOW_PORT_H_ | 6 #define UI_AURA_WINDOW_PORT_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 | 12 |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "ui/aura/aura_export.h" | 15 #include "ui/aura/aura_export.h" |
| 16 #include "ui/base/class_property.h" |
| 16 | 17 |
| 17 namespace gfx { | 18 namespace gfx { |
| 18 class Rect; | 19 class Rect; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace aura { | 22 namespace aura { |
| 22 | 23 |
| 23 class Window; | 24 class Window; |
| 24 class WindowObserver; | 25 class WindowObserver; |
| 25 | 26 |
| 26 // See comments in OnWillChangeProperty() for details. | 27 // See comments in OnWillChangeProperty() for details. |
| 27 struct AURA_EXPORT WindowPortPropertyData { | 28 //using WindowPortPropertyData = ui::PropertyData; |
| 28 virtual ~WindowPortPropertyData() {} | 29 //struct AURA_EXPORT WindowPortPropertyData : public ui::PropertyData { |
| 29 }; | 30 // ~WindowPortPropertyData() override {} |
| 31 //}; |
| 30 | 32 |
| 31 // WindowPort defines an interface to enable Window to be used with or without | 33 // WindowPort defines an interface to enable Window to be used with or without |
| 32 // mus. WindowPort is owned by Window and called at key points in Windows | 34 // mus. WindowPort is owned by Window and called at key points in Windows |
| 33 // lifetime that enable Window to be used in both environments. | 35 // lifetime that enable Window to be used in both environments. |
| 34 // | 36 // |
| 35 // If a Window is created without an explicit WindowPort then | 37 // If a Window is created without an explicit WindowPort then |
| 36 // Env::CreateWindowPort() is used to create the WindowPort. | 38 // Env::CreateWindowPort() is used to create the WindowPort. |
| 37 class AURA_EXPORT WindowPort { | 39 class AURA_EXPORT WindowPort { |
| 38 public: | 40 public: |
| 39 virtual ~WindowPort() {} | 41 virtual ~WindowPort() {} |
| (...skipping 18 matching lines...) Expand all Loading... |
| 58 virtual void OnWillMoveChild(size_t current_index, size_t dest_index) = 0; | 60 virtual void OnWillMoveChild(size_t current_index, size_t dest_index) = 0; |
| 59 | 61 |
| 60 virtual void OnVisibilityChanged(bool visible) = 0; | 62 virtual void OnVisibilityChanged(bool visible) = 0; |
| 61 | 63 |
| 62 virtual void OnDidChangeBounds(const gfx::Rect& old_bounds, | 64 virtual void OnDidChangeBounds(const gfx::Rect& old_bounds, |
| 63 const gfx::Rect& new_bounds) = 0; | 65 const gfx::Rect& new_bounds) = 0; |
| 64 | 66 |
| 65 // Called before a property is changed. The return value from this is supplied | 67 // Called before a property is changed. The return value from this is supplied |
| 66 // into OnPropertyChanged() so that WindowPort may pass data between the two | 68 // into OnPropertyChanged() so that WindowPort may pass data between the two |
| 67 // calls. | 69 // calls. |
| 68 virtual std::unique_ptr<WindowPortPropertyData> OnWillChangeProperty( | 70 virtual std::unique_ptr<ui::PropertyData> OnWillChangeProperty( |
| 69 const void* key) = 0; | 71 const void* key) = 0; |
| 70 | 72 |
| 71 // Called after a property changes, but before observers are notified. |data| | 73 // Called after a property changes, but before observers are notified. |data| |
| 72 // is the return value from OnWillChangeProperty(). | 74 // is the return value from OnWillChangeProperty(). |
| 73 virtual void OnPropertyChanged( | 75 virtual void OnPropertyChanged( |
| 74 const void* key, | 76 const void* key, |
| 75 std::unique_ptr<WindowPortPropertyData> data) = 0; | 77 std::unique_ptr<ui::PropertyData> data) = 0; |
| 76 | 78 |
| 77 protected: | 79 protected: |
| 78 // Returns the WindowPort associated with a Window. | 80 // Returns the WindowPort associated with a Window. |
| 79 static WindowPort* Get(Window* window); | 81 static WindowPort* Get(Window* window); |
| 80 | 82 |
| 81 // Returns the ObserverList of a Window. | 83 // Returns the ObserverList of a Window. |
| 82 static base::ObserverList<WindowObserver, true>* GetObservers(Window* window); | 84 static base::ObserverList<WindowObserver, true>* GetObservers(Window* window); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 } // namespace aura | 87 } // namespace aura |
| 86 | 88 |
| 87 #endif // UI_AURA_WINDOW_PORT_H_ | 89 #endif // UI_AURA_WINDOW_PORT_H_ |
| OLD | NEW |