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

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: 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
« ui/app_list/views/contents_view.h ('K') | « 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..e8efd76a0e0b96ccf18a56fc1f53063f4e6dd649 100644
--- a/ui/app_list/views/contents_view.cc
+++ b/ui/app_list/views/contents_view.cc
@@ -49,6 +49,8 @@ void ContentsView::Init(AppListModel* model,
AppListViewDelegate* view_delegate) {
DCHECK(model);
+ view_delegate_ = view_delegate;
+
if (app_list::switches::IsExperimentalAppListEnabled()) {
std::vector<views::View*> custom_page_views =
view_delegate->CreateCustomPageWebViews(GetLocalBounds().size());
@@ -56,7 +58,15 @@ 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 +221,17 @@ 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)
+ view_delegate_->CustomLauncherPageAnimationChanged(progress);
+ else if (custom_launcher_page_index == current_page)
+ 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 +247,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());
« ui/app_list/views/contents_view.h ('K') | « 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