| 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 ASH_WM_AURA_WM_WINDOW_AURA_H_ | 5 #ifndef ASH_WM_AURA_WM_WINDOW_AURA_H_ |
| 6 #define ASH_WM_AURA_WM_WINDOW_AURA_H_ | 6 #define ASH_WM_AURA_WM_WINDOW_AURA_H_ |
| 7 | 7 |
| 8 #include "ash/wm/common/wm_window.h" | 8 #include "ash/wm/common/wm_window.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "ui/aura/window_observer.h" | 11 #include "ui/aura/window_observer.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 namespace wm { | 14 namespace wm { |
| 15 | 15 |
| 16 // WmWindowAura is tied to the life of the underlying aura::Window. | 16 // WmWindowAura is tied to the life of the underlying aura::Window. |
| 17 class ASH_EXPORT WmWindowAura : public WmWindow, public aura::WindowObserver { | 17 class ASH_EXPORT WmWindowAura : public WmWindow, public aura::WindowObserver { |
| 18 public: | 18 public: |
| 19 explicit WmWindowAura(aura::Window* window); | 19 explicit WmWindowAura(aura::Window* window); |
| 20 // NOTE: this class is owned by the corresponding window. You shouldn't delete | 20 // NOTE: this class is owned by the corresponding window. You shouldn't delete |
| 21 // TODO(sky): friend deleter and make private. | 21 // TODO(sky): friend deleter and make private. |
| 22 ~WmWindowAura() override; | 22 ~WmWindowAura() override; |
| 23 | 23 |
| 24 // Returns a WmWindow for an aura::Window, creating if necessary. | 24 // Returns a WmWindow for an aura::Window, creating if necessary. |window| may |
| 25 // be null, in which case null is returned. |
| 25 static WmWindow* Get(aura::Window* window); | 26 static WmWindow* Get(aura::Window* window); |
| 26 | 27 |
| 27 static aura::Window* GetAuraWindow(WmWindow* wm_window) { | 28 static aura::Window* GetAuraWindow(WmWindow* wm_window) { |
| 28 return const_cast<aura::Window*>( | 29 return const_cast<aura::Window*>( |
| 29 GetAuraWindow(const_cast<const WmWindow*>(wm_window))); | 30 GetAuraWindow(const_cast<const WmWindow*>(wm_window))); |
| 30 } | 31 } |
| 31 static const aura::Window* GetAuraWindow(const WmWindow* wm_window); | 32 static const aura::Window* GetAuraWindow(const WmWindow* wm_window); |
| 32 | 33 |
| 33 aura::Window* aura_window() { return window_; } | 34 aura::Window* aura_window() { return window_; } |
| 34 const aura::Window* aura_window() const { return window_; } | 35 const aura::Window* aura_window() const { return window_; } |
| 35 | 36 |
| 36 // WmWindow: | 37 // WmWindow: |
| 37 const WmWindow* GetRootWindow() const override; | 38 const WmWindow* GetRootWindow() const override; |
| 38 WmRootWindowController* GetRootWindowController() override; | 39 WmRootWindowController* GetRootWindowController() override; |
| 39 WmGlobals* GetGlobals() const override; | 40 WmGlobals* GetGlobals() const override; |
| 40 int GetShellWindowId() override; | 41 int GetShellWindowId() override; |
| 41 WmWindow* GetChildByShellWindowId(int id) override; | 42 WmWindow* GetChildByShellWindowId(int id) override; |
| 42 ui::wm::WindowType GetType() const override; | 43 ui::wm::WindowType GetType() const override; |
| 43 ui::Layer* GetLayer() override; | 44 ui::Layer* GetLayer() override; |
| 44 gfx::Display GetDisplayNearestWindow() override; | 45 gfx::Display GetDisplayNearestWindow() override; |
| 45 bool HasNonClientArea() override; | 46 bool HasNonClientArea() override; |
| 46 int GetNonClientComponent(const gfx::Point& location) override; | 47 int GetNonClientComponent(const gfx::Point& location) override; |
| 47 gfx::Point ConvertPointToTarget(const WmWindow* target, | 48 gfx::Point ConvertPointToTarget(const WmWindow* target, |
| 48 const gfx::Point& point) const override; | 49 const gfx::Point& point) const override; |
| 49 gfx::Point ConvertPointToScreen(const gfx::Point& point) const override; | 50 gfx::Point ConvertPointToScreen(const gfx::Point& point) const override; |
| 50 gfx::Point ConvertPointFromScreen(const gfx::Point& point) const override; | 51 gfx::Point ConvertPointFromScreen(const gfx::Point& point) const override; |
| 51 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override; | 52 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override; |
| 52 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const override; | 53 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const override; |
| 53 gfx::Size GetMinimumSize() override; | 54 gfx::Size GetMinimumSize() const override; |
| 54 gfx::Size GetMaximumSize() override; | 55 gfx::Size GetMaximumSize() const override; |
| 55 bool GetTargetVisibility() const override; | 56 bool GetTargetVisibility() const override; |
| 56 bool IsVisible() const override; | 57 bool IsVisible() const override; |
| 57 bool GetBoolProperty(WmWindowProperty key) override; | 58 bool GetBoolProperty(WmWindowProperty key) override; |
| 58 const WindowState* GetWindowState() const override; | 59 const WindowState* GetWindowState() const override; |
| 59 WmWindow* GetToplevelWindow() override; | 60 WmWindow* GetToplevelWindow() override; |
| 60 void SetParentUsingContext(WmWindow* context, | 61 void SetParentUsingContext(WmWindow* context, |
| 61 const gfx::Rect& screen_bounds) override; | 62 const gfx::Rect& screen_bounds) override; |
| 62 void AddChild(WmWindow* window) override; | 63 void AddChild(WmWindow* window) override; |
| 63 WmWindow* GetParent() override; | 64 WmWindow* GetParent() override; |
| 64 WmWindow* GetTransientParent() override; | 65 const WmWindow* GetTransientParent() const override; |
| 65 std::vector<WmWindow*> GetTransientChildren() override; | 66 std::vector<WmWindow*> GetTransientChildren() override; |
| 67 void SetLayoutManager( |
| 68 std::unique_ptr<WmLayoutManager> layout_manager) override; |
| 69 WmLayoutManager* GetLayoutManager() override; |
| 66 void SetVisibilityAnimationType(int type) override; | 70 void SetVisibilityAnimationType(int type) override; |
| 71 void SetVisibilityAnimationDuration(base::TimeDelta delta) override; |
| 67 void Animate(::wm::WindowAnimationType type) override; | 72 void Animate(::wm::WindowAnimationType type) override; |
| 68 void SetBounds(const gfx::Rect& bounds) override; | 73 void SetBounds(const gfx::Rect& bounds) override; |
| 69 void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, | 74 void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, |
| 70 base::TimeDelta delta) override; | 75 base::TimeDelta delta) override; |
| 71 void SetBoundsDirect(const gfx::Rect& bounds) override; | 76 void SetBoundsDirect(const gfx::Rect& bounds) override; |
| 72 void SetBoundsDirectAnimated(const gfx::Rect& bounds) override; | 77 void SetBoundsDirectAnimated(const gfx::Rect& bounds) override; |
| 73 void SetBoundsDirectCrossFade(const gfx::Rect& bounds) override; | 78 void SetBoundsDirectCrossFade(const gfx::Rect& bounds) override; |
| 74 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, | 79 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, |
| 75 const gfx::Display& dst_display) override; | 80 const gfx::Display& dst_display) override; |
| 76 gfx::Rect GetBoundsInScreen() const override; | 81 gfx::Rect GetBoundsInScreen() const override; |
| 77 const gfx::Rect& GetBounds() const override; | 82 const gfx::Rect& GetBounds() const override; |
| 78 gfx::Rect GetTargetBounds() override; | 83 gfx::Rect GetTargetBounds() override; |
| 79 void ClearRestoreBounds() override; | 84 void ClearRestoreBounds() override; |
| 80 void SetRestoreBoundsInScreen(const gfx::Rect& bounds) override; | 85 void SetRestoreBoundsInScreen(const gfx::Rect& bounds) override; |
| 81 gfx::Rect GetRestoreBoundsInScreen() const override; | 86 gfx::Rect GetRestoreBoundsInScreen() const override; |
| 82 void OnWMEvent(const wm::WMEvent* event) override; | 87 void OnWMEvent(const wm::WMEvent* event) override; |
| 83 bool Contains(const WmWindow* other) const override; | 88 bool Contains(const WmWindow* other) const override; |
| 84 void SetShowState(ui::WindowShowState show_state) override; | 89 void SetShowState(ui::WindowShowState show_state) override; |
| 85 ui::WindowShowState GetShowState() const override; | 90 ui::WindowShowState GetShowState() const override; |
| 86 void SetRestoreShowState(ui::WindowShowState show_state) override; | 91 void SetRestoreShowState(ui::WindowShowState show_state) override; |
| 87 void SetCapture() override; | 92 void SetCapture() override; |
| 88 bool HasCapture() override; | 93 bool HasCapture() override; |
| 89 void ReleaseCapture() override; | 94 void ReleaseCapture() override; |
| 90 bool HasRestoreBounds() const override; | 95 bool HasRestoreBounds() const override; |
| 91 bool CanMaximize() const override; | 96 bool CanMaximize() const override; |
| 92 bool CanMinimize() const override; | 97 bool CanMinimize() const override; |
| 93 bool CanResize() const override; | 98 bool CanResize() const override; |
| 94 bool CanActivate() const override; | 99 bool CanActivate() const override; |
| 95 void StackChildAtTop(WmWindow* child) override; | 100 void StackChildAtTop(WmWindow* child) override; |
| 101 void StackChildAtBottom(WmWindow* child) override; |
| 96 void StackChildAbove(WmWindow* child, WmWindow* target) override; | 102 void StackChildAbove(WmWindow* child, WmWindow* target) override; |
| 97 void StackChildBelow(WmWindow* child, WmWindow* target) override; | 103 void StackChildBelow(WmWindow* child, WmWindow* target) override; |
| 98 void SetAlwaysOnTop(bool value) override; | 104 void SetAlwaysOnTop(bool value) override; |
| 99 bool IsAlwaysOnTop() const override; | 105 bool IsAlwaysOnTop() const override; |
| 100 void Hide() override; | 106 void Hide() override; |
| 101 void Show() override; | 107 void Show() override; |
| 108 bool IsFocused() const override; |
| 102 bool IsActive() const override; | 109 bool IsActive() const override; |
| 103 void Activate() override; | 110 void Activate() override; |
| 104 void Deactivate() override; | 111 void Deactivate() override; |
| 105 void Maximize() override; | 112 void Maximize() override; |
| 106 void Minimize() override; | 113 void Minimize() override; |
| 107 void Unminimize() override; | 114 void Unminimize() override; |
| 108 std::vector<WmWindow*> GetChildren() override; | 115 std::vector<WmWindow*> GetChildren() override; |
| 116 void SnapToPixelBoundaryIfNecessary() override; |
| 109 void AddObserver(WmWindowObserver* observer) override; | 117 void AddObserver(WmWindowObserver* observer) override; |
| 110 void RemoveObserver(WmWindowObserver* observer) override; | 118 void RemoveObserver(WmWindowObserver* observer) override; |
| 111 | 119 |
| 112 private: | 120 private: |
| 113 // aura::WindowObserver: | 121 // aura::WindowObserver: |
| 114 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; | 122 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; |
| 115 void OnWindowStackingChanged(aura::Window* window) override; | 123 void OnWindowStackingChanged(aura::Window* window) override; |
| 116 void OnWindowPropertyChanged(aura::Window* window, | 124 void OnWindowPropertyChanged(aura::Window* window, |
| 117 const void* key, | 125 const void* key, |
| 118 intptr_t old) override; | 126 intptr_t old) override; |
| 119 void OnWindowBoundsChanged(aura::Window* window, | 127 void OnWindowBoundsChanged(aura::Window* window, |
| 120 const gfx::Rect& old_bounds, | 128 const gfx::Rect& old_bounds, |
| 121 const gfx::Rect& new_bounds) override; | 129 const gfx::Rect& new_bounds) override; |
| 122 void OnWindowDestroying(aura::Window* window) override; | 130 void OnWindowDestroying(aura::Window* window) override; |
| 131 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; |
| 123 | 132 |
| 124 aura::Window* window_; | 133 aura::Window* window_; |
| 125 | 134 |
| 126 base::ObserverList<WmWindowObserver> observers_; | 135 base::ObserverList<WmWindowObserver> observers_; |
| 127 | 136 |
| 128 DISALLOW_COPY_AND_ASSIGN(WmWindowAura); | 137 DISALLOW_COPY_AND_ASSIGN(WmWindowAura); |
| 129 }; | 138 }; |
| 130 | 139 |
| 131 } // namespace wm | 140 } // namespace wm |
| 132 } // namespace ash | 141 } // namespace ash |
| 133 | 142 |
| 134 #endif // ASH_WM_AURA_WM_WINDOW_AURA_H_ | 143 #endif // ASH_WM_AURA_WM_WINDOW_AURA_H_ |
| OLD | NEW |