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