| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 window_->SetOpacity(0); | 277 window_->SetOpacity(0); |
| 278 window_->SetShowState(ui::SHOW_STATE_MINIMIZED); | 278 window_->SetShowState(ui::SHOW_STATE_MINIMIZED); |
| 279 } | 279 } |
| 280 window_->GetWindowState()->set_ignored_by_shelf(ignored_by_shelf_); | 280 window_->GetWindowState()->set_ignored_by_shelf(ignored_by_shelf_); |
| 281 SetOpacity(original_opacity_); | 281 SetOpacity(original_opacity_); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void ScopedTransformOverviewWindow::BeginScopedAnimation( | 284 void ScopedTransformOverviewWindow::BeginScopedAnimation( |
| 285 OverviewAnimationType animation_type, | 285 OverviewAnimationType animation_type, |
| 286 ScopedAnimationSettings* animation_settings) { | 286 ScopedAnimationSettings* animation_settings) { |
| 287 for (const auto& window : GetTransientTreeIterator(window_)) { | 287 for (auto* window : GetTransientTreeIterator(window_)) { |
| 288 animation_settings->push_back( | 288 animation_settings->push_back( |
| 289 CreateScopedOverviewAnimationSettings(animation_type, window)); | 289 CreateScopedOverviewAnimationSettings(animation_type, window)); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 bool ScopedTransformOverviewWindow::Contains(const WmWindow* target) const { | 293 bool ScopedTransformOverviewWindow::Contains(const WmWindow* target) const { |
| 294 for (const auto& window : GetTransientTreeIterator(window_)) { | 294 for (auto* window : GetTransientTreeIterator(window_)) { |
| 295 if (window->Contains(target)) | 295 if (window->Contains(target)) |
| 296 return true; | 296 return true; |
| 297 } | 297 } |
| 298 return false; | 298 return false; |
| 299 } | 299 } |
| 300 | 300 |
| 301 gfx::Rect ScopedTransformOverviewWindow::GetTargetBoundsInScreen() const { | 301 gfx::Rect ScopedTransformOverviewWindow::GetTargetBoundsInScreen() const { |
| 302 gfx::Rect bounds; | 302 gfx::Rect bounds; |
| 303 for (const auto& window : GetTransientTreeIterator(window_)) { | 303 for (auto* window : GetTransientTreeIterator(window_)) { |
| 304 // Ignore other window types when computing bounding box of window | 304 // Ignore other window types when computing bounding box of window |
| 305 // selector target item. | 305 // selector target item. |
| 306 if (window != window_ && window->GetType() != ui::wm::WINDOW_TYPE_NORMAL && | 306 if (window != window_ && window->GetType() != ui::wm::WINDOW_TYPE_NORMAL && |
| 307 window->GetType() != ui::wm::WINDOW_TYPE_PANEL) { | 307 window->GetType() != ui::wm::WINDOW_TYPE_PANEL) { |
| 308 continue; | 308 continue; |
| 309 } | 309 } |
| 310 bounds.Union( | 310 bounds.Union( |
| 311 window->GetParent()->ConvertRectToScreen(window->GetTargetBounds())); | 311 window->GetParent()->ConvertRectToScreen(window->GetTargetBounds())); |
| 312 } | 312 } |
| 313 return bounds; | 313 return bounds; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 390 |
| 391 if (ash::MaterialDesignController::IsOverviewMaterial()) { | 391 if (ash::MaterialDesignController::IsOverviewMaterial()) { |
| 392 mask_.reset(new OverviewContentMask( | 392 mask_.reset(new OverviewContentMask( |
| 393 window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET), radius)); | 393 window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET), radius)); |
| 394 mask_->layer()->SetBounds(GetTargetBoundsInScreen()); | 394 mask_->layer()->SetBounds(GetTargetBoundsInScreen()); |
| 395 window()->GetLayer()->SetMaskLayer(mask_->layer()); | 395 window()->GetLayer()->SetMaskLayer(mask_->layer()); |
| 396 } | 396 } |
| 397 | 397 |
| 398 gfx::Point target_origin(GetTargetBoundsInScreen().origin()); | 398 gfx::Point target_origin(GetTargetBoundsInScreen().origin()); |
| 399 | 399 |
| 400 for (const auto& window : GetTransientTreeIterator(window_)) { | 400 for (auto* window : GetTransientTreeIterator(window_)) { |
| 401 WmWindow* parent_window = window->GetParent(); | 401 WmWindow* parent_window = window->GetParent(); |
| 402 gfx::Point original_origin = | 402 gfx::Point original_origin = |
| 403 parent_window->ConvertRectToScreen(window->GetTargetBounds()).origin(); | 403 parent_window->ConvertRectToScreen(window->GetTargetBounds()).origin(); |
| 404 gfx::Transform new_transform = | 404 gfx::Transform new_transform = |
| 405 TransformAboutPivot(gfx::Point(target_origin.x() - original_origin.x(), | 405 TransformAboutPivot(gfx::Point(target_origin.x() - original_origin.x(), |
| 406 target_origin.y() - original_origin.y()), | 406 target_origin.y() - original_origin.y()), |
| 407 transform); | 407 transform); |
| 408 window->SetTransform(new_transform); | 408 window->SetTransform(new_transform); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 | 411 |
| 412 void ScopedTransformOverviewWindow::SetOpacity(float opacity) { | 412 void ScopedTransformOverviewWindow::SetOpacity(float opacity) { |
| 413 for (const auto& window : GetTransientTreeIterator(window_)) { | 413 for (auto* window : GetTransientTreeIterator(window_)) { |
| 414 window->SetOpacity(opacity); | 414 window->SetOpacity(opacity); |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 void ScopedTransformOverviewWindow::Close() { | 418 void ScopedTransformOverviewWindow::Close() { |
| 419 GetTransientRoot(window_)->CloseWidget(); | 419 GetTransientRoot(window_)->CloseWidget(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void ScopedTransformOverviewWindow::PrepareForOverview() { | 422 void ScopedTransformOverviewWindow::PrepareForOverview() { |
| 423 DCHECK(!overview_started_); | 423 DCHECK(!overview_started_); |
| 424 overview_started_ = true; | 424 overview_started_ = true; |
| 425 window_->GetWindowState()->set_ignored_by_shelf(true); | 425 window_->GetWindowState()->set_ignored_by_shelf(true); |
| 426 ShowWindowIfMinimized(); | 426 ShowWindowIfMinimized(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace ash | 429 } // namespace ash |
| OLD | NEW |