Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ | |
| 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "ui/gfx/rect.h" | |
| 10 #include "ui/gfx/transform.h" | |
| 11 | |
| 12 namespace aura { | |
| 13 class RootWindow; | |
| 14 class Window; | |
| 15 } | |
| 16 | |
| 17 namespace ui { | |
| 18 class Layer; | |
| 19 } | |
| 20 | |
| 21 namespace views { | |
| 22 class Widget; | |
| 23 } | |
| 24 | |
| 25 namespace ash { | |
| 26 | |
| 27 // Manages a window in the overview mode. This class transitions the window | |
| 28 // to the best fit within the available overview rectangle, copying it if the | |
| 29 // window is sent to another display and restores the window state on | |
| 30 // deletion. | |
| 31 class WindowSelectorWindow { | |
| 32 public: | |
| 33 explicit WindowSelectorWindow(aura::Window* window); | |
| 34 virtual ~WindowSelectorWindow(); | |
| 35 | |
| 36 aura::Window* window() { return window_; } | |
| 37 const aura::Window* window() const { return window_; } | |
| 38 | |
| 39 // Returns true if this window selector window contains the |target|. This is | |
| 40 // used to determine if an event targetted this window. | |
| 41 bool Contains(const aura::Window* target) const; | |
| 42 | |
| 43 // Restores this window on exit rather than returning it to a minimized state | |
| 44 // if it was minimized on entering overview mode. | |
| 45 void RestoreWindowOnExit(); | |
| 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 gfx::Rect bounds() { return fit_bounds_; } | |
|
sky
2013/08/22 17:01:14
const gfx::Rect&
flackr
2013/08/22 17:21:24
Done.
| |
| 58 | |
| 59 private: | |
| 60 // A weak pointer to the real window in the overview. | |
| 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 | |
| 79 DISALLOW_COPY_AND_ASSIGN(WindowSelectorWindow); | |
| 80 }; | |
| 81 | |
| 82 } // namespace ash | |
| 83 | |
| 84 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_WINDOW_H_ | |
| OLD | NEW |