| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WINDOW_STATE_H_ | 5 #ifndef ASH_WM_WINDOW_STATE_H_ |
| 6 #define ASH_WM_WINDOW_STATE_H_ | 6 #define ASH_WM_WINDOW_STATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace ash { | 26 namespace ash { |
| 27 class LockWindowState; | 27 class LockWindowState; |
| 28 class MaximizeModeWindowState; | 28 class MaximizeModeWindowState; |
| 29 class WmWindow; | 29 class WmWindow; |
| 30 | 30 |
| 31 namespace mojom { | 31 namespace mojom { |
| 32 enum class WindowPinType; | 32 enum class WindowPinType; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace wm { | 35 namespace wm { |
| 36 class WindowState; |
| 36 class WindowStateDelegate; | 37 class WindowStateDelegate; |
| 37 class WindowStateObserver; | 38 class WindowStateObserver; |
| 38 class WMEvent; | 39 class WMEvent; |
| 39 | 40 |
| 41 // Returns the WindowState for the active window, null if there is no active |
| 42 // window. |
| 43 ASH_EXPORT WindowState* GetActiveWindowState(); |
| 44 |
| 45 // Returns the WindowState for |window|. Creates WindowState if it doesn't |
| 46 // exist. The returned value is owned by |window| (you should not delete it). |
| 47 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); |
| 48 ASH_EXPORT const WindowState* GetWindowState(const aura::Window* window); |
| 49 |
| 40 // WindowState manages and defines ash specific window state and | 50 // WindowState manages and defines ash specific window state and |
| 41 // behavior. Ash specific per-window state (such as ones that controls | 51 // behavior. Ash specific per-window state (such as ones that controls |
| 42 // window manager behavior) and ash specific window behavior (such as | 52 // window manager behavior) and ash specific window behavior (such as |
| 43 // maximize, minimize, snap sizing etc) should be added here instead | 53 // maximize, minimize, snap sizing etc) should be added here instead |
| 44 // of defining separate functions (like |MaximizeWindow(aura::Window* | 54 // of defining separate functions (like |MaximizeWindow(aura::Window* |
| 45 // window)|) or using aura Window property. | 55 // window)|) or using aura Window property. |
| 46 // The WindowState gets created when first accessed by | 56 // The WindowState gets created when first accessed by |
| 47 // |wm::GetWindowState|, and deleted when the window is deleted. | 57 // |wm::GetWindowState|, and deleted when the window is deleted. |
| 48 // Prefer using this class instead of passing aura::Window* around in | 58 // Prefer using this class instead of passing aura::Window* around in |
| 49 // ash code as this is often what you need to interact with, and | 59 // ash code as this is often what you need to interact with, and |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // Returns a pointer to DragDetails during drag operations. | 326 // Returns a pointer to DragDetails during drag operations. |
| 317 const DragDetails* drag_details() const { return drag_details_.get(); } | 327 const DragDetails* drag_details() const { return drag_details_.get(); } |
| 318 DragDetails* drag_details() { return drag_details_.get(); } | 328 DragDetails* drag_details() { return drag_details_.get(); } |
| 319 | 329 |
| 320 // Called from the associated WmWindow once the show state changes. | 330 // Called from the associated WmWindow once the show state changes. |
| 321 void OnWindowShowStateChanged(); | 331 void OnWindowShowStateChanged(); |
| 322 | 332 |
| 323 // Called from the associated WmWindow once the window pin type changes. | 333 // Called from the associated WmWindow once the window pin type changes. |
| 324 void OnWindowPinTypeChanged(); | 334 void OnWindowPinTypeChanged(); |
| 325 | 335 |
| 326 protected: | |
| 327 explicit WindowState(WmWindow* window); | |
| 328 | |
| 329 private: | 336 private: |
| 330 friend class DefaultState; | 337 friend class DefaultState; |
| 331 friend class ash::LockWindowState; | 338 friend class ash::LockWindowState; |
| 332 friend class ash::MaximizeModeWindowState; | 339 friend class ash::MaximizeModeWindowState; |
| 340 friend WindowState* GetWindowState(aura::Window*); |
| 333 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); | 341 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); |
| 334 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, | 342 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, |
| 335 CrossFadeToBoundsFromTransform); | 343 CrossFadeToBoundsFromTransform); |
| 336 | 344 |
| 345 explicit WindowState(WmWindow* window); |
| 346 |
| 337 WindowStateDelegate* delegate() { return delegate_.get(); } | 347 WindowStateDelegate* delegate() { return delegate_.get(); } |
| 338 | 348 |
| 339 // Returns the window's current always_on_top state. | 349 // Returns the window's current always_on_top state. |
| 340 bool GetAlwaysOnTop() const; | 350 bool GetAlwaysOnTop() const; |
| 341 | 351 |
| 342 // Returns the window's current show state. | 352 // Returns the window's current show state. |
| 343 ui::WindowShowState GetShowState() const; | 353 ui::WindowShowState GetShowState() const; |
| 344 | 354 |
| 345 // Return the window's current pin type. | 355 // Return the window's current pin type. |
| 346 ash::mojom::WindowPinType GetPinType() const; | 356 ash::mojom::WindowPinType GetPinType() const; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 418 |
| 409 std::unique_ptr<State> current_state_; | 419 std::unique_ptr<State> current_state_; |
| 410 | 420 |
| 411 DISALLOW_COPY_AND_ASSIGN(WindowState); | 421 DISALLOW_COPY_AND_ASSIGN(WindowState); |
| 412 }; | 422 }; |
| 413 | 423 |
| 414 } // namespace wm | 424 } // namespace wm |
| 415 } // namespace ash | 425 } // namespace ash |
| 416 | 426 |
| 417 #endif // ASH_WM_WINDOW_STATE_H_ | 427 #endif // ASH_WM_WINDOW_STATE_H_ |
| OLD | NEW |