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