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 // Gets the index of a launcher page in |view_model_|, by NamedPage. Returns |
| 92 // -1 if there is no view for |named_page|. |
88 int GetPageIndexForNamedPage(NamedPage named_page) const; | 93 int GetPageIndexForNamedPage(NamedPage named_page) const; |
89 | 94 |
90 int NumLauncherPages() const; | 95 int NumLauncherPages() const; |
91 | 96 |
92 void Prerender(); | 97 void Prerender(); |
93 | 98 |
94 AppsContainerView* apps_container_view() { return apps_container_view_; } | 99 AppsContainerView* apps_container_view() { return apps_container_view_; } |
95 StartPageView* start_page_view() { return start_page_view_; } | 100 StartPageView* start_page_view() { return start_page_view_; } |
96 SearchResultListView* search_results_view() { return search_results_view_; } | 101 SearchResultListView* search_results_view() { return search_results_view_; } |
97 views::View* GetPageView(int index); | 102 views::View* GetPageView(int index); |
(...skipping 16 matching lines...) Expand all Loading... |
114 const PaginationModel& pagination_model() { return pagination_model_; } | 119 const PaginationModel& pagination_model() { return pagination_model_; } |
115 | 120 |
116 private: | 121 private: |
117 // Sets the active launcher page, accounting for whether the change is for | 122 // Sets the active launcher page, accounting for whether the change is for |
118 // search results. | 123 // search results. |
119 void SetActivePageInternal(int page_index, bool show_search_results); | 124 void SetActivePageInternal(int page_index, bool show_search_results); |
120 | 125 |
121 // Invoked when active view is changed. | 126 // Invoked when active view is changed. |
122 void ActivePageChanged(bool show_search_results); | 127 void ActivePageChanged(bool show_search_results); |
123 | 128 |
| 129 // Gets the origin (the off-screen resting place) for a given launcher page |
| 130 // with index |page_index|. |
| 131 gfx::Rect GetOffscreenPageBounds(int page_index) const; |
| 132 |
124 // Calculates and sets the bounds for the subviews. If there is currently an | 133 // 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. | 134 // animation, this positions the views as appropriate for the current frame. |
126 void UpdatePageBounds(); | 135 void UpdatePageBounds(); |
127 | 136 |
128 // Adds |view| as a new page to the end of the list of launcher pages. The | 137 // 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 | 138 // 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 | 139 // |resource_id| is added to the ContentsSwitcherView. There is no name |
131 // associated with the page. Returns the index of the new page. | 140 // associated with the page. Returns the index of the new page. |
132 int AddLauncherPage(views::View* view, int resource_id); | 141 int AddLauncherPage(views::View* view, int resource_id); |
133 | 142 |
(...skipping 26 matching lines...) Expand all Loading... |
160 | 169 |
161 // Manages the pagination for the launcher pages. | 170 // Manages the pagination for the launcher pages. |
162 PaginationModel pagination_model_; | 171 PaginationModel pagination_model_; |
163 | 172 |
164 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 173 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
165 }; | 174 }; |
166 | 175 |
167 } // namespace app_list | 176 } // namespace app_list |
168 | 177 |
169 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 178 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |