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