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