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