Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: ash/wm/overview/scoped_transform_overview_window.h

Issue 810033010: Remove TransparentActivateWindowButton from Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ 5 #ifndef ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
6 #define ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ 6 #define ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
7 7
8 #include "ash/wm/overview/scoped_overview_animation_settings.h" 8 #include "ash/wm/overview/scoped_overview_animation_settings.h"
9 #include "ash/wm/overview/transparent_activate_window_button.h"
10 #include "ash/wm/overview/transparent_activate_window_button_delegate.h"
11 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
14 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/transform.h" 13 #include "ui/gfx/transform.h"
16 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
17 15
18 namespace aura { 16 namespace aura {
19 class Window; 17 class Window;
20 } 18 }
21 19
22 namespace ui { 20 namespace ui {
23 class Layer; 21 class Layer;
24 } 22 }
25 23
26 namespace views { 24 namespace views {
27 class Widget; 25 class Widget;
28 } 26 }
29 27
30 namespace ash { 28 namespace ash {
31 29
32 class ScopedWindowCopy; 30 class ScopedWindowCopy;
33 31
34 // Manages a window, and it's transient children, in the overview mode. This 32 // Manages a window, and it's transient children, in the overview mode. This
35 // class allows transforming the windows with a helper to determine the best 33 // class allows transforming the windows with a helper to determine the best
36 // fit in certain bounds. The window's state is restored on destruction of this 34 // fit in certain bounds. The window's state is restored on destruction of this
37 // object. 35 // object.
38 class ScopedTransformOverviewWindow 36 class ScopedTransformOverviewWindow {
39 : public TransparentActivateWindowButtonDelegate {
40 public: 37 public:
41 typedef ScopedVector<ScopedOverviewAnimationSettings> ScopedAnimationSettings; 38 typedef ScopedVector<ScopedOverviewAnimationSettings> ScopedAnimationSettings;
42 39
43 // Returns |rect| having been shrunk to fit within |bounds| (preserving the 40 // Returns |rect| having been shrunk to fit within |bounds| (preserving the
44 // aspect ratio). 41 // aspect ratio).
45 static gfx::Rect ShrinkRectToFitPreservingAspectRatio( 42 static gfx::Rect ShrinkRectToFitPreservingAspectRatio(
46 const gfx::Rect& rect, 43 const gfx::Rect& rect,
47 const gfx::Rect& bounds); 44 const gfx::Rect& bounds);
48 45
49 // Returns the transform turning |src_rect| into |dst_rect|. 46 // Returns the transform turning |src_rect| into |dst_rect|.
50 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect, 47 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect,
51 const gfx::Rect& dst_rect); 48 const gfx::Rect& dst_rect);
52 49
53 explicit ScopedTransformOverviewWindow(aura::Window* window); 50 explicit ScopedTransformOverviewWindow(aura::Window* window);
54 ~ScopedTransformOverviewWindow() override; 51 ~ScopedTransformOverviewWindow();
55 52
56 gfx::Transform get_overview_transform() const { return overview_transform_; } 53 gfx::Transform get_overview_transform() const { return overview_transform_; }
57 54
58 void set_overview_transform(const gfx::Transform& transform) { 55 void set_overview_transform(const gfx::Transform& transform) {
59 overview_transform_ = transform; 56 overview_transform_ = transform;
60 } 57 }
61 58
62 TransparentActivateWindowButton* activate_button() {
63 return activate_button_.get();
64 }
65
66
67 // Starts an animation sequence which will use animation settings specified by 59 // Starts an animation sequence which will use animation settings specified by
68 // |animation_type|. The |animation_settings| container is populated with 60 // |animation_type|. The |animation_settings| container is populated with
69 // scoped entities and the container should be destroyed at the end of the 61 // scoped entities and the container should be destroyed at the end of the
70 // animation sequence. 62 // animation sequence.
71 // 63 //
72 // Example: 64 // Example:
73 // ScopedTransformOverviewWindow overview_window(window); 65 // ScopedTransformOverviewWindow overview_window(window);
74 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings; 66 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings;
75 // overview_window.BeginScopedAnimation( 67 // overview_window.BeginScopedAnimation(
76 // OverviewAnimationType::OVERVIEW_ANIMATION_SELECTOR_ITEM_SCROLL_CANCEL, 68 // OverviewAnimationType::OVERVIEW_ANIMATION_SELECTOR_ITEM_SCROLL_CANCEL,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 const gfx::Transform& transform); 102 const gfx::Transform& transform);
111 103
112 // Set's the opacity of the managed windows. 104 // Set's the opacity of the managed windows.
113 void SetOpacity(float opacity); 105 void SetOpacity(float opacity);
114 106
115 aura::Window* window() const { return window_; } 107 aura::Window* window() const { return window_; }
116 108
117 // Closes the transient root of the window managed by |this|. 109 // Closes the transient root of the window managed by |this|.
118 void Close(); 110 void Close();
119 111
120 // ash::TransparentActivateWindowButtonDelegate:
121 void Select() override;
122
123 private: 112 private:
124 // A weak pointer to the real window in the overview. 113 // A weak pointer to the real window in the overview.
125 aura::Window* window_; 114 aura::Window* window_;
126 115
127 // The transparent overlay that captures events.
128 scoped_ptr<TransparentActivateWindowButton> activate_button_;
129
130 // If true, the window was minimized and should be restored if the window 116 // If true, the window was minimized and should be restored if the window
131 // was not selected. 117 // was not selected.
132 bool minimized_; 118 bool minimized_;
133 119
134 // Tracks if this window was ignored by the shelf. 120 // Tracks if this window was ignored by the shelf.
135 bool ignored_by_shelf_; 121 bool ignored_by_shelf_;
136 122
137 // True if the window has been transformed for overview mode. 123 // True if the window has been transformed for overview mode.
138 bool overview_started_; 124 bool overview_started_;
139 125
140 // The original transform of the window before entering overview mode. 126 // The original transform of the window before entering overview mode.
141 gfx::Transform original_transform_; 127 gfx::Transform original_transform_;
142 128
143 // Keeps track of the original transform used when |this| has been positioned 129 // Keeps track of the original transform used when |this| has been positioned
144 // during SelectorItem layout. 130 // during SelectorItem layout.
145 gfx::Transform overview_transform_; 131 gfx::Transform overview_transform_;
146 132
147 // The original opacity of the window before entering overview mode. 133 // The original opacity of the window before entering overview mode.
148 float original_opacity_; 134 float original_opacity_;
149 135
150 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); 136 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow);
151 }; 137 };
152 138
153 } // namespace ash 139 } // namespace ash
154 140
155 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ 141 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698