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

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: Fixed latest nits 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 // Starts an animation sequence which will use animation settings specified by 59 // Starts an animation sequence which will use animation settings specified by
67 // |animation_type|. The |animation_settings| container is populated with 60 // |animation_type|. The |animation_settings| container is populated with
68 // 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
69 // animation sequence. 62 // animation sequence.
70 // 63 //
71 // Example: 64 // Example:
72 // ScopedTransformOverviewWindow overview_window(window); 65 // ScopedTransformOverviewWindow overview_window(window);
73 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings; 66 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings;
74 // overview_window.BeginScopedAnimation( 67 // overview_window.BeginScopedAnimation(
75 // OverviewAnimationType::OVERVIEW_ANIMATION_SELECTOR_ITEM_SCROLL_CANCEL, 68 // OverviewAnimationType::OVERVIEW_ANIMATION_SELECTOR_ITEM_SCROLL_CANCEL,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const gfx::Transform& transform); 101 const gfx::Transform& transform);
109 102
110 // Set's the opacity of the managed windows. 103 // Set's the opacity of the managed windows.
111 void SetOpacity(float opacity); 104 void SetOpacity(float opacity);
112 105
113 aura::Window* window() const { return window_; } 106 aura::Window* window() const { return window_; }
114 107
115 // Closes the transient root of the window managed by |this|. 108 // Closes the transient root of the window managed by |this|.
116 void Close(); 109 void Close();
117 110
118 // ash::TransparentActivateWindowButtonDelegate:
119 void Select() override;
120
121 private: 111 private:
122 // Shows the window if it was minimized. 112 // Shows the window if it was minimized.
123 void ShowWindowIfMinimized(); 113 void ShowWindowIfMinimized();
124 114
125 // A weak pointer to the real window in the overview. 115 // A weak pointer to the real window in the overview.
126 aura::Window* window_; 116 aura::Window* window_;
127 117
128 // The transparent overlay that captures events.
129 scoped_ptr<TransparentActivateWindowButton> activate_button_;
130
131 // If true, the window was minimized and should be restored if the window 118 // If true, the window was minimized and should be restored if the window
132 // was not selected. 119 // was not selected.
133 bool minimized_; 120 bool minimized_;
134 121
135 // Tracks if this window was ignored by the shelf. 122 // Tracks if this window was ignored by the shelf.
136 bool ignored_by_shelf_; 123 bool ignored_by_shelf_;
137 124
138 // True if the window has been transformed for overview mode. 125 // True if the window has been transformed for overview mode.
139 bool overview_started_; 126 bool overview_started_;
140 127
141 // The original transform of the window before entering overview mode. 128 // The original transform of the window before entering overview mode.
142 gfx::Transform original_transform_; 129 gfx::Transform original_transform_;
143 130
144 // Keeps track of the original transform used when |this| has been positioned 131 // Keeps track of the original transform used when |this| has been positioned
145 // during SelectorItem layout. 132 // during SelectorItem layout.
146 gfx::Transform overview_transform_; 133 gfx::Transform overview_transform_;
147 134
148 // The original opacity of the window before entering overview mode. 135 // The original opacity of the window before entering overview mode.
149 float original_opacity_; 136 float original_opacity_;
150 137
151 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); 138 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow);
152 }; 139 };
153 140
154 } // namespace ash 141 } // namespace ash
155 142
156 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ 143 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698