Chromium Code Reviews| Index: ui/app_list/views/contents_animator.cc |
| diff --git a/ui/app_list/views/contents_animator.cc b/ui/app_list/views/contents_animator.cc |
| index bdffe9c48131ec4925775b9093b3ae8cda79f232..fce73da624c47a92951a0d5d1e37c68726b89f30 100644 |
| --- a/ui/app_list/views/contents_animator.cc |
| +++ b/ui/app_list/views/contents_animator.cc |
| @@ -12,11 +12,23 @@ |
| #include "ui/app_list/views/start_page_view.h" |
| #include "ui/gfx/animation/tween.h" |
| #include "ui/gfx/geometry/rect.h" |
| +#include "ui/gfx/shadow_value.h" |
| #include "ui/views/view.h" |
| #include "ui/views/widget/widget.h" |
| namespace app_list { |
| +namespace { |
| + |
| +gfx::ShadowValue GetSearchBoxShadowForState(AppListModel::State state) { |
| + if (state == AppListModel::STATE_SEARCH_RESULTS) |
| + return SearchBoxView::GetShadowForZHeight(1); |
|
Matt Giuca
2015/02/06 04:32:27
state == SSR ? 1 : 2
calamity
2015/02/06 05:17:51
Done.
|
| + |
| + return SearchBoxView::GetShadowForZHeight(2); |
| +} |
| + |
| +} // namespace |
| + |
| // ContentsAnimator |
| ContentsAnimator::ContentsAnimator(ContentsView* contents_view) |
| @@ -96,9 +108,27 @@ void ContentsAnimator::UpdateSearchBoxForDefaultAnimation(double progress, |
| gfx::Rect search_box_rect = |
| gfx::Tween::RectValueBetween(progress, search_box_from, search_box_to); |
| + AppListModel::State from_state = |
| + contents_view()->GetStateForPageIndex(from_page); |
| + AppListModel::State to_state = contents_view()->GetStateForPageIndex(to_page); |
| + |
| + gfx::ShadowValue original_shadow = GetSearchBoxShadowForState(from_state); |
| + gfx::ShadowValue target_shadow = GetSearchBoxShadowForState(to_state); |
| + |
| SearchBoxView* search_box = contents_view()->GetSearchBoxView(); |
| - search_box->GetWidget()->SetBounds(contents_view()->ConvertRectToWidget( |
| - search_box->GetViewBoundsForSearchBoxContentsBounds(search_box_rect))); |
| + gfx::Point offset(gfx::Tween::LinearIntValueBetween( |
| + progress, original_shadow.x(), target_shadow.x()), |
| + gfx::Tween::LinearIntValueBetween( |
| + progress, original_shadow.y(), target_shadow.y())); |
| + search_box->SetShadow(gfx::ShadowValue( |
| + offset, gfx::Tween::LinearIntValueBetween( |
| + progress, original_shadow.blur(), target_shadow.blur()), |
| + gfx::Tween::ColorValueBetween(progress, original_shadow.color(), |
| + target_shadow.color()))); |
| + |
| + search_box->GetWidget()->SetBounds( |
| + search_box->GetViewBoundsForSearchBoxContentsBounds( |
| + contents_view()->ConvertRectToWidget(search_box_rect))); |
| } |
| void ContentsAnimator::ClipSearchResultsPageToOnscreenBounds( |