| 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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // PhantomWindowController is responsible for showing a phantom representation | 23 // 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 | 24 // of a window. It's used to show a preview of how snapping or docking a window |
| 25 // will affect the window's bounds. | 25 // will affect the window's bounds. |
| 26 class ASH_EXPORT PhantomWindowController { | 26 class ASH_EXPORT PhantomWindowController { |
| 27 public: | 27 public: |
| 28 explicit PhantomWindowController(aura::Window* window); | 28 explicit PhantomWindowController(aura::Window* window); |
| 29 | 29 |
| 30 // Hides the phantom window without any animation. | 30 // Hides the phantom window without any animation. |
| 31 virtual ~PhantomWindowController(); | 31 virtual ~PhantomWindowController(); |
| 32 | 32 |
| 33 // Animates the phantom window towards |bounds_in_screen|. The animation used | 33 // Shows the phantom window and animates shrinking it to |bounds_in_screen|. |
| 34 // depends on whether the alternate caption button style is used. | |
| 35 void Show(const gfx::Rect& bounds_in_screen); | 34 void Show(const gfx::Rect& bounds_in_screen); |
| 36 | 35 |
| 37 // If set, the phantom window is stacked below this window, otherwise it | |
| 38 // is stacked above the window passed to the constructor. | |
| 39 void set_phantom_below_window(aura::Window* phantom_below_window) { | |
| 40 phantom_below_window_ = phantom_below_window; | |
| 41 } | |
| 42 | |
| 43 private: | 36 private: |
| 44 friend class PhantomWindowControllerTest; | 37 friend class PhantomWindowControllerTest; |
| 45 | 38 |
| 46 // Animates the phantom window towards |bounds_in_screen| when the alternate | |
| 47 // caption button style is used. | |
| 48 void ShowAlternate(const gfx::Rect& bounds_in_screen); | |
| 49 | |
| 50 // Animates the phantom window towards |bounds_in_screen| when the legacy | |
| 51 // caption button style is used. | |
| 52 void ShowLegacy(const gfx::Rect& bounds_in_screen); | |
| 53 | |
| 54 // Creates, shows and returns a phantom widget at |bounds| | 39 // Creates, shows and returns a phantom widget at |bounds| |
| 55 // with kShellWindowId_ShelfContainer in |root_window| as a parent. | 40 // with kShellWindowId_ShelfContainer in |root_window| as a parent. |
| 56 scoped_ptr<views::Widget> CreatePhantomWidget( | 41 scoped_ptr<views::Widget> CreatePhantomWidget( |
| 57 aura::Window* root_window, | 42 aura::Window* root_window, |
| 58 const gfx::Rect& bounds_in_screen); | 43 const gfx::Rect& bounds_in_screen); |
| 59 | 44 |
| 60 // Window the phantom is placed beneath. | 45 // Window that the phantom window is stacked above. |
| 61 aura::Window* window_; | 46 aura::Window* window_; |
| 62 | 47 |
| 63 // If set, the phantom window should get stacked below this window. | |
| 64 aura::Window* phantom_below_window_; | |
| 65 | |
| 66 // Target bounds (including the shadows if any) of the animation in screen | 48 // Target bounds (including the shadows if any) of the animation in screen |
| 67 // coordinates. | 49 // coordinates. |
| 68 gfx::Rect target_bounds_in_screen_; | 50 gfx::Rect target_bounds_in_screen_; |
| 69 | 51 |
| 70 // Phantom representation of the window which is in the root window matching | 52 // Phantom representation of the window. |
| 71 // |target_bounds_in_screen_|. | 53 scoped_ptr<views::Widget> phantom_widget_; |
| 72 scoped_ptr<views::Widget> phantom_widget_in_target_root_; | |
| 73 | |
| 74 // Phantom representation of the window which is in the root window matching | |
| 75 // the window's initial bounds. This allows animations to progress from one | |
| 76 // display to the other. NULL if the phantom window starts and ends in the | |
| 77 // same root window. Not used when using the alternate caption button style. | |
| 78 scoped_ptr<views::Widget> phantom_widget_in_start_root_; | |
| 79 | 54 |
| 80 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); | 55 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); |
| 81 }; | 56 }; |
| 82 | 57 |
| 83 } // namespace ash | 58 } // namespace ash |
| 84 | 59 |
| 85 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ | 60 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ |
| OLD | NEW |