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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "ui/app_list/app_list_export.h" | 13 #include "ui/app_list/app_list_export.h" |
14 #include "ui/app_list/pagination_model.h" | 14 #include "ui/app_list/pagination_model.h" |
15 #include "ui/app_list/pagination_model_observer.h" | 15 #include "ui/app_list/pagination_model_observer.h" |
16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
17 | 17 |
18 namespace gfx { | |
19 class Rect; | |
20 } | |
21 | |
18 namespace views { | 22 namespace views { |
19 class ViewModel; | 23 class ViewModel; |
20 } | 24 } |
21 | 25 |
22 namespace app_list { | 26 namespace app_list { |
23 | 27 |
24 class AppsGridView; | 28 class AppsGridView; |
25 class ApplicationDragAndDropHost; | 29 class ApplicationDragAndDropHost; |
26 class AppListFolderItem; | 30 class AppListFolderItem; |
27 class AppListMainView; | 31 class AppListMainView; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 81 |
78 // Sets the active launcher page and animates the pages into place. | 82 // Sets the active launcher page and animates the pages into place. |
79 void SetActivePage(int page_index); | 83 void SetActivePage(int page_index); |
80 | 84 |
81 // The index of the currently active launcher page. | 85 // The index of the currently active launcher page. |
82 int GetActivePageIndex() const; | 86 int GetActivePageIndex() const; |
83 | 87 |
84 // True if |named_page| is the current active laucher page. | 88 // True if |named_page| is the current active laucher page. |
85 bool IsNamedPageActive(NamedPage named_page) const; | 89 bool IsNamedPageActive(NamedPage named_page) const; |
86 | 90 |
87 // Gets the index of a launcher page in |view_model_|, by NamedPage. | 91 // True if |page_index| is the index of |named_page|. |
92 bool IndexIsNamedPage(int page_index, NamedPage named_page) const; | |
calamity
2014/09/10 01:56:40
Can we have GetPageIndexForNamedPage() return -1 i
Matt Giuca
2014/09/10 03:15:30
Done.
| |
93 | |
94 // Gets the index of a launcher page in |view_model_|, by NamedPage. The given | |
95 // |named_page| must have a view in the view model. | |
88 int GetPageIndexForNamedPage(NamedPage named_page) const; | 96 int GetPageIndexForNamedPage(NamedPage named_page) const; |
89 | 97 |
90 int NumLauncherPages() const; | 98 int NumLauncherPages() const; |
91 | 99 |
92 void Prerender(); | 100 void Prerender(); |
93 | 101 |
94 AppsContainerView* apps_container_view() { return apps_container_view_; } | 102 AppsContainerView* apps_container_view() { return apps_container_view_; } |
95 StartPageView* start_page_view() { return start_page_view_; } | 103 StartPageView* start_page_view() { return start_page_view_; } |
96 SearchResultListView* search_results_view() { return search_results_view_; } | 104 SearchResultListView* search_results_view() { return search_results_view_; } |
97 views::View* GetPageView(int index); | 105 views::View* GetPageView(int index); |
(...skipping 16 matching lines...) Expand all Loading... | |
114 const PaginationModel& pagination_model() { return pagination_model_; } | 122 const PaginationModel& pagination_model() { return pagination_model_; } |
115 | 123 |
116 private: | 124 private: |
117 // Sets the active launcher page, accounting for whether the change is for | 125 // Sets the active launcher page, accounting for whether the change is for |
118 // search results. | 126 // search results. |
119 void SetActivePageInternal(int page_index, bool show_search_results); | 127 void SetActivePageInternal(int page_index, bool show_search_results); |
120 | 128 |
121 // Invoked when active view is changed. | 129 // Invoked when active view is changed. |
122 void ActivePageChanged(bool show_search_results); | 130 void ActivePageChanged(bool show_search_results); |
123 | 131 |
132 // Gets the origin (the off-screen resting place) for a given launcher page | |
133 // with index |page_index|. |bounds| is the contents bounds for this view. | |
134 int PageOrigin(const gfx::Rect& bounds, int page_index) const; | |
calamity
2014/09/10 01:56:40
Can this return a gfx::Rect() so that it's actuall
Matt Giuca
2014/09/10 03:15:30
Done & Done.
| |
135 | |
124 // Calculates and sets the bounds for the subviews. If there is currently an | 136 // Calculates and sets the bounds for the subviews. If there is currently an |
125 // animation, this positions the views as appropriate for the current frame. | 137 // animation, this positions the views as appropriate for the current frame. |
126 void UpdatePageBounds(); | 138 void UpdatePageBounds(); |
127 | 139 |
128 // Adds |view| as a new page to the end of the list of launcher pages. The | 140 // Adds |view| as a new page to the end of the list of launcher pages. The |
129 // view is inserted as a child of the ContentsView, and a button with | 141 // view is inserted as a child of the ContentsView, and a button with |
130 // |resource_id| is added to the ContentsSwitcherView. There is no name | 142 // |resource_id| is added to the ContentsSwitcherView. There is no name |
131 // associated with the page. Returns the index of the new page. | 143 // associated with the page. Returns the index of the new page. |
132 int AddLauncherPage(views::View* view, int resource_id); | 144 int AddLauncherPage(views::View* view, int resource_id); |
133 | 145 |
(...skipping 26 matching lines...) Expand all Loading... | |
160 | 172 |
161 // Manages the pagination for the launcher pages. | 173 // Manages the pagination for the launcher pages. |
162 PaginationModel pagination_model_; | 174 PaginationModel pagination_model_; |
163 | 175 |
164 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 176 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
165 }; | 177 }; |
166 | 178 |
167 } // namespace app_list | 179 } // namespace app_list |
168 | 180 |
169 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 181 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |