OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "ui/app_list/app_list_export.h" | 11 #include "ui/app_list/app_list_export.h" |
12 #include "ui/app_list/views/search_result_container_view.h" | 12 #include "ui/views/view.h" |
13 | 13 |
14 namespace app_list { | 14 namespace app_list { |
15 | 15 |
16 class AllAppsTileItemView; | 16 class AllAppsTileItemView; |
17 class AppListMainView; | 17 class AppListMainView; |
18 class AppListViewDelegate; | 18 class AppListViewDelegate; |
19 class SearchResultTileItemView; | 19 class SearchResultTileItemView; |
| 20 class StartPageTilesContainer; |
20 class TileItemView; | 21 class TileItemView; |
21 | 22 |
22 // The start page for the experimental app list. | 23 // The start page for the experimental app list. |
23 class APP_LIST_EXPORT StartPageView : public SearchResultContainerView { | 24 class APP_LIST_EXPORT StartPageView : public views::View { |
24 public: | 25 public: |
25 StartPageView(AppListMainView* app_list_main_view, | 26 StartPageView(AppListMainView* app_list_main_view, |
26 AppListViewDelegate* view_delegate); | 27 AppListViewDelegate* view_delegate); |
27 ~StartPageView() override; | 28 ~StartPageView() override; |
28 | 29 |
29 void Reset(); | 30 void Reset(); |
30 | 31 |
31 void UpdateForTesting(); | 32 void UpdateForTesting(); |
32 | 33 |
33 const std::vector<SearchResultTileItemView*>& tile_views() const { | 34 const std::vector<SearchResultTileItemView*>& tile_views() const; |
34 return search_result_tile_views_; | |
35 } | |
36 TileItemView* all_apps_button() const; | 35 TileItemView* all_apps_button() const; |
37 | 36 |
38 // Called when the start page view is displayed. | 37 // Called when the start page view is displayed. |
39 void OnShow(); | 38 void OnShow(); |
40 | 39 |
41 // Called when the start page view is hidden (while the app list is still | 40 // Called when the start page view is hidden (while the app list is still |
42 // open). | 41 // open). |
43 void OnHide(); | 42 void OnHide(); |
44 | 43 |
45 // Overridden from views::View: | 44 // Overridden from views::View: |
46 void Layout() override; | 45 void Layout() override; |
47 bool OnKeyPressed(const ui::KeyEvent& event) override; | 46 bool OnKeyPressed(const ui::KeyEvent& event) override; |
48 | 47 |
49 // Overridden from SearchResultContainerView: | |
50 void OnContainerSelected(bool from_bottom) override; | |
51 | |
52 // Returns search box bounds to use when the start page is active. | 48 // Returns search box bounds to use when the start page is active. |
53 gfx::Rect GetSearchBoxBounds() const; | 49 gfx::Rect GetSearchBoxBounds() const; |
54 | 50 |
55 // Updates whether the custom page clickzone is visible. | 51 // Updates whether the custom page clickzone is visible. |
56 void UpdateCustomPageClickzoneVisibility(); | 52 void UpdateCustomPageClickzoneVisibility(); |
57 | 53 |
58 private: | 54 private: |
59 // Overridden from SearchResultContainerView: | |
60 int Update() override; | |
61 void UpdateSelectedIndex(int old_selected, int new_selected) override; | |
62 | |
63 void InitInstantContainer(); | 55 void InitInstantContainer(); |
64 void InitTilesContainer(); | |
65 | 56 |
66 TileItemView* GetTileItemView(size_t index); | 57 TileItemView* GetTileItemView(size_t index); |
67 | 58 |
68 // The parent view of ContentsView which is the parent of this view. | 59 // The parent view of ContentsView which is the parent of this view. |
69 AppListMainView* app_list_main_view_; | 60 AppListMainView* app_list_main_view_; |
70 | 61 |
71 AppListViewDelegate* view_delegate_; // Owned by AppListView. | 62 AppListViewDelegate* view_delegate_; // Owned by AppListView. |
72 | 63 |
73 views::View* search_box_spacer_view_; // Owned by views hierarchy. | 64 views::View* search_box_spacer_view_; // Owned by views hierarchy. |
74 views::View* instant_container_; // Owned by views hierarchy. | 65 views::View* instant_container_; // Owned by views hierarchy. |
75 views::View* tiles_container_; // Owned by views hierarchy. | 66 StartPageTilesContainer* tiles_container_; // Owned by views hierarchy. |
76 | |
77 std::vector<SearchResultTileItemView*> search_result_tile_views_; | |
78 AllAppsTileItemView* all_apps_button_; | |
79 | 67 |
80 DISALLOW_COPY_AND_ASSIGN(StartPageView); | 68 DISALLOW_COPY_AND_ASSIGN(StartPageView); |
81 }; | 69 }; |
82 | 70 |
83 } // namespace app_list | 71 } // namespace app_list |
84 | 72 |
85 #endif // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ | 73 #endif // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ |
OLD | NEW |