| 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/window_selector_item.h" | 5 #include "ash/common/wm/overview/window_selector_item.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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 initial_color_ = target_color_; | 281 initial_color_ = target_color_; |
| 282 current_value_ = 255; | 282 current_value_ = 255; |
| 283 SchedulePaint(); | 283 SchedulePaint(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 // ui::LayerAnimationObserver: | 286 // ui::LayerAnimationObserver: |
| 287 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override { | 287 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override { |
| 288 if (0 != (sequence->properties() & | 288 if (0 != (sequence->properties() & |
| 289 ui::LayerAnimationElement::AnimatableProperty::OPACITY)) { | 289 ui::LayerAnimationElement::AnimatableProperty::OPACITY)) { |
| 290 if (item_) | 290 if (item_) |
| 291 item_->HideHeaderAndSetShape(0); | 291 item_->HideHeader(); |
| 292 StopObservingLayerAnimations(); | 292 StopObservingLayerAnimations(); |
| 293 AnimateColor(gfx::Tween::EASE_IN, kSelectorColorSlideMilliseconds); | 293 AnimateColor(gfx::Tween::EASE_IN, kSelectorColorSlideMilliseconds); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override { | 297 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override { |
| 298 if (0 != (sequence->properties() & | 298 if (0 != (sequence->properties() & |
| 299 ui::LayerAnimationElement::AnimatableProperty::OPACITY)) { | 299 ui::LayerAnimationElement::AnimatableProperty::OPACITY)) { |
| 300 StopObservingLayerAnimations(); | 300 StopObservingLayerAnimations(); |
| 301 } | 301 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // First animate opacity to an intermediate value concurrently with the | 508 // First animate opacity to an intermediate value concurrently with the |
| 509 // scaling animation. | 509 // scaling animation. |
| 510 AnimateOpacity(kClosingItemOpacity, animation_type); | 510 AnimateOpacity(kClosingItemOpacity, animation_type); |
| 511 | 511 |
| 512 // Fade out the window and the label, effectively hiding them. | 512 // Fade out the window and the label, effectively hiding them. |
| 513 AnimateOpacity(0.0, | 513 AnimateOpacity(0.0, |
| 514 OverviewAnimationType::OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM); | 514 OverviewAnimationType::OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM); |
| 515 transform_window_.Close(); | 515 transform_window_.Close(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void WindowSelectorItem::HideHeaderAndSetShape(int radius) { | 518 void WindowSelectorItem::HideHeader() { |
| 519 transform_window_.HideHeaderAndSetShape(radius); | 519 transform_window_.HideHeader(); |
| 520 } | 520 } |
| 521 | 521 |
| 522 void WindowSelectorItem::SetDimmed(bool dimmed) { | 522 void WindowSelectorItem::SetDimmed(bool dimmed) { |
| 523 dimmed_ = dimmed; | 523 dimmed_ = dimmed; |
| 524 SetOpacity(dimmed ? kDimmedItemOpacity : 1.0f); | 524 SetOpacity(dimmed ? kDimmedItemOpacity : 1.0f); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void WindowSelectorItem::ButtonPressed(views::Button* sender, | 527 void WindowSelectorItem::ButtonPressed(views::Button* sender, |
| 528 const ui::Event& event) { | 528 const ui::Event& event) { |
| 529 if (sender == close_button_) { | 529 if (sender == close_button_) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 const int top_view_inset = transform_window_.GetTopInset(); | 572 const int top_view_inset = transform_window_.GetTopInset(); |
| 573 const int title_height = close_button_->GetPreferredSize().height(); | 573 const int title_height = close_button_->GetPreferredSize().height(); |
| 574 gfx::Rect selector_item_bounds = | 574 gfx::Rect selector_item_bounds = |
| 575 ScopedTransformOverviewWindow::ShrinkRectToFitPreservingAspectRatio( | 575 ScopedTransformOverviewWindow::ShrinkRectToFitPreservingAspectRatio( |
| 576 screen_rect, target_bounds, top_view_inset, title_height); | 576 screen_rect, target_bounds, top_view_inset, title_height); |
| 577 gfx::Transform transform = ScopedTransformOverviewWindow::GetTransformForRect( | 577 gfx::Transform transform = ScopedTransformOverviewWindow::GetTransformForRect( |
| 578 screen_rect, selector_item_bounds); | 578 screen_rect, selector_item_bounds); |
| 579 ScopedTransformOverviewWindow::ScopedAnimationSettings animation_settings; | 579 ScopedTransformOverviewWindow::ScopedAnimationSettings animation_settings; |
| 580 transform_window_.BeginScopedAnimation(animation_type, &animation_settings); | 580 transform_window_.BeginScopedAnimation(animation_type, &animation_settings); |
| 581 transform_window_.SetTransform(root_window_, transform); | 581 transform_window_.SetTransform(root_window_, transform); |
| 582 transform_window_.set_overview_transform(transform); | |
| 583 } | 582 } |
| 584 | 583 |
| 585 void WindowSelectorItem::SetOpacity(float opacity) { | 584 void WindowSelectorItem::SetOpacity(float opacity) { |
| 586 window_label_->SetOpacity(opacity); | 585 window_label_->SetOpacity(opacity); |
| 587 if (background_view_) { | 586 if (background_view_) { |
| 588 background_view_->AnimateBackgroundOpacity( | 587 background_view_->AnimateBackgroundOpacity( |
| 589 selected_ ? 0.f : kHeaderOpacity * opacity); | 588 selected_ ? 0.f : kHeaderOpacity * opacity); |
| 590 } | 589 } |
| 591 transform_window_.SetOpacity(opacity); | 590 transform_window_.SetOpacity(opacity); |
| 592 } | 591 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 window_selector_->delegate()->AddDelayedAnimationObserver( | 787 window_selector_->delegate()->AddDelayedAnimationObserver( |
| 789 std::move(observer)); | 788 std::move(observer)); |
| 790 widget_ptr->SetOpacity(0.f); | 789 widget_ptr->SetOpacity(0.f); |
| 791 } | 790 } |
| 792 | 791 |
| 793 gfx::SlideAnimation* WindowSelectorItem::GetBackgroundViewAnimation() { | 792 gfx::SlideAnimation* WindowSelectorItem::GetBackgroundViewAnimation() { |
| 794 return background_view_ ? background_view_->animation() : nullptr; | 793 return background_view_ ? background_view_->animation() : nullptr; |
| 795 } | 794 } |
| 796 | 795 |
| 797 } // namespace ash | 796 } // namespace ash |
| OLD | NEW |