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

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

Issue 889403005: Make start page fill app list bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_apps_grid_paddings
Patch Set: address_comment Created 5 years, 10 months 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') | ui/app_list/views/start_page_view.cc » ('j') | 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 1e299d706a7abd58dcb2d8cb63ac79bbe2cb4f2a..3895c96f151ecea80e43c4b16827128d06d55b56 100644
--- a/ui/app_list/views/contents_view.cc
+++ b/ui/app_list/views/contents_view.cc
@@ -352,6 +352,26 @@ int ContentsView::AddLauncherPage(views::View* view,
return page_index;
}
+gfx::Rect ContentsView::GetOnscreenPageBounds(int page_index) const {
+ AppListModel::State state = GetStateForPageIndex(page_index);
+ bool fills_contents_view =
+ state == AppListModel::STATE_CUSTOM_LAUNCHER_PAGE ||
+ state == AppListModel::STATE_START;
+ return fills_contents_view ? GetContentsBounds() : GetDefaultContentsBounds();
+}
+
+gfx::Rect ContentsView::GetOffscreenPageBounds(int page_index) const {
+ AppListModel::State state = GetStateForPageIndex(page_index);
+ gfx::Rect bounds(GetOnscreenPageBounds(page_index));
+ // The start page and search page origins are above; all other pages' origins
+ // are below.
+ bool origin_above = state == AppListModel::STATE_START ||
+ state == AppListModel::STATE_SEARCH_RESULTS;
+ bounds.set_y(origin_above ? -bounds.height()
+ : GetContentsBounds().height() + bounds.y());
+ return bounds;
+}
+
gfx::Rect ContentsView::GetDefaultSearchBoxBounds() const {
gfx::Rect search_box_bounds(0, 0, GetDefaultContentsSize().width(),
GetSearchBoxView()->GetPreferredSize().height());
@@ -370,7 +390,8 @@ gfx::Rect ContentsView::GetSearchBoxBoundsForState(
// Convert to ContentsView space, assuming that the StartPageView is in the
// ContentsView's default bounds.
return start_page_view_->GetSearchBoxBounds() +
- GetDefaultContentsBounds().OffsetFromOrigin();
+ GetOnscreenPageBounds(GetPageIndexForState(state))
+ .OffsetFromOrigin();
}
return GetDefaultSearchBoxBounds();
@@ -459,14 +480,9 @@ void ContentsView::Layout() {
// Move the current view onto the screen, and all other views off screen to
// the left. (Since we are not animating, we don't need to be careful about
// which side we place the off-screen views onto.)
- gfx::Rect rect(GetDefaultContentsBounds());
- // Custom pages are aligned to the top of the window, not under the search
- // box.
- double progress = 0;
- if (IsStateActive(AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) {
- rect = GetContentsBounds();
- progress = 1;
- }
+ gfx::Rect rect = GetOnscreenPageBounds(GetActivePageIndex());
+ double progress =
+ IsStateActive(AppListModel::STATE_CUSTOM_LAUNCHER_PAGE) ? 1 : 0;
// Notify the custom launcher page that the active page has changed.
app_list_main_view_->view_delegate()->CustomLauncherPageAnimationChanged(
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698