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.
4
5#ifndef ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
6#define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
7
8#include "ash/ash_export.h"
9#include "base/basictypes.h"
10#include "base/memory/scoped_ptr.h"
11#include "ui/gfx/rect.h"
12
13namespace aura {
14class Window;
15}
16
17namespace views {
18class Widget;
19}
20
21namespace ash {
22
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.
26class ASH_EXPORT PhantomWindowController {
27 public:
28  explicit PhantomWindowController(aura::Window* window);
29
30  // Hides the phantom window without any animation.
31  virtual ~PhantomWindowController();
32
33  // Shows the phantom window and animates shrinking it to |bounds_in_screen|.
34  void Show(const gfx::Rect& bounds_in_screen);
35
36 private:
37  friend class PhantomWindowControllerTest;
38
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);
44
45  // Window that the phantom window is stacked above.
46  aura::Window* window_;
47
48  // Target bounds (including the shadows if any) of the animation in screen
49  // coordinates.
50  gfx::Rect target_bounds_in_screen_;
51
52  // Phantom representation of the window.
53  scoped_ptr<views::Widget> phantom_widget_;
54
55  DISALLOW_COPY_AND_ASSIGN(PhantomWindowController);
56};
57
58}  // namespace ash
59
60#endif  // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
61