Disable flaky UnloadTest.CrossSiteInfiniteBeforeUnloadSync on Mac.
[chromium-blink-merge.git] / ui / app_list / views / custom_launcher_page_view.cc
blobc6934ef4b401a0110d4fe25dfa2a93f4b630205d
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/app_list/views/custom_launcher_page_view.h"
7 #include "ui/app_list/app_list_constants.h"
8 #include "ui/views/layout/fill_layout.h"
10 namespace app_list {
12 CustomLauncherPageView::CustomLauncherPageView(
13 View* custom_launcher_page_contents)
14 : custom_launcher_page_contents_(custom_launcher_page_contents) {
15 SetLayoutManager(new views::FillLayout());
16 AddChildView(custom_launcher_page_contents_);
19 CustomLauncherPageView::~CustomLauncherPageView() {
22 gfx::Rect CustomLauncherPageView::GetCollapsedLauncherPageBounds() const {
23 gfx::Rect rect = GetFullContentsBounds();
24 int page_height = rect.height();
25 rect.set_y(page_height - kCustomPageCollapsedHeight);
26 return rect;
29 gfx::Rect CustomLauncherPageView::GetPageBoundsForState(
30 AppListModel::State state) const {
31 gfx::Rect onscreen_bounds = GetFullContentsBounds();
32 switch (state) {
33 case AppListModel::STATE_CUSTOM_LAUNCHER_PAGE:
34 return onscreen_bounds;
35 case AppListModel::STATE_START:
36 return GetCollapsedLauncherPageBounds();
37 default:
38 return GetBelowContentsOffscreenBounds(onscreen_bounds.size());
42 void CustomLauncherPageView::OnShown() {
43 custom_launcher_page_contents_->SetFocusable(true);
46 void CustomLauncherPageView::OnWillBeHidden() {
47 custom_launcher_page_contents_->SetFocusable(false);
50 } // namespace app_list