OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CONTENTS_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // grid view, search results). There can be any number of launcher pages, only | 43 // grid view, search results). There can be any number of launcher pages, only |
44 // one of which can be active at a given time. ContentsView provides the user | 44 // one of which can be active at a given time. ContentsView provides the user |
45 // interface for switching between launcher pages, and animates the transition | 45 // interface for switching between launcher pages, and animates the transition |
46 // between them. | 46 // between them. |
47 class APP_LIST_EXPORT ContentsView : public views::View, | 47 class APP_LIST_EXPORT ContentsView : public views::View, |
48 public PaginationModelObserver { | 48 public PaginationModelObserver { |
49 public: | 49 public: |
50 explicit ContentsView(AppListMainView* app_list_main_view); | 50 explicit ContentsView(AppListMainView* app_list_main_view); |
51 ~ContentsView() override; | 51 ~ContentsView() override; |
52 | 52 |
53 // Initialize the pages of the launcher. In the experimental launcher, should | 53 // Initialize the pages of the launcher. Should be called after |
54 // be called after set_contents_switcher_view(), or switcher buttons will not | 54 // set_contents_switcher_view(). |
55 // be created. | |
56 void Init(AppListModel* model); | 55 void Init(AppListModel* model); |
57 | 56 |
58 // The app list gets closed and drag and drop operations need to be cancelled. | 57 // The app list gets closed and drag and drop operations need to be cancelled. |
59 void CancelDrag(); | 58 void CancelDrag(); |
60 | 59 |
61 // If |drag_and_drop| is not NULL it will be called upon drag and drop | 60 // If |drag_and_drop| is not NULL it will be called upon drag and drop |
62 // operations outside the application list. | 61 // operations outside the application list. |
63 void SetDragAndDropHostOfCurrentAppList( | 62 void SetDragAndDropHostOfCurrentAppList( |
64 ApplicationDragAndDropHost* drag_and_drop_host); | 63 ApplicationDragAndDropHost* drag_and_drop_host); |
65 | 64 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Adds |view| as a new page to the end of the list of launcher pages. The | 171 // Adds |view| as a new page to the end of the list of launcher pages. The |
173 // view is inserted as a child of the ContentsView. The page is associated | 172 // view is inserted as a child of the ContentsView. The page is associated |
174 // with the name |state|. Returns the index of the new page. | 173 // with the name |state|. Returns the index of the new page. |
175 int AddLauncherPage(AppListPage* view, AppListModel::State state); | 174 int AddLauncherPage(AppListPage* view, AppListModel::State state); |
176 | 175 |
177 // Gets the PaginationModel owned by the AppsGridView. | 176 // Gets the PaginationModel owned by the AppsGridView. |
178 // Note: This is different to |pagination_model_|, which manages top-level | 177 // Note: This is different to |pagination_model_|, which manages top-level |
179 // launcher-page pagination. | 178 // launcher-page pagination. |
180 PaginationModel* GetAppsPaginationModel(); | 179 PaginationModel* GetAppsPaginationModel(); |
181 | 180 |
182 // Special sub views of the ContentsView. All owned by the views hierarchy. | 181 // Sub-views of the ContentsView. All owned by the views hierarchy. |
183 AppsContainerView* apps_container_view_; | 182 AppsContainerView* apps_container_view_; |
184 SearchResultPageView* search_results_page_view_; | 183 SearchResultPageView* search_results_page_view_; |
185 | |
186 // Only used in the experimental app list. | |
187 StartPageView* start_page_view_; | 184 StartPageView* start_page_view_; |
188 CustomLauncherPageView* custom_page_view_; | 185 CustomLauncherPageView* custom_page_view_; |
189 | 186 |
190 // The child page views. Owned by the views hierarchy. | 187 // The child page views. Owned by the views hierarchy. |
191 std::vector<AppListPage*> app_list_pages_; | 188 std::vector<AppListPage*> app_list_pages_; |
192 | 189 |
193 // Parent view. Owned by the views hierarchy. | 190 // Parent view. Owned by the views hierarchy. |
194 AppListMainView* app_list_main_view_; | 191 AppListMainView* app_list_main_view_; |
195 | 192 |
196 // Maps State onto |view_model_| indices. | 193 // Maps State onto |view_model_| indices. |
197 std::map<AppListModel::State, int> state_to_view_; | 194 std::map<AppListModel::State, int> state_to_view_; |
198 | 195 |
199 // Maps |view_model_| indices onto State. | 196 // Maps |view_model_| indices onto State. |
200 std::map<int, AppListModel::State> view_to_state_; | 197 std::map<int, AppListModel::State> view_to_state_; |
201 | 198 |
202 // The page that was showing before ShowSearchResults(true) was invoked. | 199 // The page that was showing before ShowSearchResults(true) was invoked. |
203 int page_before_search_; | 200 int page_before_search_; |
204 | 201 |
205 // Manages the pagination for the launcher pages. | 202 // Manages the pagination for the launcher pages. |
206 PaginationModel pagination_model_; | 203 PaginationModel pagination_model_; |
207 | 204 |
208 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 205 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
209 }; | 206 }; |
210 | 207 |
211 } // namespace app_list | 208 } // namespace app_list |
212 | 209 |
213 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 210 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |