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. 4 5 #ifndef UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ 7 8 #include "base/basictypes.h" 9 #include "ui/app_list/app_list_model_observer.h" 10 #include "ui/app_list/app_list_view_delegate_observer.h" 11 #include "ui/app_list/views/search_box_view_delegate.h" 12 #include "ui/views/view.h" 13 14 namespace app_list { 15 16 class AppListMainView; 17 class AppListModel; 18 class AppListViewDelegate; 19 class SearchResultListView; 20 class TileItemView; 21 22 // The start page for the experimental app list. 23 class StartPageView : public views::View, 24 public SearchBoxViewDelegate, 25 public AppListViewDelegateObserver, 26 public AppListModelObserver { 27 public: 28 StartPageView(AppListMainView* app_list_main_view, 29 AppListViewDelegate* view_delegate); 30 virtual ~StartPageView(); 31 32 void Reset(); 33 void ShowSearchResults(); 34 35 bool IsShowingSearchResults() const; 36 tile_views()37 const std::vector<TileItemView*>& tile_views() const { return tile_views_; } dummy_search_box_view()38 SearchBoxView* dummy_search_box_view() { return search_box_view_; } 39 40 // Overridden from views::View: 41 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 42 virtual void Layout() OVERRIDE; 43 44 private: 45 enum ShowState { 46 SHOW_START_PAGE, 47 SHOW_SEARCH_RESULTS, 48 }; 49 50 void InitInstantContainer(); 51 void InitTilesContainer(); 52 53 void SetShowState(ShowState show_state); 54 void SetModel(AppListModel* model); 55 56 // Overridden from SearchBoxViewDelegate: 57 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; 58 59 // Overridden from AppListViewDelegateObserver: 60 virtual void OnProfilesChanged() OVERRIDE; 61 62 // Overridden from AppListModelObserver: 63 virtual void OnAppListModelStatusChanged() OVERRIDE; 64 virtual void OnAppListItemAdded(AppListItem* item) OVERRIDE; 65 virtual void OnAppListItemDeleted() OVERRIDE; 66 virtual void OnAppListItemUpdated(AppListItem* item) OVERRIDE; 67 68 // The parent view of ContentsView which is the parent of this view. 69 AppListMainView* app_list_main_view_; 70 71 AppListModel* model_; // Owned by AppListSyncableService. 72 73 AppListViewDelegate* view_delegate_; // Owned by AppListView. 74 75 SearchBoxView* search_box_view_; // Owned by views hierarchy. 76 SearchResultListView* results_view_; // Owned by views hierarchy. 77 views::View* instant_container_; // Owned by views hierarchy. 78 views::View* tiles_container_; // Owned by views hierarchy. 79 80 std::vector<TileItemView*> tile_views_; 81 82 ShowState show_state_; 83 84 DISALLOW_COPY_AND_ASSIGN(StartPageView); 85 }; 86 87 } // namespace app_list 88 89 #endif // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ 90