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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void Prerender(); | 94 void Prerender(); |
95 | 95 |
96 AppsContainerView* apps_container_view() { return apps_container_view_; } | 96 AppsContainerView* apps_container_view() { return apps_container_view_; } |
97 StartPageView* start_page_view() { return start_page_view_; } | 97 StartPageView* start_page_view() { return start_page_view_; } |
98 SearchResultListView* search_results_view() { return search_results_view_; } | 98 SearchResultListView* search_results_view() { return search_results_view_; } |
99 views::View* GetPageView(int index); | 99 views::View* GetPageView(int index); |
100 | 100 |
101 // Adds a blank launcher page. For use in tests only. | 101 // Adds a blank launcher page. For use in tests only. |
102 void AddBlankPageForTesting(); | 102 void AddBlankPageForTesting(); |
103 | 103 |
| 104 // Returns the pagination model for the ContentsView. |
| 105 const PaginationModel& pagination_model() { return pagination_model_; } |
| 106 |
| 107 // Returns search box bounds to use for content views that do not specify |
| 108 // their own custom layout. |
| 109 gfx::Rect GetDefaultSearchBoxBounds() const; |
| 110 |
| 111 // Returns the content area bounds to use for content views that do not |
| 112 // specify their own custom layout. |
| 113 gfx::Rect GetDefaultContentsBounds() const; |
| 114 |
104 // Overridden from views::View: | 115 // Overridden from views::View: |
105 virtual gfx::Size GetPreferredSize() const override; | 116 virtual gfx::Size GetPreferredSize() const override; |
106 virtual void Layout() override; | 117 virtual void Layout() override; |
107 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 118 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
108 | 119 |
109 // Overridden from PaginationModelObserver: | 120 // Overridden from PaginationModelObserver: |
110 virtual void TotalPagesChanged() override; | 121 virtual void TotalPagesChanged() override; |
111 virtual void SelectedPageChanged(int old_selected, int new_selected) override; | 122 virtual void SelectedPageChanged(int old_selected, int new_selected) override; |
112 virtual void TransitionStarted() override; | 123 virtual void TransitionStarted() override; |
113 virtual void TransitionChanged() override; | 124 virtual void TransitionChanged() override; |
114 | 125 |
115 // Returns the pagination model for the ContentsView. | |
116 const PaginationModel& pagination_model() { return pagination_model_; } | |
117 | |
118 private: | 126 private: |
119 // Sets the active launcher page, accounting for whether the change is for | 127 // Sets the active launcher page, accounting for whether the change is for |
120 // search results. | 128 // search results. |
121 void SetActivePageInternal(int page_index, bool show_search_results); | 129 void SetActivePageInternal(int page_index, bool show_search_results); |
122 | 130 |
123 // Invoked when active view is changed. | 131 // Invoked when active view is changed. |
124 void ActivePageChanged(bool show_search_results); | 132 void ActivePageChanged(bool show_search_results); |
125 | 133 |
| 134 // Returns the size of the default content area. |
| 135 gfx::Size GetDefaultContentsSize() const; |
| 136 |
126 // Gets the origin (the off-screen resting place) for a given launcher page | 137 // Gets the origin (the off-screen resting place) for a given launcher page |
127 // with index |page_index|. | 138 // with index |page_index|. |
128 gfx::Rect GetOffscreenPageBounds(int page_index) const; | 139 gfx::Rect GetOffscreenPageBounds(int page_index) const; |
129 | 140 |
130 // Calculates and sets the bounds for the subviews. If there is currently an | 141 // Calculates and sets the bounds for the subviews. If there is currently an |
131 // animation, this positions the views as appropriate for the current frame. | 142 // animation, this positions the views as appropriate for the current frame. |
132 void UpdatePageBounds(); | 143 void UpdatePageBounds(); |
133 | 144 |
134 // Adds |view| as a new page to the end of the list of launcher pages. The | 145 // Adds |view| as a new page to the end of the list of launcher pages. The |
135 // view is inserted as a child of the ContentsView, and a button with | 146 // view is inserted as a child of the ContentsView, and a button with |
(...skipping 30 matching lines...) Expand all Loading... |
166 | 177 |
167 // Manages the pagination for the launcher pages. | 178 // Manages the pagination for the launcher pages. |
168 PaginationModel pagination_model_; | 179 PaginationModel pagination_model_; |
169 | 180 |
170 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 181 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
171 }; | 182 }; |
172 | 183 |
173 } // namespace app_list | 184 } // namespace app_list |
174 | 185 |
175 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 186 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |