Chromium Code Reviews| Index: ui/app_list/views/contents_view.cc |
| diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc |
| index c9ea27655c55962d62d45ed9a73f2db58491bcb9..bdc8ad635a68027e369aa227a2fd1031e9697076 100644 |
| --- a/ui/app_list/views/contents_view.cc |
| +++ b/ui/app_list/views/contents_view.cc |
| @@ -45,10 +45,11 @@ ContentsView::~ContentsView() { |
| pagination_model_.RemoveObserver(contents_switcher_view_); |
| } |
| -void ContentsView::Init(AppListModel* model, |
| - AppListViewDelegate* view_delegate) { |
| +void ContentsView::Init(AppListModel* model) { |
| DCHECK(model); |
| + AppListViewDelegate* view_delegate = app_list_main_view_->view_delegate(); |
| + |
| if (app_list::switches::IsExperimentalAppListEnabled()) { |
| std::vector<views::View*> custom_page_views = |
| view_delegate->CreateCustomPageWebViews(GetLocalBounds().size()); |
| @@ -56,7 +57,14 @@ void ContentsView::Init(AppListModel* model, |
| custom_page_views.begin(); |
| it != custom_page_views.end(); |
| ++it) { |
| - AddLauncherPage(*it, IDR_APP_LIST_NOTIFICATIONS_ICON); |
| + // Only the first launcher page is considered to represent |
| + // STATE_CUSTOM_LAUNCHER_PAGE. |
| + if (it == custom_page_views.begin()) { |
| + AddLauncherPage(*it, IDR_APP_LIST_NOTIFICATIONS_ICON, |
| + AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); |
| + } else { |
| + AddLauncherPage(*it, IDR_APP_LIST_NOTIFICATIONS_ICON); |
| + } |
| } |
| start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); |
| @@ -211,6 +219,20 @@ gfx::Rect ContentsView::GetOffscreenPageBounds(int page_index) const { |
| return bounds; |
| } |
| +void ContentsView::NotifyCustomLauncherPageAnimationChanged(double progress, |
| + int current_page, |
| + int target_page) { |
| + int custom_launcher_page_index = |
| + GetPageIndexForState(AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); |
| + if (custom_launcher_page_index == target_page) { |
| + app_list_main_view_->view_delegate()->CustomLauncherPageAnimationChanged( |
| + progress); |
| + } else if (custom_launcher_page_index == current_page) { |
| + app_list_main_view_->view_delegate()->CustomLauncherPageAnimationChanged( |
| + 1 - progress); |
| + } |
| +} |
| + |
| void ContentsView::UpdatePageBounds() { |
|
Matt Giuca
2014/11/07 06:46:29
I'm confused... I thought you were moving Paginati
calamity
2014/11/10 03:38:30
Avoided for now. This doesn't support observing an
|
| // The bounds calculations will potentially be mid-transition (depending on |
| // the state of the PaginationModel). |
| @@ -226,6 +248,8 @@ void ContentsView::UpdatePageBounds() { |
| } |
| } |
| + NotifyCustomLauncherPageAnimationChanged(progress, current_page, target_page); |
| + |
| // Move |current_page| from 0 to its origin. Move |target_page| from its |
| // origin to 0. |
| gfx::Rect on_screen(GetDefaultContentsBounds()); |