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