| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace aura { | 21 namespace aura { |
| 22 | 22 |
| 23 class Window; | 23 class Window; |
| 24 class WindowObserver; | 24 class WindowObserver; |
| 25 | 25 |
| 26 // See comments in OnWillChangeProperty() for details. | 26 // See comments in OnWillChangeProperty() for details. |
| 27 struct AURA_EXPORT WindowPortPropertyData { | 27 struct AURA_EXPORT WindowPortPropertyData { |
| 28 virtual ~WindowPortPropertyData() {} | 28 virtual ~WindowPortPropertyData() {} |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // See comments in Init() for details. | |
| 32 struct AURA_EXPORT WindowPortInitData { | |
| 33 virtual ~WindowPortInitData() {} | |
| 34 }; | |
| 35 | |
| 36 // WindowPort defines an interface to enable Window to be used with or without | 31 // WindowPort defines an interface to enable Window to be used with or without |
| 37 // mus. WindowPort is owned by Window and called at key points in Windows | 32 // mus. WindowPort is owned by Window and called at key points in Windows |
| 38 // lifetime that enable Window to be used in both environments. | 33 // lifetime that enable Window to be used in both environments. |
| 39 // | 34 // |
| 40 // If a Window is created without an explicit WindowPort then | 35 // If a Window is created without an explicit WindowPort then |
| 41 // Env::CreateWindowPort() is used to create the WindowPort. | 36 // Env::CreateWindowPort() is used to create the WindowPort. |
| 42 class AURA_EXPORT WindowPort { | 37 class AURA_EXPORT WindowPort { |
| 43 public: | 38 public: |
| 44 virtual ~WindowPort() {} | 39 virtual ~WindowPort() {} |
| 45 | 40 |
| 46 // Called from Window::Init(). The return value of this is supplied to | 41 // Called from Window::Init(). |
| 47 // OnInitDone() and is used to allow the WindowPort to pass data between the | 42 virtual void OnPreInit(Window* window) = 0; |
| 48 // two functions. | |
| 49 virtual std::unique_ptr<WindowPortInitData> OnPreInit(Window* window) = 0; | |
| 50 | |
| 51 virtual void OnPostInit(std::unique_ptr<WindowPortInitData> data) = 0; | |
| 52 | 43 |
| 53 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 44 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
| 54 | 45 |
| 55 // Called when a window is being added as a child. |child| may already have | 46 // Called when a window is being added as a child. |child| may already have |
| 56 // a parent, but its parent is not the Window this WindowPort is associated | 47 // a parent, but its parent is not the Window this WindowPort is associated |
| 57 // with. | 48 // with. |
| 58 virtual void OnWillAddChild(Window* child) = 0; | 49 virtual void OnWillAddChild(Window* child) = 0; |
| 59 | 50 |
| 60 virtual void OnWillRemoveChild(Window* child) = 0; | 51 virtual void OnWillRemoveChild(Window* child) = 0; |
| 61 | 52 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 // Returns the WindowPort associated with a Window. | 78 // Returns the WindowPort associated with a Window. |
| 88 static WindowPort* Get(Window* window); | 79 static WindowPort* Get(Window* window); |
| 89 | 80 |
| 90 // Returns the ObserverList of a Window. | 81 // Returns the ObserverList of a Window. |
| 91 static base::ObserverList<WindowObserver, true>* GetObservers(Window* window); | 82 static base::ObserverList<WindowObserver, true>* GetObservers(Window* window); |
| 92 }; | 83 }; |
| 93 | 84 |
| 94 } // namespace aura | 85 } // namespace aura |
| 95 | 86 |
| 96 #endif // UI_AURA_WINDOW_PORT_H_ | 87 #endif // UI_AURA_WINDOW_PORT_H_ |
| OLD | NEW |