| 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_COMMON_WM_WINDOW_H_ | 5 #ifndef ASH_WM_COMMON_WM_WINDOW_H_ |
| 6 #define ASH_WM_COMMON_WM_WINDOW_H_ | 6 #define ASH_WM_COMMON_WM_WINDOW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/wm/common/ash_wm_common_export.h" | 11 #include "ash/wm/common/ash_wm_common_export.h" |
| 12 #include "base/strings/string16.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "ui/base/ui_base_types.h" | 14 #include "ui/base/ui_base_types.h" |
| 15 #include "ui/compositor/layer_animation_element.h" |
| 14 #include "ui/wm/core/window_animations.h" | 16 #include "ui/wm/core/window_animations.h" |
| 15 #include "ui/wm/public/window_types.h" | 17 #include "ui/wm/public/window_types.h" |
| 16 | 18 |
| 17 namespace display { | 19 namespace display { |
| 18 class Display; | 20 class Display; |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace gfx { | 23 namespace gfx { |
| 22 class Point; | 24 class Point; |
| 23 class Rect; | 25 class Rect; |
| 24 class Size; | 26 class Size; |
| 27 class Transform; |
| 25 } | 28 } |
| 26 | 29 |
| 27 namespace ui { | 30 namespace ui { |
| 28 class Layer; | 31 class Layer; |
| 29 } | 32 } |
| 30 | 33 |
| 31 namespace ash { | 34 namespace ash { |
| 32 namespace wm { | 35 namespace wm { |
| 33 | 36 |
| 34 class WMEvent; | 37 class WMEvent; |
| 35 class WmGlobals; | 38 class WmGlobals; |
| 36 class WmLayoutManager; | 39 class WmLayoutManager; |
| 37 class WmRootWindowController; | 40 class WmRootWindowController; |
| 38 class WmWindowObserver; | 41 class WmWindowObserver; |
| 39 enum class WmWindowProperty; | 42 enum class WmWindowProperty; |
| 40 class WindowState; | 43 class WindowState; |
| 41 | 44 |
| 42 // This class exists as a porting layer to allow ash/wm to work with | 45 // This class exists as a porting layer to allow ash/wm to work with |
| 43 // aura::Window | 46 // aura::Window or mus::Window. See aura::Window for details on the functions. |
| 44 // or mus::Window. See aura::Window for details on the functions. | |
| 45 class ASH_WM_COMMON_EXPORT WmWindow { | 47 class ASH_WM_COMMON_EXPORT WmWindow { |
| 46 public: | 48 public: |
| 47 WmWindow* GetRootWindow() { | 49 WmWindow* GetRootWindow() { |
| 48 return const_cast<WmWindow*>( | 50 return const_cast<WmWindow*>( |
| 49 const_cast<const WmWindow*>(this)->GetRootWindow()); | 51 const_cast<const WmWindow*>(this)->GetRootWindow()); |
| 50 } | 52 } |
| 51 virtual const WmWindow* GetRootWindow() const = 0; | 53 virtual const WmWindow* GetRootWindow() const = 0; |
| 52 virtual WmRootWindowController* GetRootWindowController() = 0; | 54 virtual WmRootWindowController* GetRootWindowController() = 0; |
| 53 | 55 |
| 54 // TODO(sky): fix constness. | 56 // TODO(sky): fix constness. |
| 55 virtual WmGlobals* GetGlobals() const = 0; | 57 virtual WmGlobals* GetGlobals() const = 0; |
| 56 | 58 |
| 59 virtual base::string16 GetTitle() const = 0; |
| 60 |
| 57 // See wm_shell_window_ids.h for list of known ids. | 61 // See wm_shell_window_ids.h for list of known ids. |
| 58 virtual void SetShellWindowId(int id) = 0; | 62 virtual void SetShellWindowId(int id) = 0; |
| 59 virtual int GetShellWindowId() const = 0; | 63 virtual int GetShellWindowId() const = 0; |
| 60 virtual WmWindow* GetChildByShellWindowId(int id) = 0; | 64 virtual WmWindow* GetChildByShellWindowId(int id) = 0; |
| 61 | 65 |
| 62 virtual ui::wm::WindowType GetType() const = 0; | 66 virtual ui::wm::WindowType GetType() const = 0; |
| 63 | 67 |
| 64 // TODO(sky): seems like this shouldn't be exposed. | 68 // TODO(sky): seems like this shouldn't be exposed. |
| 65 virtual ui::Layer* GetLayer() = 0; | 69 virtual ui::Layer* GetLayer() = 0; |
| 66 | 70 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 virtual gfx::Size GetMinimumSize() const = 0; | 83 virtual gfx::Size GetMinimumSize() const = 0; |
| 80 virtual gfx::Size GetMaximumSize() const = 0; | 84 virtual gfx::Size GetMaximumSize() const = 0; |
| 81 | 85 |
| 82 // Returns the visibility requested by this window. IsVisible() takes into | 86 // Returns the visibility requested by this window. IsVisible() takes into |
| 83 // account the visibility of the layer and ancestors, where as this tracks | 87 // account the visibility of the layer and ancestors, where as this tracks |
| 84 // whether Show() without a Hide() has been invoked. | 88 // whether Show() without a Hide() has been invoked. |
| 85 virtual bool GetTargetVisibility() const = 0; | 89 virtual bool GetTargetVisibility() const = 0; |
| 86 | 90 |
| 87 virtual bool IsVisible() const = 0; | 91 virtual bool IsVisible() const = 0; |
| 88 | 92 |
| 93 virtual void SetOpacity(float opacity) = 0; |
| 94 virtual float GetTargetOpacity() const = 0; |
| 95 |
| 96 virtual void SetTransform(const gfx::Transform& transform) = 0; |
| 97 virtual gfx::Transform GetTargetTransform() const = 0; |
| 98 |
| 89 virtual bool IsSystemModal() const = 0; | 99 virtual bool IsSystemModal() const = 0; |
| 90 | 100 |
| 91 virtual bool GetBoolProperty(WmWindowProperty key) = 0; | 101 virtual bool GetBoolProperty(WmWindowProperty key) = 0; |
| 92 virtual int GetIntProperty(WmWindowProperty key) = 0; | 102 virtual int GetIntProperty(WmWindowProperty key) = 0; |
| 93 | 103 |
| 94 WindowState* GetWindowState() { | 104 WindowState* GetWindowState() { |
| 95 return const_cast<WindowState*>( | 105 return const_cast<WindowState*>( |
| 96 const_cast<const WmWindow*>(this)->GetWindowState()); | 106 const_cast<const WmWindow*>(this)->GetWindowState()); |
| 97 } | 107 } |
| 98 virtual const WindowState* GetWindowState() const = 0; | 108 virtual const WindowState* GetWindowState() const = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 113 virtual const WmWindow* GetTransientParent() const = 0; | 123 virtual const WmWindow* GetTransientParent() const = 0; |
| 114 virtual std::vector<WmWindow*> GetTransientChildren() = 0; | 124 virtual std::vector<WmWindow*> GetTransientChildren() = 0; |
| 115 | 125 |
| 116 virtual void SetLayoutManager( | 126 virtual void SetLayoutManager( |
| 117 std::unique_ptr<WmLayoutManager> layout_manager) = 0; | 127 std::unique_ptr<WmLayoutManager> layout_manager) = 0; |
| 118 virtual WmLayoutManager* GetLayoutManager() = 0; | 128 virtual WmLayoutManager* GetLayoutManager() = 0; |
| 119 | 129 |
| 120 // |type| is WindowVisibilityAnimationType. Has to be an int to match aura. | 130 // |type| is WindowVisibilityAnimationType. Has to be an int to match aura. |
| 121 virtual void SetVisibilityAnimationType(int type) = 0; | 131 virtual void SetVisibilityAnimationType(int type) = 0; |
| 122 virtual void SetVisibilityAnimationDuration(base::TimeDelta delta) = 0; | 132 virtual void SetVisibilityAnimationDuration(base::TimeDelta delta) = 0; |
| 133 virtual void SetVisibilityAnimationTransition( |
| 134 ::wm::WindowVisibilityAnimationTransition transition) = 0; |
| 123 virtual void Animate(::wm::WindowAnimationType type) = 0; | 135 virtual void Animate(::wm::WindowAnimationType type) = 0; |
| 136 virtual void StopAnimatingProperty( |
| 137 ui::LayerAnimationElement::AnimatableProperty property) = 0; |
| 124 | 138 |
| 125 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 139 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
| 126 virtual void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, | 140 virtual void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, |
| 127 base::TimeDelta delta) = 0; | 141 base::TimeDelta delta) = 0; |
| 128 // Sets the bounds in such a way that LayoutManagers are circumvented. | 142 // Sets the bounds in such a way that LayoutManagers are circumvented. |
| 129 virtual void SetBoundsDirect(const gfx::Rect& bounds) = 0; | 143 virtual void SetBoundsDirect(const gfx::Rect& bounds) = 0; |
| 130 virtual void SetBoundsDirectAnimated(const gfx::Rect& bounds) = 0; | 144 virtual void SetBoundsDirectAnimated(const gfx::Rect& bounds) = 0; |
| 131 virtual void SetBoundsDirectCrossFade(const gfx::Rect& bounds) = 0; | 145 virtual void SetBoundsDirectCrossFade(const gfx::Rect& bounds) = 0; |
| 132 virtual void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, | 146 virtual void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, |
| 133 const display::Display& dst_display) = 0; | 147 const display::Display& dst_display) = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 155 virtual void ReleaseCapture() = 0; | 169 virtual void ReleaseCapture() = 0; |
| 156 | 170 |
| 157 virtual bool HasRestoreBounds() const = 0; | 171 virtual bool HasRestoreBounds() const = 0; |
| 158 | 172 |
| 159 virtual void SetAlwaysOnTop(bool value) = 0; | 173 virtual void SetAlwaysOnTop(bool value) = 0; |
| 160 virtual bool IsAlwaysOnTop() const = 0; | 174 virtual bool IsAlwaysOnTop() const = 0; |
| 161 | 175 |
| 162 virtual void Hide() = 0; | 176 virtual void Hide() = 0; |
| 163 virtual void Show() = 0; | 177 virtual void Show() = 0; |
| 164 | 178 |
| 179 // Requests the window to close and destroy itself. This is intended to |
| 180 // forward to an associated widget. |
| 181 virtual void CloseWidget() = 0; |
| 182 |
| 165 virtual bool IsFocused() const = 0; | 183 virtual bool IsFocused() const = 0; |
| 166 | 184 |
| 167 virtual bool IsActive() const = 0; | 185 virtual bool IsActive() const = 0; |
| 168 virtual void Activate() = 0; | 186 virtual void Activate() = 0; |
| 169 virtual void Deactivate() = 0; | 187 virtual void Deactivate() = 0; |
| 170 | 188 |
| 171 virtual void SetFullscreen() = 0; | 189 virtual void SetFullscreen() = 0; |
| 172 | 190 |
| 173 virtual void Maximize() = 0; | 191 virtual void Maximize() = 0; |
| 174 virtual void Minimize() = 0; | 192 virtual void Minimize() = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 200 virtual void RemoveObserver(WmWindowObserver* observer) = 0; | 218 virtual void RemoveObserver(WmWindowObserver* observer) = 0; |
| 201 | 219 |
| 202 protected: | 220 protected: |
| 203 virtual ~WmWindow() {} | 221 virtual ~WmWindow() {} |
| 204 }; | 222 }; |
| 205 | 223 |
| 206 } // namespace wm | 224 } // namespace wm |
| 207 } // namespace ash | 225 } // namespace ash |
| 208 | 226 |
| 209 #endif // ASH_WM_COMMON_WM_WINDOW_H_ | 227 #endif // ASH_WM_COMMON_WM_WINDOW_H_ |
| OLD | NEW |