Chromium Code Reviews| 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_COMMON_WM_WINDOW_H_ | 5 #ifndef ASH_COMMON_WM_WINDOW_H_ |
| 6 #define ASH_COMMON_WM_WINDOW_H_ | 6 #define ASH_COMMON_WM_WINDOW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/supports_user_data.h" | |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "ui/base/ui_base_types.h" | 15 #include "ui/base/ui_base_types.h" |
| 15 #include "ui/compositor/layer_animation_element.h" | 16 #include "ui/compositor/layer_animation_element.h" |
| 16 #include "ui/wm/core/window_animations.h" | 17 #include "ui/wm/core/window_animations.h" |
| 17 #include "ui/wm/public/window_types.h" | 18 #include "ui/wm/public/window_types.h" |
| 18 | 19 |
| 20 namespace base { | |
| 21 class SupportsUserData; | |
| 22 } | |
| 23 | |
| 19 namespace display { | 24 namespace display { |
| 20 class Display; | 25 class Display; |
| 21 } | 26 } |
| 22 | 27 |
| 23 namespace gfx { | 28 namespace gfx { |
| 24 class Point; | 29 class Point; |
| 25 class Rect; | 30 class Rect; |
| 26 class Size; | 31 class Size; |
| 27 class Transform; | 32 class Transform; |
| 28 } | 33 } |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 57 class ASH_EXPORT WmWindow { | 62 class ASH_EXPORT WmWindow { |
| 58 public: | 63 public: |
| 59 // See comments in SetBoundsInScreen(). | 64 // See comments in SetBoundsInScreen(). |
| 60 enum class BoundsInScreenBehavior { | 65 enum class BoundsInScreenBehavior { |
| 61 USE_LOCAL_COORDINATES, | 66 USE_LOCAL_COORDINATES, |
| 62 USE_SCREEN_COORDINATES, | 67 USE_SCREEN_COORDINATES, |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 using Windows = std::vector<WmWindow*>; | 70 using Windows = std::vector<WmWindow*>; |
| 66 | 71 |
| 72 virtual void Destroy() = 0; | |
| 73 | |
| 67 WmWindow* GetRootWindow() { | 74 WmWindow* GetRootWindow() { |
| 68 return const_cast<WmWindow*>( | 75 return const_cast<WmWindow*>( |
| 69 const_cast<const WmWindow*>(this)->GetRootWindow()); | 76 const_cast<const WmWindow*>(this)->GetRootWindow()); |
| 70 } | 77 } |
| 71 virtual const WmWindow* GetRootWindow() const = 0; | 78 virtual const WmWindow* GetRootWindow() const = 0; |
| 72 virtual WmRootWindowController* GetRootWindowController() = 0; | 79 virtual WmRootWindowController* GetRootWindowController() = 0; |
| 73 | 80 |
| 74 // TODO(sky): fix constness. | 81 // TODO(sky): fix constness. |
| 75 virtual WmShell* GetShell() const = 0; | 82 virtual WmShell* GetShell() const = 0; |
| 76 | 83 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 virtual bool IsVisible() const = 0; | 122 virtual bool IsVisible() const = 0; |
| 116 | 123 |
| 117 virtual void SetOpacity(float opacity) = 0; | 124 virtual void SetOpacity(float opacity) = 0; |
| 118 virtual float GetTargetOpacity() const = 0; | 125 virtual float GetTargetOpacity() const = 0; |
| 119 | 126 |
| 120 virtual void SetTransform(const gfx::Transform& transform) = 0; | 127 virtual void SetTransform(const gfx::Transform& transform) = 0; |
| 121 virtual gfx::Transform GetTargetTransform() const = 0; | 128 virtual gfx::Transform GetTargetTransform() const = 0; |
| 122 | 129 |
| 123 virtual bool IsSystemModal() const = 0; | 130 virtual bool IsSystemModal() const = 0; |
| 124 | 131 |
| 132 // Returns the base::SupportsUserData* owned by |this| that can be used to | |
| 133 // store arbitrary data. | |
| 134 base::SupportsUserData* GetUserData(); | |
|
sky
2016/09/08 21:04:31
I went with this approach rather than having WmWin
| |
| 135 | |
| 125 virtual bool GetBoolProperty(WmWindowProperty key) = 0; | 136 virtual bool GetBoolProperty(WmWindowProperty key) = 0; |
| 126 virtual int GetIntProperty(WmWindowProperty key) = 0; | 137 virtual int GetIntProperty(WmWindowProperty key) = 0; |
| 127 virtual void SetIntProperty(WmWindowProperty key, int value) = 0; | 138 virtual void SetIntProperty(WmWindowProperty key, int value) = 0; |
| 128 | 139 |
| 129 // Returns null if there are no details. | 140 // Returns null if there are no details. |
| 130 virtual ShelfItemDetails* GetShelfItemDetails() = 0; | 141 virtual ShelfItemDetails* GetShelfItemDetails() = 0; |
| 131 virtual void SetShelfItemDetails(const ShelfItemDetails& details) = 0; | 142 virtual void SetShelfItemDetails(const ShelfItemDetails& details) = 0; |
| 132 virtual void ClearShelfItemDetails() = 0; | 143 virtual void ClearShelfItemDetails() = 0; |
| 133 | 144 |
| 134 wm::WindowState* GetWindowState() { | 145 wm::WindowState* GetWindowState() { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 155 const_cast<const WmWindow*>(this)->GetTransientParent()); | 166 const_cast<const WmWindow*>(this)->GetTransientParent()); |
| 156 } | 167 } |
| 157 virtual const WmWindow* GetTransientParent() const = 0; | 168 virtual const WmWindow* GetTransientParent() const = 0; |
| 158 virtual Windows GetTransientChildren() = 0; | 169 virtual Windows GetTransientChildren() = 0; |
| 159 | 170 |
| 160 virtual void SetLayoutManager( | 171 virtual void SetLayoutManager( |
| 161 std::unique_ptr<WmLayoutManager> layout_manager) = 0; | 172 std::unique_ptr<WmLayoutManager> layout_manager) = 0; |
| 162 virtual WmLayoutManager* GetLayoutManager() = 0; | 173 virtual WmLayoutManager* GetLayoutManager() = 0; |
| 163 | 174 |
| 164 // |type| is WindowVisibilityAnimationType. Has to be an int to match aura. | 175 // |type| is WindowVisibilityAnimationType. Has to be an int to match aura. |
| 176 virtual void SetVisibilityChangesAnimated() = 0; | |
| 165 virtual void SetVisibilityAnimationType(int type) = 0; | 177 virtual void SetVisibilityAnimationType(int type) = 0; |
| 166 virtual void SetVisibilityAnimationDuration(base::TimeDelta delta) = 0; | 178 virtual void SetVisibilityAnimationDuration(base::TimeDelta delta) = 0; |
| 167 virtual void SetVisibilityAnimationTransition( | 179 virtual void SetVisibilityAnimationTransition( |
| 168 ::wm::WindowVisibilityAnimationTransition transition) = 0; | 180 ::wm::WindowVisibilityAnimationTransition transition) = 0; |
| 169 virtual void Animate(::wm::WindowAnimationType type) = 0; | 181 virtual void Animate(::wm::WindowAnimationType type) = 0; |
| 170 virtual void StopAnimatingProperty( | 182 virtual void StopAnimatingProperty( |
| 171 ui::LayerAnimationElement::AnimatableProperty property) = 0; | 183 ui::LayerAnimationElement::AnimatableProperty property) = 0; |
| 172 virtual void SetChildWindowVisibilityChangesAnimated() = 0; | 184 virtual void SetChildWindowVisibilityChangesAnimated() = 0; |
| 173 | 185 |
| 174 // See description in ui::Layer. | 186 // See description in ui::Layer. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 // Adds or removes a handler to receive events targeted at this window, before | 320 // Adds or removes a handler to receive events targeted at this window, before |
| 309 // this window handles the events itself; the handler does not recieve events | 321 // this window handles the events itself; the handler does not recieve events |
| 310 // from embedded windows. This only supports windows with internal widgets; | 322 // from embedded windows. This only supports windows with internal widgets; |
| 311 // see GetInternalWidget(). Ownership of the handler is not transferred. | 323 // see GetInternalWidget(). Ownership of the handler is not transferred. |
| 312 // | 324 // |
| 313 // Also note that the target of these events is always an aura::Window. | 325 // Also note that the target of these events is always an aura::Window. |
| 314 virtual void AddLimitedPreTargetHandler(ui::EventHandler* handler) = 0; | 326 virtual void AddLimitedPreTargetHandler(ui::EventHandler* handler) = 0; |
| 315 virtual void RemoveLimitedPreTargetHandler(ui::EventHandler* handler) = 0; | 327 virtual void RemoveLimitedPreTargetHandler(ui::EventHandler* handler) = 0; |
| 316 | 328 |
| 317 protected: | 329 protected: |
| 318 virtual ~WmWindow() {} | 330 WmWindow(); |
| 331 virtual ~WmWindow(); | |
| 332 | |
| 333 void DestroyUserData(); | |
| 334 | |
| 335 private: | |
| 336 class SupportsUserDataImpl; | |
| 337 | |
| 338 std::unique_ptr<SupportsUserDataImpl> user_data_; | |
| 319 }; | 339 }; |
| 320 | 340 |
| 321 } // namespace ash | 341 } // namespace ash |
| 322 | 342 |
| 323 #endif // ASH_COMMON_WM_WINDOW_H_ | 343 #endif // ASH_COMMON_WM_WINDOW_H_ |
| OLD | NEW |