| 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" |
| 11 #include "ash/common/wm/drag_details.h" | 11 #include "ash/common/wm/drag_details.h" |
| 12 #include "ash/common/wm/wm_types.h" | 12 #include "ash/common/wm/wm_types.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 class Window; | 19 class Window; |
| 20 namespace client { |
| 21 enum class WindowPinType; |
| 22 } |
| 20 } | 23 } |
| 21 | 24 |
| 22 namespace gfx { | 25 namespace gfx { |
| 23 class Rect; | 26 class Rect; |
| 24 } | 27 } |
| 25 | 28 |
| 26 namespace ash { | 29 namespace ash { |
| 27 class LockWindowState; | 30 class LockWindowState; |
| 28 class MaximizeModeWindowState; | 31 class MaximizeModeWindowState; |
| 29 class WmWindow; | 32 class WmWindow; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // Sets the currently stored restore bounds and clears the restore bounds. | 315 // Sets the currently stored restore bounds and clears the restore bounds. |
| 313 void SetAndClearRestoreBounds(); | 316 void SetAndClearRestoreBounds(); |
| 314 | 317 |
| 315 // Returns a pointer to DragDetails during drag operations. | 318 // Returns a pointer to DragDetails during drag operations. |
| 316 const DragDetails* drag_details() const { return drag_details_.get(); } | 319 const DragDetails* drag_details() const { return drag_details_.get(); } |
| 317 DragDetails* drag_details() { return drag_details_.get(); } | 320 DragDetails* drag_details() { return drag_details_.get(); } |
| 318 | 321 |
| 319 // Called from the associated WmWindow once the show state changes. | 322 // Called from the associated WmWindow once the show state changes. |
| 320 void OnWindowShowStateChanged(); | 323 void OnWindowShowStateChanged(); |
| 321 | 324 |
| 325 // Called from the associated WmWindow once the window pin type changes. |
| 326 void OnWindowPinTypeChanged(); |
| 327 |
| 322 protected: | 328 protected: |
| 323 explicit WindowState(WmWindow* window); | 329 explicit WindowState(WmWindow* window); |
| 324 | 330 |
| 325 private: | 331 private: |
| 326 friend class DefaultState; | 332 friend class DefaultState; |
| 327 friend class ash::LockWindowState; | 333 friend class ash::LockWindowState; |
| 328 friend class ash::MaximizeModeWindowState; | 334 friend class ash::MaximizeModeWindowState; |
| 329 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); | 335 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); |
| 330 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, | 336 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, |
| 331 CrossFadeToBoundsFromTransform); | 337 CrossFadeToBoundsFromTransform); |
| 332 | 338 |
| 333 WindowStateDelegate* delegate() { return delegate_.get(); } | 339 WindowStateDelegate* delegate() { return delegate_.get(); } |
| 334 | 340 |
| 335 // Returns the window's current always_on_top state. | 341 // Returns the window's current always_on_top state. |
| 336 bool GetAlwaysOnTop() const; | 342 bool GetAlwaysOnTop() const; |
| 337 | 343 |
| 338 // Returns the window's current show state. | 344 // Returns the window's current show state. |
| 339 ui::WindowShowState GetShowState() const; | 345 ui::WindowShowState GetShowState() const; |
| 340 | 346 |
| 341 // Sets the window's bounds in screen coordinates. | 347 // Sets the window's bounds in screen coordinates. |
| 342 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen); | 348 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen); |
| 343 | 349 |
| 344 // Adjusts the |bounds| so that they are flush with the edge of the | 350 // 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. | 351 // workspace if the window represented by |window_state| is side snapped. |
| 346 void AdjustSnappedBounds(gfx::Rect* bounds); | 352 void AdjustSnappedBounds(gfx::Rect* bounds); |
| 347 | 353 |
| 348 // Updates the window show state according to the current window state type. | 354 // Updates the window properties(show state, pin type) according to the |
| 355 // current window state type. |
| 349 // Note that this does not update the window bounds. | 356 // Note that this does not update the window bounds. |
| 350 void UpdateWindowShowStateFromStateType(); | 357 void UpdateWindowPropertiesFromStateType(); |
| 351 | 358 |
| 352 void NotifyPreStateTypeChange(WindowStateType old_window_state_type); | 359 void NotifyPreStateTypeChange(WindowStateType old_window_state_type); |
| 353 void NotifyPostStateTypeChange(WindowStateType old_window_state_type); | 360 void NotifyPostStateTypeChange(WindowStateType old_window_state_type); |
| 354 | 361 |
| 355 // Sets |bounds| as is and ensure the layer is aligned with pixel boundary. | 362 // Sets |bounds| as is and ensure the layer is aligned with pixel boundary. |
| 356 void SetBoundsDirect(const gfx::Rect& bounds); | 363 void SetBoundsDirect(const gfx::Rect& bounds); |
| 357 | 364 |
| 358 // Sets the window's |bounds| with constraint where the size of the | 365 // Sets the window's |bounds| with constraint where the size of the |
| 359 // new bounds will not exceeds the size of the work area. | 366 // new bounds will not exceeds the size of the work area. |
| 360 void SetBoundsConstrained(const gfx::Rect& bounds); | 367 void SetBoundsConstrained(const gfx::Rect& bounds); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 407 |
| 401 std::unique_ptr<State> current_state_; | 408 std::unique_ptr<State> current_state_; |
| 402 | 409 |
| 403 DISALLOW_COPY_AND_ASSIGN(WindowState); | 410 DISALLOW_COPY_AND_ASSIGN(WindowState); |
| 404 }; | 411 }; |
| 405 | 412 |
| 406 } // namespace wm | 413 } // namespace wm |
| 407 } // namespace ash | 414 } // namespace ash |
| 408 | 415 |
| 409 #endif // ASH_COMMON_WM_WINDOW_STATE_H_ | 416 #endif // ASH_COMMON_WM_WINDOW_STATE_H_ |
| OLD | NEW |