Chromium Code Reviews| 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> | 
| 11 | 11 | 
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" | 
| 13 #include "base/macros.h" | 13 #include "base/macros.h" | 
| 14 #include "ui/app_list/app_list_export.h" | 14 #include "ui/app_list/app_list_export.h" | 
| 15 #include "ui/app_list/app_list_model.h" | 15 #include "ui/app_list/app_list_model.h" | 
| 16 #include "ui/app_list/app_list_model_observer.h" | 16 #include "ui/app_list/app_list_model_observer.h" | 
| 17 #include "ui/app_list/pagination_model.h" | 17 #include "ui/app_list/pagination_model.h" | 
| 18 #include "ui/app_list/pagination_model_observer.h" | 18 #include "ui/app_list/pagination_model_observer.h" | 
| 19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" | 
| 20 #include "ui/views/view_model.h" | 20 #include "ui/views/view_model.h" | 
| 21 | 21 | 
| 22 namespace gfx { | 22 namespace gfx { | 
| 23 class Rect; | 23 class Rect; | 
| 24 } | 24 } | 
| 25 | 25 | 
| 26 namespace app_list { | 26 namespace app_list { | 
| 27 | 27 | 
| 28 class AppsGridView; | 28 class AppsGridView; | 
| 29 class AppListPage; | 29 class AppListPage; | 
| 30 class AppListView; | |
| 30 class ApplicationDragAndDropHost; | 31 class ApplicationDragAndDropHost; | 
| 31 class AppListFolderItem; | 32 class AppListFolderItem; | 
| 32 class AppListMainView; | 33 class AppListMainView; | 
| 33 class AppsContainerView; | 34 class AppsContainerView; | 
| 34 class CustomLauncherPageView; | 35 class CustomLauncherPageView; | 
| 35 class PaginationModel; | 36 class PaginationModel; | 
| 36 class SearchBoxView; | 37 class SearchBoxView; | 
| 37 class SearchResultPageView; | 38 class SearchResultPageView; | 
| 38 class StartPageView; | 39 class StartPageView; | 
| 39 | 40 | 
| 40 // A view to manage launcher pages within the Launcher (eg. start page, apps | 41 // A view to manage launcher pages within the Launcher (eg. start page, apps | 
| 41 // grid view, search results). There can be any number of launcher pages, only | 42 // grid view, search results). There can be any number of launcher pages, only | 
| 42 // one of which can be active at a given time. ContentsView provides the user | 43 // one of which can be active at a given time. ContentsView provides the user | 
| 43 // interface for switching between launcher pages, and animates the transition | 44 // interface for switching between launcher pages, and animates the transition | 
| 44 // between them. | 45 // between them. | 
| 45 class APP_LIST_EXPORT ContentsView : public views::View, | 46 class APP_LIST_EXPORT ContentsView : public views::View, | 
| 46 public PaginationModelObserver, | 47 public PaginationModelObserver, | 
| 47 public AppListModelObserver { | 48 public AppListModelObserver { | 
| 48 public: | 49 public: | 
| 49 explicit ContentsView(AppListMainView* app_list_main_view); | 50 explicit ContentsView(AppListMainView* app_list_main_view, | 
| 
 
xiyuan
2017/05/30 22:18:50
nit: remove "explicit". It is only needed for sing
 
newcomer
2017/06/01 01:42:54
Done.
 
 | |
| 51 AppListView* app_list_view); | |
| 50 ~ContentsView() override; | 52 ~ContentsView() override; | 
| 51 | 53 | 
| 52 // Initialize the pages of the launcher. Should be called after | 54 // Initialize the pages of the launcher. Should be called after | 
| 53 // set_contents_switcher_view(). | 55 // set_contents_switcher_view(). | 
| 54 void Init(AppListModel* model); | 56 void Init(AppListModel* model); | 
| 55 | 57 | 
| 56 // The app list gets closed and drag and drop operations need to be cancelled. | 58 // The app list gets closed and drag and drop operations need to be cancelled. | 
| 57 void CancelDrag(); | 59 void CancelDrag(); | 
| 58 | 60 | 
| 59 // If |drag_and_drop| is not NULL it will be called upon drag and drop | 61 // If |drag_and_drop| is not NULL it will be called upon drag and drop | 
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 // Unowned pointer to the container of the search answer web view. This | 195 // Unowned pointer to the container of the search answer web view. This | 
| 194 // container view is a sub-view of search_results_page_view_. | 196 // container view is a sub-view of search_results_page_view_. | 
| 195 View* search_answer_container_view_; | 197 View* search_answer_container_view_; | 
| 196 | 198 | 
| 197 // The child page views. Owned by the views hierarchy. | 199 // The child page views. Owned by the views hierarchy. | 
| 198 std::vector<AppListPage*> app_list_pages_; | 200 std::vector<AppListPage*> app_list_pages_; | 
| 199 | 201 | 
| 200 // Parent view. Owned by the views hierarchy. | 202 // Parent view. Owned by the views hierarchy. | 
| 201 AppListMainView* app_list_main_view_; | 203 AppListMainView* app_list_main_view_; | 
| 202 | 204 | 
| 205 // Owned by the views hierarchy. | |
| 206 AppListView* const app_list_view_; | |
| 207 | |
| 203 // Maps State onto |view_model_| indices. | 208 // Maps State onto |view_model_| indices. | 
| 204 std::map<AppListModel::State, int> state_to_view_; | 209 std::map<AppListModel::State, int> state_to_view_; | 
| 205 | 210 | 
| 206 // Maps |view_model_| indices onto State. | 211 // Maps |view_model_| indices onto State. | 
| 207 std::map<int, AppListModel::State> view_to_state_; | 212 std::map<int, AppListModel::State> view_to_state_; | 
| 208 | 213 | 
| 209 // The page that was showing before ShowSearchResults(true) was invoked. | 214 // The page that was showing before ShowSearchResults(true) was invoked. | 
| 210 int page_before_search_; | 215 int page_before_search_; | 
| 211 | 216 | 
| 212 // Manages the pagination for the launcher pages. | 217 // Manages the pagination for the launcher pages. | 
| 213 PaginationModel pagination_model_; | 218 PaginationModel pagination_model_; | 
| 214 | 219 | 
| 215 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 220 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 
| 216 }; | 221 }; | 
| 217 | 222 | 
| 218 } // namespace app_list | 223 } // namespace app_list | 
| 219 | 224 | 
| 220 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 225 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 
| OLD | NEW |