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