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