1 // Copyright 2014 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 #ifndef ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_
6 #define ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_
8 #include "athena/athena_export.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ui/app_list/views/search_box_view_delegate.h"
11 #include "ui/gfx/animation/tween.h"
12 #include "ui/views/view.h"
15 class AppListViewDelegate
;
17 class SearchResultListView
;
22 class ATHENA_EXPORT AthenaStartPageView
24 public app_list::SearchBoxViewDelegate
{
26 explicit AthenaStartPageView(app_list::AppListViewDelegate
* delegate
);
27 virtual ~AthenaStartPageView();
29 // Requests the focus on the search box in the start page view.
30 void RequestFocusOnSearchBox();
32 // Updates the layout state. See the comment of |layout_state_| field.
33 void SetLayoutState(float layout_state
);
35 // Updates the layout state and move the subviews to the target location with
37 void SetLayoutStateWithAnimation(float layout_state
,
38 gfx::Tween::Type tween_type
);
41 friend class AthenaStartPageViewTest
;
43 static const char kViewClassName
[];
45 // A struct which bundles the layout data of subviews.
50 float system_info_opacity
;
52 float background_opacity
;
57 // Returns the bounds for |VISIBLE_BOTTOM|.
58 LayoutData
CreateBottomBounds(int width
);
60 // Returns the bounds for |VISIBLE_CENTERED|.
61 LayoutData
CreateCenteredBounds(int width
);
63 // Schedules the animation for the layout the search box and the search
65 void LayoutSearchResults(bool should_show_search_results
);
67 // Called when the animation of search box / search results layout has
69 void OnSearchResultLayoutAnimationCompleted(bool should_show_search_results
);
72 virtual void Layout() OVERRIDE
;
73 virtual bool OnKeyPressed(const ui::KeyEvent
& key_event
) OVERRIDE
;
75 // app_list::SearchBoxViewDelegate:
76 virtual void QueryChanged(app_list::SearchBoxView
* sender
) OVERRIDE
;
79 app_list::AppListViewDelegate
* delegate_
;
81 // Views are owned through its hierarchy.
82 views::View
* system_info_view_
;
83 views::View
* app_icon_container_
;
84 views::View
* search_box_container_
;
85 views::View
* control_icon_container_
;
87 app_list::SearchBoxView
* search_box_view_
;
88 app_list::SearchResultListView
* search_results_view_
;
90 // Do not use views::Background but a views::View with ui::Layer for gradient
91 // background opacity update and animation.
92 views::View
* background_
;
94 // The expected height of |search_results_view_|
95 int search_results_height_
;
97 // The state to specify how each of the subviews should be laid out, in the
98 // range of [0, 1]. 0 means fully BOTTOM state, and 1 is fully CENTERED state.
101 base::WeakPtrFactory
<AthenaStartPageView
> weak_factory_
;
103 DISALLOW_COPY_AND_ASSIGN(AthenaStartPageView
);
106 } // namespace athena
108 #endif // ATHENA_HOME_ATHENA_START_PAGE_VIEW_H_