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

Side by Side Diff: ash/common/wm/overview/scoped_transform_overview_window.cc

Issue 2433233005: Cleanup: Remove unused arguments, member variable (Closed)
Patch Set: Cleanup: Remove unused arguments, member variable Created 4 years, 1 month 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 #include "ash/common/wm/overview/scoped_transform_overview_window.h" 5 #include "ash/common/wm/overview/scoped_transform_overview_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/wm/overview/scoped_overview_animation_settings.h" 10 #include "ash/common/wm/overview/scoped_overview_animation_settings.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 original_opacity_(window->GetTargetOpacity()), 187 original_opacity_(window->GetTargetOpacity()),
188 weak_ptr_factory_(this) {} 188 weak_ptr_factory_(this) {}
189 189
190 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} 190 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {}
191 191
192 void ScopedTransformOverviewWindow::RestoreWindow() { 192 void ScopedTransformOverviewWindow::RestoreWindow() {
193 ScopedAnimationSettings animation_settings_list; 193 ScopedAnimationSettings animation_settings_list;
194 BeginScopedAnimation(OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW, 194 BeginScopedAnimation(OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW,
195 &animation_settings_list); 195 &animation_settings_list);
196 SetTransform(window()->GetRootWindow(), original_transform_); 196 SetTransform(window()->GetRootWindow(), original_transform_);
197 set_overview_transform(original_transform_);
198 197
199 std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings = 198 std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings =
200 CreateScopedOverviewAnimationSettings( 199 CreateScopedOverviewAnimationSettings(
201 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS, 200 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS,
202 window_); 201 window_);
203 gfx::Transform transform; 202 gfx::Transform transform;
204 if ((original_visibility_ == ORIGINALLY_MINIMIZED && 203 if ((original_visibility_ == ORIGINALLY_MINIMIZED &&
205 window_->GetShowState() != ui::SHOW_STATE_MINIMIZED) || 204 window_->GetShowState() != ui::SHOW_STATE_MINIMIZED) ||
206 (original_visibility_ == ORIGINALLY_DOCKED_MINIMIZED && 205 (original_visibility_ == ORIGINALLY_DOCKED_MINIMIZED &&
207 window_->GetWindowState()->GetStateType() != 206 window_->GetWindowState()->GetStateType() !=
208 wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED)) { 207 wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED)) {
209 // Setting opacity 0 and visible false ensures that the property change 208 // Setting opacity 0 and visible false ensures that the property change
210 // to SHOW_STATE_MINIMIZED will not animate the window from its original 209 // to SHOW_STATE_MINIMIZED will not animate the window from its original
211 // bounds to the minimized position. 210 // bounds to the minimized position.
212 // Hiding the window needs to be done before the target opacity is 0, 211 // Hiding the window needs to be done before the target opacity is 0,
213 // otherwise the layer's visibility will not be updated 212 // otherwise the layer's visibility will not be updated
214 // (See VisibilityController::UpdateLayerVisibility). 213 // (See VisibilityController::UpdateLayerVisibility).
215 window_->Hide(); 214 window_->Hide();
216 window_->SetOpacity(0); 215 window_->SetOpacity(0);
217 window_->SetShowState(ui::SHOW_STATE_MINIMIZED); 216 window_->SetShowState(ui::SHOW_STATE_MINIMIZED);
218 } 217 }
219 window_->GetWindowState()->set_ignored_by_shelf(ignored_by_shelf_); 218 window_->GetWindowState()->set_ignored_by_shelf(ignored_by_shelf_);
220 SetOpacity(original_opacity_); 219 SetOpacity(original_opacity_);
221 ShowHeaderAndResetShape(); 220 ShowHeader();
222 } 221 }
223 222
224 void ScopedTransformOverviewWindow::BeginScopedAnimation( 223 void ScopedTransformOverviewWindow::BeginScopedAnimation(
225 OverviewAnimationType animation_type, 224 OverviewAnimationType animation_type,
226 ScopedAnimationSettings* animation_settings) { 225 ScopedAnimationSettings* animation_settings) {
227 for (auto* window : GetTransientTreeIterator(window_)) { 226 for (auto* window : GetTransientTreeIterator(window_)) {
228 animation_settings->push_back( 227 animation_settings->push_back(
229 CreateScopedOverviewAnimationSettings(animation_type, window)); 228 CreateScopedOverviewAnimationSettings(animation_type, window));
230 } 229 }
231 } 230 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 window->SetTransform(new_transform); 397 window->SetTransform(new_transform);
399 } 398 }
400 } 399 }
401 400
402 void ScopedTransformOverviewWindow::SetOpacity(float opacity) { 401 void ScopedTransformOverviewWindow::SetOpacity(float opacity) {
403 for (auto* window : GetTransientTreeIterator(window_)) { 402 for (auto* window : GetTransientTreeIterator(window_)) {
404 window->SetOpacity(opacity); 403 window->SetOpacity(opacity);
405 } 404 }
406 } 405 }
407 406
408 void ScopedTransformOverviewWindow::HideHeaderAndSetShape(int radius) { 407 void ScopedTransformOverviewWindow::HideHeader() {
409 gfx::Rect bounds(GetTargetBoundsInScreen().size()); 408 gfx::Rect bounds(GetTargetBoundsInScreen().size());
410 const int inset = GetTopInset(); 409 const int inset = GetTopInset();
411 if (inset > 0) { 410 if (inset > 0) {
412 // Use alpha shape to hide the window header. 411 // Use alpha shape to hide the window header.
413 bounds.Inset(0, inset, 0, 0); 412 bounds.Inset(0, inset, 0, 0);
414 std::unique_ptr<SkRegion> region(new SkRegion); 413 std::unique_ptr<SkRegion> region(new SkRegion);
415 region->setRect(RectToSkIRect(bounds)); 414 region->setRect(RectToSkIRect(bounds));
416 if (original_window_shape_) 415 if (original_window_shape_)
417 region->op(*original_window_shape_, SkRegion::kIntersect_Op); 416 region->op(*original_window_shape_, SkRegion::kIntersect_Op);
418 window()->GetLayer()->SetAlphaShape(std::move(region)); 417 window()->GetLayer()->SetAlphaShape(std::move(region));
419 window()->SetMasksToBounds(true); 418 window()->SetMasksToBounds(true);
420 } 419 }
421 } 420 }
422 421
423 void ScopedTransformOverviewWindow::ShowHeaderAndResetShape() { 422 void ScopedTransformOverviewWindow::ShowHeader() {
424 ui::Layer* layer = window()->GetLayer(); 423 ui::Layer* layer = window()->GetLayer();
425 if (original_window_shape_) { 424 if (original_window_shape_) {
426 layer->SetAlphaShape( 425 layer->SetAlphaShape(
427 base::MakeUnique<SkRegion>(*original_window_shape_.get())); 426 base::MakeUnique<SkRegion>(*original_window_shape_.get()));
428 } else { 427 } else {
429 layer->SetAlphaShape(nullptr); 428 layer->SetAlphaShape(nullptr);
430 } 429 }
431 window()->SetMasksToBounds(false); 430 window()->SetMasksToBounds(false);
432 } 431 }
433 432
(...skipping 20 matching lines...) Expand all
454 if (parent_window) 453 if (parent_window)
455 parent_window->CloseWidget(); 454 parent_window->CloseWidget();
456 } 455 }
457 456
458 // static 457 // static
459 void ScopedTransformOverviewWindow::SetImmediateCloseForTests() { 458 void ScopedTransformOverviewWindow::SetImmediateCloseForTests() {
460 immediate_close_for_tests = true; 459 immediate_close_for_tests = true;
461 } 460 }
462 461
463 } // namespace ash 462 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/scoped_transform_overview_window.h ('k') | ash/common/wm/overview/window_selector_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698