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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/views/contents_view.h" 5 #include "ui/app_list/views/contents_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 gfx::Rect ContentsView::GetSearchBoxBoundsForState( 365 gfx::Rect ContentsView::GetSearchBoxBoundsForState(
366 AppListModel::State state) const { 366 AppListModel::State state) const {
367 // On the start page, the search box is in a different location. 367 // On the start page, the search box is in a different location.
368 if (state == AppListModel::STATE_START) { 368 if (state == AppListModel::STATE_START) {
369 DCHECK(start_page_view_); 369 DCHECK(start_page_view_);
370 // Convert to ContentsView space, assuming that the StartPageView is in the 370 // Convert to ContentsView space, assuming that the StartPageView is in the
371 // ContentsView's default bounds. 371 // ContentsView's default bounds.
372 return start_page_view_->GetSearchBoxBounds() + 372 return start_page_view_->GetSearchBoxBounds() +
373 GetDefaultContentsBounds().OffsetFromOrigin(); 373 default_animator_->GetOnscreenPageBounds(GetPageIndexForState(state))
374 .OffsetFromOrigin();
374 } 375 }
375 376
376 return GetDefaultSearchBoxBounds(); 377 return GetDefaultSearchBoxBounds();
377 } 378 }
378 379
379 gfx::Rect ContentsView::GetSearchBoxBoundsForPageIndex(int index) const { 380 gfx::Rect ContentsView::GetSearchBoxBoundsForPageIndex(int index) const {
380 return GetSearchBoxBoundsForState(GetStateForPageIndex(index)); 381 return GetSearchBoxBoundsForState(GetStateForPageIndex(index));
381 } 382 }
382 383
383 gfx::Rect ContentsView::GetDefaultContentsBounds() const { 384 gfx::Rect ContentsView::GetDefaultContentsBounds() const {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 GetSearchBoxView()->GetViewBoundsForSearchBoxContentsBounds( 453 GetSearchBoxView()->GetViewBoundsForSearchBoxContentsBounds(
453 search_box_bounds))); 454 search_box_bounds)));
454 } 455 }
455 456
456 // Immediately finish all current animations. 457 // Immediately finish all current animations.
457 pagination_model_.FinishAnimation(); 458 pagination_model_.FinishAnimation();
458 459
459 // Move the current view onto the screen, and all other views off screen to 460 // Move the current view onto the screen, and all other views off screen to
460 // the left. (Since we are not animating, we don't need to be careful about 461 // the left. (Since we are not animating, we don't need to be careful about
461 // which side we place the off-screen views onto.) 462 // which side we place the off-screen views onto.)
462 gfx::Rect rect(GetDefaultContentsBounds()); 463 gfx::Rect rect =
463 // Custom pages are aligned to the top of the window, not under the search 464 default_animator_->GetOnscreenPageBounds(GetActivePageIndex());
464 // box. 465 double progress =
465 double progress = 0; 466 IsStateActive(AppListModel::STATE_CUSTOM_LAUNCHER_PAGE) ? 1 : 0;
466 if (IsStateActive(AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) {
467 rect = GetContentsBounds();
468 progress = 1;
469 }
470 467
471 // Notify the custom launcher page that the active page has changed. 468 // Notify the custom launcher page that the active page has changed.
472 app_list_main_view_->view_delegate()->CustomLauncherPageAnimationChanged( 469 app_list_main_view_->view_delegate()->CustomLauncherPageAnimationChanged(
473 progress); 470 progress);
474 471
475 if (rect.IsEmpty()) 472 if (rect.IsEmpty())
476 return; 473 return;
477 474
478 gfx::Rect offscreen_target(rect); 475 gfx::Rect offscreen_target(rect);
479 offscreen_target.set_x(-rect.width()); 476 offscreen_target.set_x(-rect.width());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 511 }
515 512
516 void ContentsView::TransitionStarted() { 513 void ContentsView::TransitionStarted() {
517 } 514 }
518 515
519 void ContentsView::TransitionChanged() { 516 void ContentsView::TransitionChanged() {
520 UpdatePageBounds(); 517 UpdatePageBounds();
521 } 518 }
522 519
523 } // namespace app_list 520 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698