| 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_COMMON_WM_WINDOW_STATE_H_ | 5 #ifndef ASH_COMMON_WM_WINDOW_STATE_H_ |
| 6 #define ASH_COMMON_WM_WINDOW_STATE_H_ | 6 #define ASH_COMMON_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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class Rect; | 23 class Rect; |
| 24 } | 24 } |
| 25 | 25 |
| 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 { |
| 32 enum class WindowPinType; |
| 33 } |
| 34 |
| 31 namespace wm { | 35 namespace wm { |
| 32 class WindowStateDelegate; | 36 class WindowStateDelegate; |
| 33 class WindowStateObserver; | 37 class WindowStateObserver; |
| 34 class WMEvent; | 38 class WMEvent; |
| 35 | 39 |
| 36 // WindowState manages and defines ash specific window state and | 40 // WindowState manages and defines ash specific window state and |
| 37 // behavior. Ash specific per-window state (such as ones that controls | 41 // behavior. Ash specific per-window state (such as ones that controls |
| 38 // window manager behavior) and ash specific window behavior (such as | 42 // window manager behavior) and ash specific window behavior (such as |
| 39 // maximize, minimize, snap sizing etc) should be added here instead | 43 // maximize, minimize, snap sizing etc) should be added here instead |
| 40 // of defining separate functions (like |MaximizeWindow(aura::Window* | 44 // of defining separate functions (like |MaximizeWindow(aura::Window* |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // Sets the currently stored restore bounds and clears the restore bounds. | 316 // Sets the currently stored restore bounds and clears the restore bounds. |
| 313 void SetAndClearRestoreBounds(); | 317 void SetAndClearRestoreBounds(); |
| 314 | 318 |
| 315 // Returns a pointer to DragDetails during drag operations. | 319 // Returns a pointer to DragDetails during drag operations. |
| 316 const DragDetails* drag_details() const { return drag_details_.get(); } | 320 const DragDetails* drag_details() const { return drag_details_.get(); } |
| 317 DragDetails* drag_details() { return drag_details_.get(); } | 321 DragDetails* drag_details() { return drag_details_.get(); } |
| 318 | 322 |
| 319 // Called from the associated WmWindow once the show state changes. | 323 // Called from the associated WmWindow once the show state changes. |
| 320 void OnWindowShowStateChanged(); | 324 void OnWindowShowStateChanged(); |
| 321 | 325 |
| 326 // Called from the associated WmWindow once the window pin type changes. |
| 327 void OnWindowPinTypeChanged(); |
| 328 |
| 322 protected: | 329 protected: |
| 323 explicit WindowState(WmWindow* window); | 330 explicit WindowState(WmWindow* window); |
| 324 | 331 |
| 325 private: | 332 private: |
| 326 friend class DefaultState; | 333 friend class DefaultState; |
| 327 friend class ash::LockWindowState; | 334 friend class ash::LockWindowState; |
| 328 friend class ash::MaximizeModeWindowState; | 335 friend class ash::MaximizeModeWindowState; |
| 329 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); | 336 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); |
| 330 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, | 337 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, |
| 331 CrossFadeToBoundsFromTransform); | 338 CrossFadeToBoundsFromTransform); |
| 332 | 339 |
| 333 WindowStateDelegate* delegate() { return delegate_.get(); } | 340 WindowStateDelegate* delegate() { return delegate_.get(); } |
| 334 | 341 |
| 335 // Returns the window's current always_on_top state. | 342 // Returns the window's current always_on_top state. |
| 336 bool GetAlwaysOnTop() const; | 343 bool GetAlwaysOnTop() const; |
| 337 | 344 |
| 338 // Returns the window's current show state. | 345 // Returns the window's current show state. |
| 339 ui::WindowShowState GetShowState() const; | 346 ui::WindowShowState GetShowState() const; |
| 340 | 347 |
| 348 // Return the window's current pin type. |
| 349 ash::mojom::WindowPinType GetPinType() const; |
| 350 |
| 341 // Sets the window's bounds in screen coordinates. | 351 // Sets the window's bounds in screen coordinates. |
| 342 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen); | 352 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen); |
| 343 | 353 |
| 344 // Adjusts the |bounds| so that they are flush with the edge of the | 354 // Adjusts the |bounds| so that they are flush with the edge of the |
| 345 // workspace if the window represented by |window_state| is side snapped. | 355 // workspace if the window represented by |window_state| is side snapped. |
| 346 void AdjustSnappedBounds(gfx::Rect* bounds); | 356 void AdjustSnappedBounds(gfx::Rect* bounds); |
| 347 | 357 |
| 348 // Updates the window show state according to the current window state type. | 358 // Updates the window properties(show state, pin type) according to the |
| 359 // current window state type. |
| 349 // Note that this does not update the window bounds. | 360 // Note that this does not update the window bounds. |
| 350 void UpdateWindowShowStateFromStateType(); | 361 void UpdateWindowPropertiesFromStateType(); |
| 351 | 362 |
| 352 void NotifyPreStateTypeChange(WindowStateType old_window_state_type); | 363 void NotifyPreStateTypeChange(WindowStateType old_window_state_type); |
| 353 void NotifyPostStateTypeChange(WindowStateType old_window_state_type); | 364 void NotifyPostStateTypeChange(WindowStateType old_window_state_type); |
| 354 | 365 |
| 355 // Sets |bounds| as is and ensure the layer is aligned with pixel boundary. | 366 // Sets |bounds| as is and ensure the layer is aligned with pixel boundary. |
| 356 void SetBoundsDirect(const gfx::Rect& bounds); | 367 void SetBoundsDirect(const gfx::Rect& bounds); |
| 357 | 368 |
| 358 // Sets the window's |bounds| with constraint where the size of the | 369 // Sets the window's |bounds| with constraint where the size of the |
| 359 // new bounds will not exceeds the size of the work area. | 370 // new bounds will not exceeds the size of the work area. |
| 360 void SetBoundsConstrained(const gfx::Rect& bounds); | 371 void SetBoundsConstrained(const gfx::Rect& bounds); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 411 |
| 401 std::unique_ptr<State> current_state_; | 412 std::unique_ptr<State> current_state_; |
| 402 | 413 |
| 403 DISALLOW_COPY_AND_ASSIGN(WindowState); | 414 DISALLOW_COPY_AND_ASSIGN(WindowState); |
| 404 }; | 415 }; |
| 405 | 416 |
| 406 } // namespace wm | 417 } // namespace wm |
| 407 } // namespace ash | 418 } // namespace ash |
| 408 | 419 |
| 409 #endif // ASH_COMMON_WM_WINDOW_STATE_H_ | 420 #endif // ASH_COMMON_WM_WINDOW_STATE_H_ |
| OLD | NEW |