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

Side by Side Diff: ash/common/wm/overview/window_selector_item.h

Issue 2239233002: [ash-md] Fades overview header in and out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Fades overview header in and out (rebase) Created 4 years, 3 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_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 5 #ifndef ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void RecomputeWindowTransforms(); 106 void RecomputeWindowTransforms();
107 107
108 // Sends an accessibility event indicating that this window became selected 108 // Sends an accessibility event indicating that this window became selected
109 // so that it's highlighted and announced if accessibility features are 109 // so that it's highlighted and announced if accessibility features are
110 // enabled. 110 // enabled.
111 void SendAccessibleSelectionEvent(); 111 void SendAccessibleSelectionEvent();
112 112
113 // Closes |transform_window_|. 113 // Closes |transform_window_|.
114 void CloseWindow(); 114 void CloseWindow();
115 115
116 // Hides the original window header and sets shape or mask on a window.
117 // When masks are used, rounded corner |radius| can be specified.
118 // TODO(varkha): remove |radius|.
119 void HideHeaderAndSetShape(int radius);
120
116 // Sets if the item is dimmed in the overview. Changing the value will also 121 // Sets if the item is dimmed in the overview. Changing the value will also
117 // change the visibility of the transform windows. 122 // change the visibility of the transform windows.
118 void SetDimmed(bool dimmed); 123 void SetDimmed(bool dimmed);
119 bool dimmed() const { return dimmed_; } 124 bool dimmed() const { return dimmed_; }
120 125
121 const gfx::Rect& target_bounds() const { return target_bounds_; } 126 const gfx::Rect& target_bounds() const { return target_bounds_; }
122 static void set_use_mask(bool use_mask) { use_mask_ = use_mask; } 127 static void set_use_mask(bool use_mask) { use_mask_ = use_mask; }
123 static void set_use_shape(bool use_shape) { use_shape_ = use_shape; } 128 static void set_use_shape(bool use_shape) { use_shape_ = use_shape; }
124 129
125 // views::ButtonListener: 130 // views::ButtonListener:
126 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 131 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
127 132
128 // WmWindowObserver: 133 // WmWindowObserver:
129 void OnWindowDestroying(WmWindow* window) override; 134 void OnWindowDestroying(WmWindow* window) override;
130 void OnWindowTitleChanged(WmWindow* window) override; 135 void OnWindowTitleChanged(WmWindow* window) override;
131 136
132 private: 137 private:
133 class CaptionContainerView; 138 class CaptionContainerView;
139 class RoundedContainerView;
134 friend class WindowSelectorTest; 140 friend class WindowSelectorTest;
135 141
136 // Sets the bounds of this selector's items to |target_bounds| in 142 // Sets the bounds of this selector's items to |target_bounds| in
137 // |root_window_|. The bounds change will be animated as specified 143 // |root_window_|. The bounds change will be animated as specified
138 // by |animation_type|. 144 // by |animation_type|.
139 void SetItemBounds(const gfx::Rect& target_bounds, 145 void SetItemBounds(const gfx::Rect& target_bounds,
140 OverviewAnimationType animation_type); 146 OverviewAnimationType animation_type);
141 147
142 // Changes the opacity of all the windows the item owns. 148 // Changes the opacity of all the windows the item owns.
143 void SetOpacity(float opacity); 149 void SetOpacity(float opacity);
(...skipping 10 matching lines...) Expand all
154 // |animation_type|. 160 // |animation_type|.
155 void UpdateHeaderLayout(OverviewAnimationType animation_type); 161 void UpdateHeaderLayout(OverviewAnimationType animation_type);
156 162
157 // Animates opacity of the |transform_window_| and its caption to |opacity| 163 // Animates opacity of the |transform_window_| and its caption to |opacity|
158 // using |animation_type|. 164 // using |animation_type|.
159 void AnimateOpacity(float opacity, OverviewAnimationType animation_type); 165 void AnimateOpacity(float opacity, OverviewAnimationType animation_type);
160 166
161 // Updates the close buttons accessibility name. 167 // Updates the close buttons accessibility name.
162 void UpdateCloseButtonAccessibilityName(); 168 void UpdateCloseButtonAccessibilityName();
163 169
170 // Fades out a window caption when exiting overview mode.
171 void FadeOut(std::unique_ptr<views::Widget> widget);
172
164 static bool hide_header() { return use_mask_ || use_shape_; } 173 static bool hide_header() { return use_mask_ || use_shape_; }
165 174
166 // True if the item is being shown in the overview, false if it's being 175 // True if the item is being shown in the overview, false if it's being
167 // filtered. 176 // filtered.
168 bool dimmed_; 177 bool dimmed_;
169 178
170 // The root window this item is being displayed on. 179 // The root window this item is being displayed on.
171 WmWindow* root_window_; 180 WmWindow* root_window_;
172 181
173 // The contained Window's wrapper. 182 // The contained Window's wrapper.
174 ScopedTransformOverviewWindow transform_window_; 183 ScopedTransformOverviewWindow transform_window_;
175 184
176 // The target bounds this selector item is fit within. 185 // The target bounds this selector item is fit within.
177 gfx::Rect target_bounds_; 186 gfx::Rect target_bounds_;
178 187
179 // True if running SetItemBounds. This prevents recursive calls resulting from 188 // True if running SetItemBounds. This prevents recursive calls resulting from
180 // the bounds update when calling ::wm::RecreateWindowLayers to copy 189 // the bounds update when calling ::wm::RecreateWindowLayers to copy
181 // a window layer for display on another monitor. 190 // a window layer for display on another monitor.
182 bool in_bounds_update_; 191 bool in_bounds_update_;
183 192
193 // True when |this| item is visually selected. Item header is made transparent
194 // when the item is selected.
195 bool selected_;
196
197 // True initially until the UpdateHeaderLayout is invoked for the first time.
bruthig 2016/09/02 16:00:13 This seems inconsistent with where |first_time_upd
varkha 2016/09/02 21:38:37 I have removed this in favor for passing the stage
198 // Provided in order to set the initial bounds for the header to animate from.
199 bool first_time_update_;
200
184 // Label displaying its name (active tab for tabbed windows). 201 // Label displaying its name (active tab for tabbed windows).
185 // With Material Design this Widget owns |caption_container_view_| and is 202 // With Material Design this Widget owns |caption_container_view_| and is
186 // shown above the |transform_window_|. 203 // shown above the |transform_window_|.
187 // Otherwise it is shown under the window. 204 // Otherwise it is shown under the window.
188 std::unique_ptr<views::Widget> window_label_; 205 std::unique_ptr<views::Widget> window_label_;
189 206
190 // Shadow around the item in overview. 207 // Shadow around the item in overview.
191 std::unique_ptr<::wm::Shadow> shadow_; 208 std::unique_ptr<::wm::Shadow> shadow_;
192 209
193 // Label background widget used to fade in opacity when moving selection.
194 std::unique_ptr<views::Widget> window_label_selector_;
195
196 // Container view that owns |window_label_button_view_| and |close_button_|. 210 // Container view that owns |window_label_button_view_| and |close_button_|.
197 // Only used with Material Design. 211 // Only used with Material Design.
198 CaptionContainerView* caption_container_view_; 212 CaptionContainerView* caption_container_view_;
199 213
200 // View for the label below the window or (with material design) above it. 214 // View for the label below the window or (with material design) above it.
201 OverviewLabelButton* window_label_button_view_; 215 OverviewLabelButton* window_label_button_view_;
202 216
203 // The close buttons widget container. Not used with Material Design. 217 // The close buttons widget container. Not used with Material Design.
204 std::unique_ptr<views::Widget> close_button_widget_; 218 std::unique_ptr<views::Widget> close_button_widget_;
205 219
206 // A close button for the window in this item. Owned by the 220 // A close button for the window in this item. Owned by the
207 // |caption_container_view_| with Material Design or by |close_button_widget_| 221 // |caption_container_view_| with Material Design or by |close_button_widget_|
208 // otherwise. 222 // otherwise.
209 views::ImageButton* close_button_; 223 views::ImageButton* close_button_;
210 224
211 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. 225 // Pointer to the WindowSelector that owns the WindowGrid containing |this|.
212 // Guaranteed to be non-null for the lifetime of |this|. 226 // Guaranteed to be non-null for the lifetime of |this|.
213 WindowSelector* window_selector_; 227 WindowSelector* window_selector_;
214 228
229 // Pointer to a view that covers the original header and has rounded top
230 // corners. This view can have its color and opacity animated.
231 RoundedContainerView* background_view_;
232
215 // If true, mask the original window header while in overview and make corners 233 // If true, mask the original window header while in overview and make corners
216 // rounded using a mask layer. This has performance implications so it can be 234 // rounded using a mask layer. This has performance implications so it can be
217 // disabled when there are many windows. 235 // disabled when there are many windows.
218 static bool use_mask_; 236 static bool use_mask_;
219 237
220 // If true, hide the original window header while in overview using alpha 238 // If true, hide the original window header while in overview using alpha
221 // shape. This has performance implications so it can be disabled when there 239 // shape. This has performance implications so it can be disabled when there
222 // are many windows. 240 // are many windows.
223 static bool use_shape_; 241 static bool use_shape_;
224 242
225 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); 243 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem);
226 }; 244 };
227 245
228 } // namespace ash 246 } // namespace ash
229 247
230 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ 248 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698