| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // Sets the currently stored restore bounds and clears the restore bounds. | 303 // Sets the currently stored restore bounds and clears the restore bounds. |
| 301 void SetAndClearRestoreBounds(); | 304 void SetAndClearRestoreBounds(); |
| 302 | 305 |
| 303 // Returns a pointer to DragDetails during drag operations. | 306 // Returns a pointer to DragDetails during drag operations. |
| 304 const DragDetails* drag_details() const { return drag_details_.get(); } | 307 const DragDetails* drag_details() const { return drag_details_.get(); } |
| 305 DragDetails* drag_details() { return drag_details_.get(); } | 308 DragDetails* drag_details() { return drag_details_.get(); } |
| 306 | 309 |
| 307 // Called from the associated WmWindow once the show state changes. | 310 // Called from the associated WmWindow once the show state changes. |
| 308 void OnWindowShowStateChanged(); | 311 void OnWindowShowStateChanged(); |
| 309 | 312 |
| 313 // Called from the associated WmWindow once the window pin type changes. |
| 314 void OnWindowPinTypeChanged(); |
| 315 |
| 310 protected: | 316 protected: |
| 311 explicit WindowState(WmWindow* window); | 317 explicit WindowState(WmWindow* window); |
| 312 | 318 |
| 313 private: | 319 private: |
| 314 friend class DefaultState; | 320 friend class DefaultState; |
| 315 friend class ash::LockWindowState; | 321 friend class ash::LockWindowState; |
| 316 friend class ash::MaximizeModeWindowState; | 322 friend class ash::MaximizeModeWindowState; |
| 317 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); | 323 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); |
| 318 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, | 324 FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, |
| 319 CrossFadeToBoundsFromTransform); | 325 CrossFadeToBoundsFromTransform); |
| 320 | 326 |
| 321 WindowStateDelegate* delegate() { return delegate_.get(); } | 327 WindowStateDelegate* delegate() { return delegate_.get(); } |
| 322 | 328 |
| 323 // Returns the window's current always_on_top state. | 329 // Returns the window's current always_on_top state. |
| 324 bool GetAlwaysOnTop() const; | 330 bool GetAlwaysOnTop() const; |
| 325 | 331 |
| 326 // Returns the window's current show state. | 332 // Returns the window's current show state. |
| 327 ui::WindowShowState GetShowState() const; | 333 ui::WindowShowState GetShowState() const; |
| 328 | 334 |
| 329 // Sets the window's bounds in screen coordinates. | 335 // Sets the window's bounds in screen coordinates. |
| 330 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen); | 336 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen); |
| 331 | 337 |
| 332 // Adjusts the |bounds| so that they are flush with the edge of the | 338 // Adjusts the |bounds| so that they are flush with the edge of the |
| 333 // workspace if the window represented by |window_state| is side snapped. | 339 // workspace if the window represented by |window_state| is side snapped. |
| 334 void AdjustSnappedBounds(gfx::Rect* bounds); | 340 void AdjustSnappedBounds(gfx::Rect* bounds); |
| 335 | 341 |
| 336 // Updates the window show state according to the current window state type. | 342 // Updates the window properties(show state, pin type) according to the |
| 343 // current window state type. |
| 337 // Note that this does not update the window bounds. | 344 // Note that this does not update the window bounds. |
| 338 void UpdateWindowShowStateFromStateType(); | 345 void UpdateWindowPropertiesFromStateType(); |
| 339 | 346 |
| 340 void NotifyPreStateTypeChange(WindowStateType old_window_state_type); | 347 void NotifyPreStateTypeChange(WindowStateType old_window_state_type); |
| 341 void NotifyPostStateTypeChange(WindowStateType old_window_state_type); | 348 void NotifyPostStateTypeChange(WindowStateType old_window_state_type); |
| 342 | 349 |
| 343 // Sets |bounds| as is and ensure the layer is aligned with pixel boundary. | 350 // Sets |bounds| as is and ensure the layer is aligned with pixel boundary. |
| 344 void SetBoundsDirect(const gfx::Rect& bounds); | 351 void SetBoundsDirect(const gfx::Rect& bounds); |
| 345 | 352 |
| 346 // Sets the window's |bounds| with constraint where the size of the | 353 // Sets the window's |bounds| with constraint where the size of the |
| 347 // new bounds will not exceeds the size of the work area. | 354 // new bounds will not exceeds the size of the work area. |
| 348 void SetBoundsConstrained(const gfx::Rect& bounds); | 355 void SetBoundsConstrained(const gfx::Rect& bounds); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 394 |
| 388 std::unique_ptr<State> current_state_; | 395 std::unique_ptr<State> current_state_; |
| 389 | 396 |
| 390 DISALLOW_COPY_AND_ASSIGN(WindowState); | 397 DISALLOW_COPY_AND_ASSIGN(WindowState); |
| 391 }; | 398 }; |
| 392 | 399 |
| 393 } // namespace wm | 400 } // namespace wm |
| 394 } // namespace ash | 401 } // namespace ash |
| 395 | 402 |
| 396 #endif // ASH_COMMON_WM_WINDOW_STATE_H_ | 403 #endif // ASH_COMMON_WM_WINDOW_STATE_H_ |
| OLD | NEW |