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_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | |
| 6 #define ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_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 allows transforming the | |
| 28 // window with a helper to determine the best fit in certain bounds and | |
| 29 // copies the window if being moved to another display. The window's state is | |
| 30 // restored on destruction of this object. | |
| 31 class ScopedTransformOverviewWindow { | |
| 32 public: | |
| 33 // The duration of transitions used for window transforms. | |
| 34 static const int kTransitionMilliseconds; | |
| 35 | |
| 36 // Returns the transform necessary to fit |rect| into |bounds| preserving | |
| 37 // aspect ratio and centering. | |
| 38 static gfx::Transform GetTransformForRectPreservingAspectRatio( | |
| 39 const gfx::Rect& rect, const gfx::Rect& bounds); | |
|
sky
2013/09/13 21:46:44
nit: one param per line when you wrap.
flackr
2013/09/13 22:28:38
Done.
| |
| 40 | |
| 41 explicit ScopedTransformOverviewWindow(aura::Window* window); | |
| 42 virtual ~ScopedTransformOverviewWindow(); | |
| 43 | |
| 44 // Returns true if this window selector window contains the |target|. This is | |
| 45 // used to determine if an event targetted this window. | |
| 46 bool Contains(const aura::Window* target) const; | |
| 47 | |
| 48 // Restores the window if it was minimized. | |
| 49 void RestoreWindow(); | |
| 50 | |
| 51 // Restores this window on exit rather than returning it to a minimized state | |
| 52 // if it was minimized on entering overview mode. | |
| 53 void RestoreWindowOnExit(); | |
| 54 | |
| 55 // Informs the ScopedTransformOverviewWindow that the window being watched was | |
| 56 // destroyed. This resets the internal window pointer to avoid calling | |
| 57 // anything on the window at destruction time. | |
| 58 void OnWindowDestroyed(); | |
| 59 | |
| 60 // Sets |transform| on the window and a copy of the window if the target | |
| 61 // |root_window| is not the window's root window. | |
| 62 void SetTransform(aura::RootWindow* root_window, | |
| 63 const gfx::Transform& transform); | |
| 64 | |
| 65 aura::Window* window() const { return window_; } | |
| 66 | |
| 67 protected: | |
| 68 // Dispatched when the overview of this window has started. | |
| 69 virtual void OnOverviewStarted(); | |
| 70 | |
| 71 private: | |
| 72 // A weak pointer to the real window in the overview. | |
| 73 aura::Window* window_; | |
| 74 | |
| 75 // A copy of the window used to transition the window to another root. | |
| 76 views::Widget* window_copy_; | |
| 77 | |
| 78 // A weak pointer to a deep copy of the window's layers. | |
| 79 ui::Layer* layer_; | |
| 80 | |
| 81 // If true, the window was minimized and should be restored if the window | |
| 82 // was not selected. | |
| 83 bool minimized_; | |
| 84 | |
| 85 // True if the window has been transformed for overview mode. | |
| 86 bool overview_started_; | |
| 87 | |
| 88 // The original transform of the window before entering overview mode. | |
| 89 gfx::Transform original_transform_; | |
| 90 | |
| 91 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); | |
| 92 }; | |
| 93 | |
| 94 } // namespace ash | |
| 95 | |
| 96 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | |
| OLD | NEW |