| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 // First animate opacity to an intermediate value concurrently with the | 501 // First animate opacity to an intermediate value concurrently with the |
| 502 // scaling animation. | 502 // scaling animation. |
| 503 AnimateOpacity(kClosingItemOpacity, animation_type); | 503 AnimateOpacity(kClosingItemOpacity, animation_type); |
| 504 | 504 |
| 505 // Fade out the window and the label, effectively hiding them. | 505 // Fade out the window and the label, effectively hiding them. |
| 506 AnimateOpacity(0.0, | 506 AnimateOpacity(0.0, |
| 507 OverviewAnimationType::OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM); | 507 OverviewAnimationType::OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM); |
| 508 transform_window_.Close(); | 508 transform_window_.Close(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 void WindowSelectorItem::HideHeaderAndSetShape(int radius) { | 511 void WindowSelectorItem::HideHeader() { |
| 512 transform_window_.HideHeaderAndSetShape(radius); | 512 transform_window_.HideHeader(); |
| 513 } | 513 } |
| 514 | 514 |
| 515 void WindowSelectorItem::SetDimmed(bool dimmed) { | 515 void WindowSelectorItem::SetDimmed(bool dimmed) { |
| 516 dimmed_ = dimmed; | 516 dimmed_ = dimmed; |
| 517 SetOpacity(dimmed ? kDimmedItemOpacity : 1.0f); | 517 SetOpacity(dimmed ? kDimmedItemOpacity : 1.0f); |
| 518 } | 518 } |
| 519 | 519 |
| 520 void WindowSelectorItem::ButtonPressed(views::Button* sender, | 520 void WindowSelectorItem::ButtonPressed(views::Button* sender, |
| 521 const ui::Event& event) { | 521 const ui::Event& event) { |
| 522 if (sender == close_button_) { | 522 if (sender == close_button_) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 const int top_view_inset = transform_window_.GetTopInset(); | 565 const int top_view_inset = transform_window_.GetTopInset(); |
| 566 const int title_height = close_button_->GetPreferredSize().height(); | 566 const int title_height = close_button_->GetPreferredSize().height(); |
| 567 gfx::Rect selector_item_bounds = | 567 gfx::Rect selector_item_bounds = |
| 568 ScopedTransformOverviewWindow::ShrinkRectToFitPreservingAspectRatio( | 568 ScopedTransformOverviewWindow::ShrinkRectToFitPreservingAspectRatio( |
| 569 screen_rect, target_bounds, top_view_inset, title_height); | 569 screen_rect, target_bounds, top_view_inset, title_height); |
| 570 gfx::Transform transform = ScopedTransformOverviewWindow::GetTransformForRect( | 570 gfx::Transform transform = ScopedTransformOverviewWindow::GetTransformForRect( |
| 571 screen_rect, selector_item_bounds); | 571 screen_rect, selector_item_bounds); |
| 572 ScopedTransformOverviewWindow::ScopedAnimationSettings animation_settings; | 572 ScopedTransformOverviewWindow::ScopedAnimationSettings animation_settings; |
| 573 transform_window_.BeginScopedAnimation(animation_type, &animation_settings); | 573 transform_window_.BeginScopedAnimation(animation_type, &animation_settings); |
| 574 transform_window_.SetTransform(root_window_, transform); | 574 transform_window_.SetTransform(root_window_, transform); |
| 575 transform_window_.set_overview_transform(transform); | |
| 576 } | 575 } |
| 577 | 576 |
| 578 void WindowSelectorItem::SetOpacity(float opacity) { | 577 void WindowSelectorItem::SetOpacity(float opacity) { |
| 579 window_label_->SetOpacity(opacity); | 578 window_label_->SetOpacity(opacity); |
| 580 if (background_view_) { | 579 if (background_view_) { |
| 581 background_view_->AnimateBackgroundOpacity( | 580 background_view_->AnimateBackgroundOpacity( |
| 582 selected_ ? 0.f : kHeaderOpacity * opacity); | 581 selected_ ? 0.f : kHeaderOpacity * opacity); |
| 583 } | 582 } |
| 584 transform_window_.SetOpacity(opacity); | 583 transform_window_.SetOpacity(opacity); |
| 585 } | 584 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 window_selector_->delegate()->AddDelayedAnimationObserver( | 780 window_selector_->delegate()->AddDelayedAnimationObserver( |
| 782 std::move(observer)); | 781 std::move(observer)); |
| 783 widget_ptr->SetOpacity(0.f); | 782 widget_ptr->SetOpacity(0.f); |
| 784 } | 783 } |
| 785 | 784 |
| 786 gfx::SlideAnimation* WindowSelectorItem::GetBackgroundViewAnimation() { | 785 gfx::SlideAnimation* WindowSelectorItem::GetBackgroundViewAnimation() { |
| 787 return background_view_ ? background_view_->animation() : nullptr; | 786 return background_view_ ? background_view_->animation() : nullptr; |
| 788 } | 787 } |
| 789 | 788 |
| 790 } // namespace ash | 789 } // namespace ash |
| OLD | NEW |