| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ui/app_list/app_list_export.h" | 10 #include "ui/app_list/app_list_export.h" |
| 11 #include "ui/app_list/app_list_model.h" | 11 #include "ui/app_list/app_list_model.h" |
| 12 #include "ui/app_list/app_list_view_delegate_observer.h" | 12 #include "ui/app_list/app_list_view_delegate_observer.h" |
| 13 #include "ui/app_list/views/search_box_view_delegate.h" | 13 #include "ui/app_list/views/search_box_view_delegate.h" |
| 14 #include "ui/base/models/list_model_observer.h" | 14 #include "ui/base/models/list_model_observer.h" |
| 15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
| 16 | 16 |
| 17 namespace app_list { | 17 namespace app_list { |
| 18 | 18 |
| 19 class AllAppsTileItemView; |
| 19 class AppListMainView; | 20 class AppListMainView; |
| 20 class AppListViewDelegate; | 21 class AppListViewDelegate; |
| 21 class SearchResultListView; | 22 class SearchResultListView; |
| 23 class SearchResultTileItemView; |
| 22 class TileItemView; | 24 class TileItemView; |
| 23 | 25 |
| 24 // The start page for the experimental app list. | 26 // The start page for the experimental app list. |
| 25 class APP_LIST_EXPORT StartPageView : public views::View, | 27 class APP_LIST_EXPORT StartPageView : public views::View, |
| 26 public ui::ListModelObserver, | 28 public ui::ListModelObserver, |
| 27 public SearchBoxViewDelegate { | 29 public SearchBoxViewDelegate { |
| 28 public: | 30 public: |
| 29 StartPageView(AppListMainView* app_list_main_view, | 31 StartPageView(AppListMainView* app_list_main_view, |
| 30 AppListViewDelegate* view_delegate); | 32 AppListViewDelegate* view_delegate); |
| 31 ~StartPageView() override; | 33 ~StartPageView() override; |
| 32 | 34 |
| 33 void Reset(); | 35 void Reset(); |
| 34 void ShowSearchResults(); | 36 void ShowSearchResults(); |
| 35 | 37 |
| 36 bool IsShowingSearchResults() const; | 38 bool IsShowingSearchResults() const; |
| 37 | 39 |
| 38 void UpdateForTesting(); | 40 void UpdateForTesting(); |
| 39 | 41 |
| 40 const std::vector<TileItemView*>& tile_views() const { return tile_views_; } | 42 const std::vector<SearchResultTileItemView*>& tile_views() const { |
| 43 return search_result_tile_views_; |
| 44 } |
| 45 TileItemView* all_apps_button() const; |
| 41 SearchBoxView* dummy_search_box_view() { return search_box_view_; } | 46 SearchBoxView* dummy_search_box_view() { return search_box_view_; } |
| 42 | 47 |
| 43 // Overridden from views::View: | 48 // Overridden from views::View: |
| 44 bool OnKeyPressed(const ui::KeyEvent& event) override; | 49 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 45 void Layout() override; | 50 void Layout() override; |
| 46 | 51 |
| 47 private: | 52 private: |
| 48 enum ShowState { | 53 enum ShowState { |
| 49 SHOW_START_PAGE, | 54 SHOW_START_PAGE, |
| 50 SHOW_SEARCH_RESULTS, | 55 SHOW_SEARCH_RESULTS, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 AppListModel::SearchResults* | 83 AppListModel::SearchResults* |
| 79 search_results_model_; // Owned by AppListSyncableService. | 84 search_results_model_; // Owned by AppListSyncableService. |
| 80 | 85 |
| 81 AppListViewDelegate* view_delegate_; // Owned by AppListView. | 86 AppListViewDelegate* view_delegate_; // Owned by AppListView. |
| 82 | 87 |
| 83 SearchBoxView* search_box_view_; // Owned by views hierarchy. | 88 SearchBoxView* search_box_view_; // Owned by views hierarchy. |
| 84 SearchResultListView* results_view_; // Owned by views hierarchy. | 89 SearchResultListView* results_view_; // Owned by views hierarchy. |
| 85 views::View* instant_container_; // Owned by views hierarchy. | 90 views::View* instant_container_; // Owned by views hierarchy. |
| 86 views::View* tiles_container_; // Owned by views hierarchy. | 91 views::View* tiles_container_; // Owned by views hierarchy. |
| 87 | 92 |
| 88 std::vector<TileItemView*> tile_views_; | 93 std::vector<SearchResultTileItemView*> search_result_tile_views_; |
| 94 AllAppsTileItemView* all_apps_button_; |
| 89 | 95 |
| 90 ShowState show_state_; | 96 ShowState show_state_; |
| 91 | 97 |
| 92 // ScheduleUpdate() generates a single weak pointer; if one exists then an | 98 // ScheduleUpdate() generates a single weak pointer; if one exists then an |
| 93 // update is pending. Further calls to ScheduleUpdate() will have no effect. | 99 // update is pending. Further calls to ScheduleUpdate() will have no effect. |
| 94 // Once the Update() completes, the weak pointer is invalidated. | 100 // Once the Update() completes, the weak pointer is invalidated. |
| 95 base::WeakPtrFactory<StartPageView> update_factory_; | 101 base::WeakPtrFactory<StartPageView> update_factory_; |
| 96 | 102 |
| 97 DISALLOW_COPY_AND_ASSIGN(StartPageView); | 103 DISALLOW_COPY_AND_ASSIGN(StartPageView); |
| 98 }; | 104 }; |
| 99 | 105 |
| 100 } // namespace app_list | 106 } // namespace app_list |
| 101 | 107 |
| 102 #endif // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ | 108 #endif // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ |
| OLD | NEW |