| 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/compositor/layer_type.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 struct AURA_EXPORT WindowPortPropertyData { |
| 28 virtual ~WindowPortPropertyData() {} | 29 virtual ~WindowPortPropertyData() {} |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 // WindowPort defines an interface to enable Window to be used with or without | 32 // 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 | 33 // mus. WindowPort is owned by Window and called at key points in Windows |
| 33 // lifetime that enable Window to be used in both environments. | 34 // lifetime that enable Window to be used in both environments. |
| 34 // | 35 // |
| 35 // If a Window is created without an explicit WindowPort then | 36 // If a Window is created without an explicit WindowPort then |
| 36 // Env::CreateWindowPort() is used to create the WindowPort. | 37 // Env::CreateWindowPort() is used to create the WindowPort. |
| 37 class AURA_EXPORT WindowPort { | 38 class AURA_EXPORT WindowPort { |
| 38 public: | 39 public: |
| 39 virtual ~WindowPort() {} | 40 virtual ~WindowPort() {} |
| 40 | 41 |
| 41 // Called from Window::Init(). | 42 // Called from Window::Init(). |
| 42 virtual void OnPreInit(Window* window) = 0; | 43 virtual void OnPreInit(Window* window, ui::LayerType layer_type) = 0; |
| 43 | 44 |
| 44 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 45 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
| 45 | 46 |
| 46 // Called when a window is being added as a child. |child| may already have | 47 // Called when a window is being added as a child. |child| may already have |
| 47 // a parent, but its parent is not the Window this WindowPort is associated | 48 // a parent, but its parent is not the Window this WindowPort is associated |
| 48 // with. | 49 // with. |
| 49 virtual void OnWillAddChild(Window* child) = 0; | 50 virtual void OnWillAddChild(Window* child) = 0; |
| 50 | 51 |
| 51 virtual void OnWillRemoveChild(Window* child) = 0; | 52 virtual void OnWillRemoveChild(Window* child) = 0; |
| 52 | 53 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 78 // Returns the WindowPort associated with a Window. | 79 // Returns the WindowPort associated with a Window. |
| 79 static WindowPort* Get(Window* window); | 80 static WindowPort* Get(Window* window); |
| 80 | 81 |
| 81 // Returns the ObserverList of a Window. | 82 // Returns the ObserverList of a Window. |
| 82 static base::ObserverList<WindowObserver, true>* GetObservers(Window* window); | 83 static base::ObserverList<WindowObserver, true>* GetObservers(Window* window); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace aura | 86 } // namespace aura |
| 86 | 87 |
| 87 #endif // UI_AURA_WINDOW_PORT_H_ | 88 #endif // UI_AURA_WINDOW_PORT_H_ |
| OLD | NEW |