| OLD | NEW |
| 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/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Redrawing will take care of scale factor change. | 241 // Redrawing will take care of scale factor change. |
| 242 } | 242 } |
| 243 | 243 |
| 244 base::Closure ScopedTransformOverviewWindow::OverviewContentMask:: | 244 base::Closure ScopedTransformOverviewWindow::OverviewContentMask:: |
| 245 PrepareForLayerBoundsChange() { | 245 PrepareForLayerBoundsChange() { |
| 246 return base::Closure(); | 246 return base::Closure(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(WmWindow* window) | 249 ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(WmWindow* window) |
| 250 : window_(window), | 250 : window_(window), |
| 251 determined_original_window_shape_(false), |
| 251 minimized_(window->GetShowState() == ui::SHOW_STATE_MINIMIZED), | 252 minimized_(window->GetShowState() == ui::SHOW_STATE_MINIMIZED), |
| 252 ignored_by_shelf_(window->GetWindowState()->ignored_by_shelf()), | 253 ignored_by_shelf_(window->GetWindowState()->ignored_by_shelf()), |
| 253 overview_started_(false), | 254 overview_started_(false), |
| 254 original_transform_(window->GetTargetTransform()), | 255 original_transform_(window->GetTargetTransform()), |
| 255 original_opacity_(window->GetTargetOpacity()), | 256 original_opacity_(window->GetTargetOpacity()), |
| 256 weak_ptr_factory_(this) {} | 257 weak_ptr_factory_(this) {} |
| 257 | 258 |
| 258 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} | 259 ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {} |
| 259 | 260 |
| 260 void ScopedTransformOverviewWindow::RestoreWindow() { | 261 void ScopedTransformOverviewWindow::RestoreWindow() { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 if (!mask_) { | 410 if (!mask_) { |
| 410 mask_.reset(new OverviewContentMask(radius)); | 411 mask_.reset(new OverviewContentMask(radius)); |
| 411 mask_->layer()->SetFillsBoundsOpaquely(false); | 412 mask_->layer()->SetFillsBoundsOpaquely(false); |
| 412 window()->GetLayer()->SetMaskLayer(mask_->layer()); | 413 window()->GetLayer()->SetMaskLayer(mask_->layer()); |
| 413 } | 414 } |
| 414 gfx::Rect bounds(GetTargetBoundsInScreen().size()); | 415 gfx::Rect bounds(GetTargetBoundsInScreen().size()); |
| 415 mask_->layer()->SetBounds(bounds); | 416 mask_->layer()->SetBounds(bounds); |
| 416 mask_->set_radius(radius); | 417 mask_->set_radius(radius); |
| 417 window()->GetLayer()->SchedulePaint(bounds); | 418 window()->GetLayer()->SchedulePaint(bounds); |
| 418 | 419 |
| 419 SkRegion* window_shape = window()->GetLayer()->alpha_shape(); | 420 if (!determined_original_window_shape_) { |
| 420 if (!original_window_shape_ && window_shape) | 421 determined_original_window_shape_ = true; |
| 421 original_window_shape_.reset(new SkRegion(*window_shape)); | 422 SkRegion* window_shape = window()->GetLayer()->alpha_shape(); |
| 423 if (!original_window_shape_ && window_shape) |
| 424 original_window_shape_.reset(new SkRegion(*window_shape)); |
| 425 } |
| 422 const int inset = | 426 const int inset = |
| 423 window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET); | 427 window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET); |
| 424 if (inset > 0) { | 428 if (inset > 0) { |
| 425 bounds.Inset(0, inset, 0, 0); | 429 bounds.Inset(0, inset, 0, 0); |
| 426 SkRegion* region = new SkRegion; | 430 SkRegion* region = new SkRegion; |
| 427 region->setRect(RectToSkIRect(bounds)); | 431 region->setRect(RectToSkIRect(bounds)); |
| 428 if (original_window_shape_) | 432 if (original_window_shape_) |
| 429 region->op(*original_window_shape_, SkRegion::kIntersect_Op); | 433 region->op(*original_window_shape_, SkRegion::kIntersect_Op); |
| 430 window()->GetLayer()->SetAlphaShape(base::WrapUnique(region)); | 434 window()->GetLayer()->SetAlphaShape(base::WrapUnique(region)); |
| 431 window()->SetMasksToBounds(true); | 435 window()->SetMasksToBounds(true); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 if (parent_window) | 480 if (parent_window) |
| 477 parent_window->CloseWidget(); | 481 parent_window->CloseWidget(); |
| 478 } | 482 } |
| 479 | 483 |
| 480 // static | 484 // static |
| 481 void ScopedTransformOverviewWindow::SetImmediateCloseForTests() { | 485 void ScopedTransformOverviewWindow::SetImmediateCloseForTests() { |
| 482 immediate_close_for_tests = true; | 486 immediate_close_for_tests = true; |
| 483 } | 487 } |
| 484 | 488 |
| 485 } // namespace ash | 489 } // namespace ash |
| OLD | NEW |