| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ |
| 6 #define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ | 6 #define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_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 "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 | 13 |
| 14 namespace aura { | |
| 15 class Window; | |
| 16 } | |
| 17 | |
| 18 namespace views { | 14 namespace views { |
| 19 class Widget; | 15 class Widget; |
| 20 } | 16 } |
| 21 | 17 |
| 22 namespace ash { | 18 namespace ash { |
| 19 namespace wm { |
| 20 class WmWindow; |
| 21 } |
| 23 | 22 |
| 24 // PhantomWindowController is responsible for showing a phantom representation | 23 // PhantomWindowController is responsible for showing a phantom representation |
| 25 // of a window. It's used to show a preview of how snapping or docking a window | 24 // of a window. It's used to show a preview of how snapping or docking a window |
| 26 // will affect the window's bounds. | 25 // will affect the window's bounds. |
| 27 class ASH_EXPORT PhantomWindowController { | 26 class ASH_EXPORT PhantomWindowController { |
| 28 public: | 27 public: |
| 29 explicit PhantomWindowController(aura::Window* window); | 28 explicit PhantomWindowController(wm::WmWindow* window); |
| 30 | 29 |
| 31 // Hides the phantom window without any animation. | 30 // Hides the phantom window without any animation. |
| 32 virtual ~PhantomWindowController(); | 31 ~PhantomWindowController(); |
| 33 | 32 |
| 34 // Shows the phantom window and animates shrinking it to |bounds_in_screen|. | 33 // Shows the phantom window and animates shrinking it to |bounds_in_screen|. |
| 35 void Show(const gfx::Rect& bounds_in_screen); | 34 void Show(const gfx::Rect& bounds_in_screen); |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 friend class PhantomWindowControllerTest; | |
| 39 | |
| 40 // Creates, shows and returns a phantom widget at |bounds| | 37 // Creates, shows and returns a phantom widget at |bounds| |
| 41 // with kShellWindowId_ShelfContainer in |root_window| as a parent. | 38 // with kShellWindowId_ShelfContainer in |root_window| as a parent. |
| 42 std::unique_ptr<views::Widget> CreatePhantomWidget( | 39 std::unique_ptr<views::Widget> CreatePhantomWidget( |
| 43 aura::Window* root_window, | 40 wm::WmWindow* root_window, |
| 44 const gfx::Rect& bounds_in_screen); | 41 const gfx::Rect& bounds_in_screen); |
| 45 | 42 |
| 46 // Window that the phantom window is stacked above. | 43 // Window that the phantom window is stacked above. |
| 47 aura::Window* window_; | 44 wm::WmWindow* window_; |
| 48 | 45 |
| 49 // Target bounds (including the shadows if any) of the animation in screen | 46 // Target bounds (including the shadows if any) of the animation in screen |
| 50 // coordinates. | 47 // coordinates. |
| 51 gfx::Rect target_bounds_in_screen_; | 48 gfx::Rect target_bounds_in_screen_; |
| 52 | 49 |
| 53 // Phantom representation of the window. | 50 // Phantom representation of the window. |
| 54 std::unique_ptr<views::Widget> phantom_widget_; | 51 std::unique_ptr<views::Widget> phantom_widget_; |
| 55 | 52 |
| 56 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); | 53 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 } // namespace ash | 56 } // namespace ash |
| 60 | 57 |
| 61 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ | 58 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ |
| OLD | NEW |