Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: ui/app_list/views/contents_view.cc

Issue 683703002: Notify launcher page with onTransitionChanged event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@launcher_page_api_show_state_notify
Patch Set: fix mac compile Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
// 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());
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698