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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace app_list { | 22 namespace app_list { |
23 | 23 |
24 class AppsGridView; | 24 class AppsGridView; |
25 class ApplicationDragAndDropHost; | 25 class ApplicationDragAndDropHost; |
26 class AppListFolderItem; | 26 class AppListFolderItem; |
27 class AppListMainView; | 27 class AppListMainView; |
28 class AppListModel; | 28 class AppListModel; |
29 class AppListViewDelegate; | 29 class AppListViewDelegate; |
30 class AppsContainerView; | 30 class AppsContainerView; |
| 31 class ContentsSwitcherView; |
31 class PaginationModel; | 32 class PaginationModel; |
32 class SearchResultListView; | 33 class SearchResultListView; |
33 class StartPageView; | 34 class StartPageView; |
34 | 35 |
35 // A view to manage launcher pages within the Launcher (eg. start page, apps | 36 // A view to manage launcher pages within the Launcher (eg. start page, apps |
36 // grid view, search results). There can be any number of launcher pages, only | 37 // grid view, search results). There can be any number of launcher pages, only |
37 // one of which can be active at a given time. ContentsView provides the user | 38 // one of which can be active at a given time. ContentsView provides the user |
38 // interface for switching between launcher pages, and animates the transition | 39 // interface for switching between launcher pages, and animates the transition |
39 // between them. | 40 // between them. |
40 class APP_LIST_EXPORT ContentsView : public views::View, | 41 class APP_LIST_EXPORT ContentsView : public views::View, |
41 public PaginationModelObserver { | 42 public PaginationModelObserver { |
42 public: | 43 public: |
43 // Values of this enum denote special launcher pages that require hard-coding. | 44 // Values of this enum denote special launcher pages that require hard-coding. |
44 // Launcher pages are not required to have a NamedPage enum value. | 45 // Launcher pages are not required to have a NamedPage enum value. |
45 enum NamedPage { | 46 enum NamedPage { |
46 NAMED_PAGE_APPS, | 47 NAMED_PAGE_APPS, |
47 NAMED_PAGE_SEARCH_RESULTS, | 48 NAMED_PAGE_SEARCH_RESULTS, |
48 NAMED_PAGE_START, | 49 NAMED_PAGE_START, |
49 }; | 50 }; |
50 | 51 |
51 ContentsView(AppListMainView* app_list_main_view, | 52 ContentsView(AppListMainView* app_list_main_view, |
| 53 ContentsSwitcherView* contents_switcher_view, |
52 AppListModel* model, | 54 AppListModel* model, |
53 AppListViewDelegate* view_delegate); | 55 AppListViewDelegate* view_delegate); |
54 virtual ~ContentsView(); | 56 virtual ~ContentsView(); |
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 |
60 // operations outside the application list. | 62 // operations outside the application list. |
61 void SetDragAndDropHostOfCurrentAppList( | 63 void SetDragAndDropHostOfCurrentAppList( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 105 |
104 private: | 106 private: |
105 // Invoked when active view is changed. | 107 // Invoked when active view is changed. |
106 void ActivePageChanged(); | 108 void ActivePageChanged(); |
107 | 109 |
108 // Calculates and sets the bounds for the subviews. If there is currently an | 110 // Calculates and sets the bounds for the subviews. If there is currently an |
109 // animation, this positions the views as appropriate for the current frame. | 111 // animation, this positions the views as appropriate for the current frame. |
110 void UpdatePageBounds(); | 112 void UpdatePageBounds(); |
111 | 113 |
112 // Adds |view| as a new page to the end of the list of launcher pages. The | 114 // Adds |view| as a new page to the end of the list of launcher pages. The |
113 // view is inserted as a child of the ContentsView. There is no name | 115 // view is inserted as a child of the ContentsView, and a button with |
| 116 // |resource_id| is added to the ContentsSwitcherView. There is no name |
114 // associated with the page. Returns the index of the new page. | 117 // associated with the page. Returns the index of the new page. |
115 int AddLauncherPage(views::View* view); | 118 int AddLauncherPage(views::View* view, int resource_id); |
116 | 119 |
117 // Adds |view| as a new page to the end of the list of launcher pages. The | 120 // Adds |view| as a new page to the end of the list of launcher pages. The |
118 // view is inserted as a child of the ContentsView. The page is associated | 121 // view is inserted as a child of the ContentsView, and a button with |
| 122 // |resource_id| is added to the ContentsSwitcherView. The page is associated |
119 // with the name |named_page|. Returns the index of the new page. | 123 // with the name |named_page|. Returns the index of the new page. |
120 int AddLauncherPage(views::View* view, NamedPage named_page); | 124 int AddLauncherPage(views::View* view, int resource_id, NamedPage named_page); |
121 | 125 |
122 // Gets the PaginationModel owned by the AppsGridView. | 126 // Gets the PaginationModel owned by the AppsGridView. |
123 // Note: This is different to |pagination_model_|, which manages top-level | 127 // Note: This is different to |pagination_model_|, which manages top-level |
124 // launcher-page pagination. | 128 // launcher-page pagination. |
125 PaginationModel* GetAppsPaginationModel(); | 129 PaginationModel* GetAppsPaginationModel(); |
126 | 130 |
127 // Overridden from ui::EventHandler: | 131 // Overridden from ui::EventHandler: |
128 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 132 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
129 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 133 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
130 | 134 |
131 // Special sub views of the ContentsView. All owned by the views hierarchy. | 135 // Special sub views of the ContentsView. All owned by the views hierarchy. |
132 AppsContainerView* apps_container_view_; | 136 AppsContainerView* apps_container_view_; |
133 SearchResultListView* search_results_view_; | 137 SearchResultListView* search_results_view_; |
134 StartPageView* start_page_view_; | 138 StartPageView* start_page_view_; |
135 | 139 |
136 AppListMainView* app_list_main_view_; // Parent view, owns this. | 140 AppListMainView* app_list_main_view_; // Parent view, owns this. |
| 141 // Sibling view, owned by |app_list_main_view_|. |
| 142 ContentsSwitcherView* contents_switcher_view_; |
137 | 143 |
138 scoped_ptr<views::ViewModel> view_model_; | 144 scoped_ptr<views::ViewModel> view_model_; |
139 // Maps NamedPage onto |view_model_| indices. | 145 // Maps NamedPage onto |view_model_| indices. |
140 std::map<NamedPage, int> named_page_to_view_; | 146 std::map<NamedPage, int> named_page_to_view_; |
141 | 147 |
142 // Manages the pagination for the launcher pages. | 148 // Manages the pagination for the launcher pages. |
143 PaginationModel pagination_model_; | 149 PaginationModel pagination_model_; |
144 | 150 |
145 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 151 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
146 }; | 152 }; |
147 | 153 |
148 } // namespace app_list | 154 } // namespace app_list |
149 | 155 |
150 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 156 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |