OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ |
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ |
7 | 7 |
| 8 #include "ash/wm/overview/scoped_transform_overview_window.h" |
| 9 #include "ash/wm/overview/window_selector_item.h" |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/transform.h" | |
11 | 12 |
12 namespace aura { | 13 namespace aura { |
13 class RootWindow; | 14 class RootWindow; |
14 class Window; | 15 class Window; |
15 } | 16 } |
16 | 17 |
17 namespace ui { | |
18 class Layer; | |
19 } | |
20 | |
21 namespace views { | |
22 class Widget; | |
23 } | |
24 | |
25 namespace ash { | 18 namespace ash { |
26 | 19 |
27 // Manages a window in the overview mode. This class transitions the window | 20 // This implements a window overview item with a single window which can be |
28 // to the best fit within the available overview rectangle, copying it if the | 21 // selected. |
29 // window is sent to another display and restores the window state on | 22 class WindowSelectorWindow : public WindowSelectorItem { |
30 // deletion. | |
31 class WindowSelectorWindow { | |
32 public: | 23 public: |
33 explicit WindowSelectorWindow(aura::Window* window); | 24 WindowSelectorWindow(aura::Window* window); |
34 virtual ~WindowSelectorWindow(); | 25 virtual ~WindowSelectorWindow(); |
35 | 26 |
36 aura::Window* window() { return window_; } | 27 // WindowSelectorItem: |
37 const aura::Window* window() const { return window_; } | 28 virtual const aura::RootWindow* GetRootWindow() const OVERRIDE; |
38 | 29 virtual aura::Window* TargetedWindow( |
39 // Returns true if this window selector window contains the |target|. This is | 30 const aura::Window* target) const OVERRIDE; |
40 // used to determine if an event targetted this window. | 31 virtual void RestoreWindowOnExit(aura::Window* window) OVERRIDE; |
41 bool Contains(const aura::Window* target) const; | 32 virtual aura::Window* SelectionWindow() const OVERRIDE; |
42 | 33 virtual void RemoveWindow(const aura::Window* window) OVERRIDE; |
43 // Restores this window on exit rather than returning it to a minimized state | 34 virtual bool empty() const OVERRIDE; |
44 // if it was minimized on entering overview mode. | 35 virtual void SetItemBounds(aura::RootWindow* root_window, |
45 void RestoreWindowOnExit(); | 36 const gfx::Rect& target_bounds) OVERRIDE; |
46 | |
47 // Informs the WindowSelectorWindow that the window being watched was | |
48 // destroyed. This resets the internal window pointer to avoid calling | |
49 // anything on the window at destruction time. | |
50 void OnWindowDestroyed(); | |
51 | |
52 // Applies a transform to the window to fit within |target_bounds| while | |
53 // maintaining its aspect ratio. | |
54 void TransformToFitBounds(aura::RootWindow* root_window, | |
55 const gfx::Rect& target_bounds); | |
56 | |
57 const gfx::Rect& bounds() { return fit_bounds_; } | |
58 | 37 |
59 private: | 38 private: |
60 // A weak pointer to the real window in the overview. | 39 ScopedTransformOverviewWindow transform_window_; |
61 aura::Window* window_; | |
62 | |
63 // A copy of the window used to transition the window to another root. | |
64 views::Widget* window_copy_; | |
65 | |
66 // A weak pointer to a deep copy of the window's layers. | |
67 ui::Layer* layer_; | |
68 | |
69 // If true, the window was minimized and should be restored if the window | |
70 // was not selected. | |
71 bool minimized_; | |
72 | |
73 // The original transform of the window before entering overview mode. | |
74 gfx::Transform original_transform_; | |
75 | |
76 // The bounds this window is fit to. | |
77 gfx::Rect fit_bounds_; | |
78 | 40 |
79 DISALLOW_COPY_AND_ASSIGN(WindowSelectorWindow); | 41 DISALLOW_COPY_AND_ASSIGN(WindowSelectorWindow); |
80 }; | 42 }; |
81 | 43 |
82 } // namespace ash | 44 } // namespace ash |
83 | 45 |
84 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ | 46 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ |
OLD | NEW |