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
3 // found in the LICENSE file.
5 #ifndef ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
6 #define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/gfx/geometry/rect.h"
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
25 // will affect the window's bounds.
26 class ASH_EXPORT PhantomWindowController
{
28 explicit PhantomWindowController(aura::Window
* window
);
30 // Hides the phantom window without any animation.
31 virtual ~PhantomWindowController();
33 // Shows the phantom window and animates shrinking it to |bounds_in_screen|.
34 void Show(const gfx::Rect
& bounds_in_screen
);
37 friend class PhantomWindowControllerTest
;
39 // Creates, shows and returns a phantom widget at |bounds|
40 // with kShellWindowId_ShelfContainer in |root_window| as a parent.
41 scoped_ptr
<views::Widget
> CreatePhantomWidget(
42 aura::Window
* root_window
,
43 const gfx::Rect
& bounds_in_screen
);
45 // Window that the phantom window is stacked above.
46 aura::Window
* window_
;
48 // Target bounds (including the shadows if any) of the animation in screen
50 gfx::Rect target_bounds_in_screen_
;
52 // Phantom representation of the window.
53 scoped_ptr
<views::Widget
> phantom_widget_
;
55 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController
);
60 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_