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