Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / app_list / views / start_page_view.h
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_export.h"
10 #include "ui/app_list/views/search_box_view_delegate.h"
11 #include "ui/app_list/views/search_result_container_view.h"
12
13 namespace app_list {
14
15 class AllAppsTileItemView;
16 class AppListMainView;
17 class AppListViewDelegate;
18 class SearchResultListView;
19 class SearchResultTileItemView;
20 class TileItemView;
21
22 // The start page for the experimental app list.
23 class APP_LIST_EXPORT StartPageView : public SearchResultContainerView,
24                                       public SearchBoxViewDelegate {
25  public:
26   StartPageView(AppListMainView* app_list_main_view,
27                 AppListViewDelegate* view_delegate);
28   ~StartPageView() override;
29
30   void Reset();
31   void ShowSearchResults();
32
33   bool IsShowingSearchResults() const;
34
35   void UpdateForTesting();
36
37   const std::vector<SearchResultTileItemView*>& tile_views() const {
38     return search_result_tile_views_;
39   }
40   TileItemView* all_apps_button() const;
41   SearchBoxView* dummy_search_box_view() { return search_box_view_; }
42
43   // Overridden from views::View:
44   bool OnKeyPressed(const ui::KeyEvent& event) override;
45   void Layout() override;
46
47   // Overridden from SearchResultContainerView:
48   void Update() override;
49
50  private:
51   enum ShowState {
52     SHOW_START_PAGE,
53     SHOW_SEARCH_RESULTS,
54   };
55
56   void InitInstantContainer();
57   void InitTilesContainer();
58
59   void SetShowState(ShowState show_state);
60   void SetModel(AppListModel* model);
61
62   // Overridden from SearchBoxViewDelegate:
63   void QueryChanged(SearchBoxView* sender) override;
64
65   // The parent view of ContentsView which is the parent of this view.
66   AppListMainView* app_list_main_view_;
67
68   AppListViewDelegate* view_delegate_;  // Owned by AppListView.
69
70   SearchBoxView* search_box_view_;      // Owned by views hierarchy.
71   SearchResultListView* results_view_;  // Owned by views hierarchy.
72   views::View* instant_container_;  // Owned by views hierarchy.
73   views::View* tiles_container_;    // Owned by views hierarchy.
74
75   std::vector<SearchResultTileItemView*> search_result_tile_views_;
76   AllAppsTileItemView* all_apps_button_;
77
78   ShowState show_state_;
79
80   DISALLOW_COPY_AND_ASSIGN(StartPageView);
81 };
82
83 }  // namespace app_list
84
85 #endif  // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_