| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/app_list/views/apps_grid_view.h" | 5 #include "ui/app_list/views/apps_grid_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/app_list/app_list_item_model.h" | 9 #include "ui/app_list/app_list_item_model.h" |
| 10 #include "ui/app_list/pagination_model.h" | 10 #include "ui/app_list/pagination_model.h" |
| 11 #include "ui/app_list/views/app_list_drag_and_drop_host.h" | 11 #include "ui/app_list/views/app_list_drag_and_drop_host.h" |
| 12 #include "ui/app_list/views/app_list_item_view.h" | 12 #include "ui/app_list/views/app_list_item_view.h" |
| 13 #include "ui/app_list/views/apps_grid_view_delegate.h" | 13 #include "ui/app_list/views/apps_grid_view_delegate.h" |
| 14 #include "ui/app_list/views/page_switcher.h" | 14 #include "ui/app_list/views/page_switcher.h" |
| 15 #include "ui/app_list/views/pulsing_block_view.h" | 15 #include "ui/app_list/views/pulsing_block_view.h" |
| 16 #include "ui/base/animation/animation.h" | |
| 17 #include "ui/base/events/event.h" | 16 #include "ui/base/events/event.h" |
| 18 #include "ui/compositor/scoped_layer_animation_settings.h" | 17 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 18 #include "ui/gfx/animation/animation.h" |
| 19 #include "ui/views/border.h" | 19 #include "ui/views/border.h" |
| 20 #include "ui/views/view_model_utils.h" | 20 #include "ui/views/view_model_utils.h" |
| 21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 22 | 22 |
| 23 #if defined(USE_AURA) | 23 #if defined(USE_AURA) |
| 24 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #if defined(OS_WIN) && !defined(USE_AURA) | 27 #if defined(OS_WIN) && !defined(USE_AURA) |
| 28 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 RowMoveAnimationDelegate(views::View* view, | 81 RowMoveAnimationDelegate(views::View* view, |
| 82 ui::Layer* layer, | 82 ui::Layer* layer, |
| 83 const gfx::Rect& layer_target) | 83 const gfx::Rect& layer_target) |
| 84 : view_(view), | 84 : view_(view), |
| 85 layer_(layer), | 85 layer_(layer), |
| 86 layer_start_(layer ? layer->bounds() : gfx::Rect()), | 86 layer_start_(layer ? layer->bounds() : gfx::Rect()), |
| 87 layer_target_(layer_target) { | 87 layer_target_(layer_target) { |
| 88 } | 88 } |
| 89 virtual ~RowMoveAnimationDelegate() {} | 89 virtual ~RowMoveAnimationDelegate() {} |
| 90 | 90 |
| 91 // ui::AnimationDelegate overrides: | 91 // gfx::AnimationDelegate overrides: |
| 92 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { | 92 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE { |
| 93 view_->layer()->SetOpacity(animation->GetCurrentValue()); | 93 view_->layer()->SetOpacity(animation->GetCurrentValue()); |
| 94 view_->layer()->ScheduleDraw(); | 94 view_->layer()->ScheduleDraw(); |
| 95 | 95 |
| 96 if (layer_) { | 96 if (layer_) { |
| 97 layer_->SetOpacity(1 - animation->GetCurrentValue()); | 97 layer_->SetOpacity(1 - animation->GetCurrentValue()); |
| 98 layer_->SetBounds(animation->CurrentValueBetween(layer_start_, | 98 layer_->SetBounds(animation->CurrentValueBetween(layer_start_, |
| 99 layer_target_)); | 99 layer_target_)); |
| 100 layer_->ScheduleDraw(); | 100 layer_->ScheduleDraw(); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE { | 103 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE { |
| 104 view_->layer()->SetOpacity(1.0f); | 104 view_->layer()->SetOpacity(1.0f); |
| 105 view_->layer()->ScheduleDraw(); | 105 view_->layer()->ScheduleDraw(); |
| 106 } | 106 } |
| 107 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE { | 107 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE { |
| 108 view_->layer()->SetOpacity(1.0f); | 108 view_->layer()->SetOpacity(1.0f); |
| 109 view_->layer()->ScheduleDraw(); | 109 view_->layer()->ScheduleDraw(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 // The view that needs to be wrapped. Owned by views hierarchy. | 113 // The view that needs to be wrapped. Owned by views hierarchy. |
| 114 views::View* view_; | 114 views::View* view_; |
| 115 | 115 |
| 116 scoped_ptr<ui::Layer> layer_; | 116 scoped_ptr<ui::Layer> layer_; |
| 117 const gfx::Rect layer_start_; | 117 const gfx::Rect layer_start_; |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 #if defined(USE_AURA) | 1188 #if defined(USE_AURA) |
| 1189 ui::ScopedLayerAnimationSettings animator(view->layer()->GetAnimator()); | 1189 ui::ScopedLayerAnimationSettings animator(view->layer()->GetAnimator()); |
| 1190 animator.SetPreemptionStrategy( | 1190 animator.SetPreemptionStrategy( |
| 1191 immediate ? ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET : | 1191 immediate ? ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET : |
| 1192 ui::LayerAnimator::BLEND_WITH_CURRENT_ANIMATION); | 1192 ui::LayerAnimator::BLEND_WITH_CURRENT_ANIMATION); |
| 1193 view->layer()->SetOpacity(hide ? 0 : 1); | 1193 view->layer()->SetOpacity(hide ? 0 : 1); |
| 1194 #endif | 1194 #endif |
| 1195 } | 1195 } |
| 1196 | 1196 |
| 1197 } // namespace app_list | 1197 } // namespace app_list |
| OLD | NEW |