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