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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 class AppsGridView; | 26 class AppsGridView; |
| 27 class ApplicationDragAndDropHost; | 27 class ApplicationDragAndDropHost; |
| 28 class AppListFolderItem; | 28 class AppListFolderItem; |
| 29 class AppListMainView; | 29 class AppListMainView; |
| 30 class AppListModel; | 30 class AppListModel; |
| 31 class AppListViewDelegate; | 31 class AppListViewDelegate; |
| 32 class AppsContainerView; | 32 class AppsContainerView; |
| 33 class ContentsSwitcherView; | 33 class ContentsSwitcherView; |
| 34 class PaginationModel; | 34 class PaginationModel; |
| 35 class SearchResultListView; | 35 class SearchResultListView; |
| 36 class SearchResultPageView; | |
| 36 class StartPageView; | 37 class StartPageView; |
| 37 | 38 |
| 38 // A view to manage launcher pages within the Launcher (eg. start page, apps | 39 // A view to manage launcher pages within the Launcher (eg. start page, apps |
| 39 // grid view, search results). There can be any number of launcher pages, only | 40 // grid view, search results). There can be any number of launcher pages, only |
| 40 // one of which can be active at a given time. ContentsView provides the user | 41 // one of which can be active at a given time. ContentsView provides the user |
| 41 // interface for switching between launcher pages, and animates the transition | 42 // interface for switching between launcher pages, and animates the transition |
| 42 // between them. | 43 // between them. |
| 43 class APP_LIST_EXPORT ContentsView : public views::View, | 44 class APP_LIST_EXPORT ContentsView : public views::View, |
| 44 public PaginationModelObserver { | 45 public PaginationModelObserver { |
| 45 public: | 46 public: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 // Gets the index of a launcher page in |view_model_|, by State. Returns | 82 // Gets the index of a launcher page in |view_model_|, by State. Returns |
| 82 // -1 if there is no view for |state|. | 83 // -1 if there is no view for |state|. |
| 83 int GetPageIndexForState(AppListModel::State state) const; | 84 int GetPageIndexForState(AppListModel::State state) const; |
| 84 | 85 |
| 85 int NumLauncherPages() const; | 86 int NumLauncherPages() const; |
| 86 | 87 |
| 87 void Prerender(); | 88 void Prerender(); |
| 88 | 89 |
| 89 AppsContainerView* apps_container_view() { return apps_container_view_; } | 90 AppsContainerView* apps_container_view() { return apps_container_view_; } |
| 90 StartPageView* start_page_view() { return start_page_view_; } | 91 StartPageView* start_page_view() { return start_page_view_; } |
| 91 SearchResultListView* search_results_view() { return search_results_view_; } | 92 SearchResultListView* search_results_list_view() { |
| 93 return search_results_list_view_; | |
| 94 } | |
| 95 SearchResultPageView* search_results_page_view() { | |
| 96 return search_results_page_view_; | |
| 97 } | |
| 92 views::View* GetPageView(int index); | 98 views::View* GetPageView(int index); |
| 93 | 99 |
| 94 // Adds a blank launcher page. For use in tests only. | 100 // Adds a blank launcher page. For use in tests only. |
| 95 void AddBlankPageForTesting(); | 101 void AddBlankPageForTesting(); |
| 96 | 102 |
| 97 // Returns the pagination model for the ContentsView. | 103 // Returns the pagination model for the ContentsView. |
| 98 const PaginationModel& pagination_model() { return pagination_model_; } | 104 const PaginationModel& pagination_model() { return pagination_model_; } |
| 99 | 105 |
| 100 // Returns search box bounds to use for content views that do not specify | 106 // Returns search box bounds to use for content views that do not specify |
| 101 // their own custom layout. | 107 // their own custom layout. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 115 void SelectedPageChanged(int old_selected, int new_selected) override; | 121 void SelectedPageChanged(int old_selected, int new_selected) override; |
| 116 void TransitionStarted() override; | 122 void TransitionStarted() override; |
| 117 void TransitionChanged() override; | 123 void TransitionChanged() override; |
| 118 | 124 |
| 119 private: | 125 private: |
| 120 // Sets the active launcher page, accounting for whether the change is for | 126 // Sets the active launcher page, accounting for whether the change is for |
| 121 // search results. | 127 // search results. |
| 122 void SetActivePageInternal(int page_index, bool show_search_results); | 128 void SetActivePageInternal(int page_index, bool show_search_results); |
| 123 | 129 |
| 124 // Invoked when active view is changed. | 130 // Invoked when active view is changed. |
| 125 void ActivePageChanged(bool show_search_results); | 131 void ActivePageChanged(); |
| 126 | 132 |
| 127 // Returns the size of the default content area. | 133 // Returns the size of the default content area. |
| 128 gfx::Size GetDefaultContentsSize() const; | 134 gfx::Size GetDefaultContentsSize() const; |
| 129 | 135 |
| 130 // Gets the origin (the off-screen resting place) for a given launcher page | 136 // Gets the origin (the off-screen resting place) for a given launcher page |
| 131 // with index |page_index|. | 137 // with index |page_index|. |
| 132 gfx::Rect GetOffscreenPageBounds(int page_index) const; | 138 gfx::Rect GetOffscreenPageBounds(int page_index) const; |
| 133 | 139 |
| 134 // Calculates and sets the bounds for the subviews. If there is currently an | 140 // Calculates and sets the bounds for the subviews. If there is currently an |
| 135 // animation, this positions the views as appropriate for the current frame. | 141 // animation, this positions the views as appropriate for the current frame. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 149 int resource_id, | 155 int resource_id, |
| 150 AppListModel::State state); | 156 AppListModel::State state); |
| 151 | 157 |
| 152 // Gets the PaginationModel owned by the AppsGridView. | 158 // Gets the PaginationModel owned by the AppsGridView. |
| 153 // Note: This is different to |pagination_model_|, which manages top-level | 159 // Note: This is different to |pagination_model_|, which manages top-level |
| 154 // launcher-page pagination. | 160 // launcher-page pagination. |
| 155 PaginationModel* GetAppsPaginationModel(); | 161 PaginationModel* GetAppsPaginationModel(); |
| 156 | 162 |
| 157 // Special sub views of the ContentsView. All owned by the views hierarchy. | 163 // Special sub views of the ContentsView. All owned by the views hierarchy. |
| 158 AppsContainerView* apps_container_view_; | 164 AppsContainerView* apps_container_view_; |
| 159 SearchResultListView* search_results_view_; | 165 SearchResultListView* search_results_list_view_; |
|
Matt Giuca
2014/10/29 03:40:53
Is it now the case that search_results_list_view_
calamity
2014/10/29 06:27:53
Done.
| |
| 166 SearchResultPageView* search_results_page_view_; | |
| 160 StartPageView* start_page_view_; | 167 StartPageView* start_page_view_; |
| 161 | 168 |
| 162 AppListMainView* app_list_main_view_; // Parent view, owns this. | 169 AppListMainView* app_list_main_view_; // Parent view, owns this. |
| 163 // Sibling view, owned by |app_list_main_view_|. | 170 // Sibling view, owned by |app_list_main_view_|. |
| 164 ContentsSwitcherView* contents_switcher_view_; | 171 ContentsSwitcherView* contents_switcher_view_; |
| 165 | 172 |
| 166 scoped_ptr<views::ViewModel> view_model_; | 173 scoped_ptr<views::ViewModel> view_model_; |
| 167 | 174 |
| 168 // Maps State onto |view_model_| indices. | 175 // Maps State onto |view_model_| indices. |
| 169 std::map<AppListModel::State, int> state_to_view_; | 176 std::map<AppListModel::State, int> state_to_view_; |
| 170 | 177 |
| 171 // Maps |view_model_| indices onto State. | 178 // Maps |view_model_| indices onto State. |
| 172 std::map<int, AppListModel::State> view_to_state_; | 179 std::map<int, AppListModel::State> view_to_state_; |
| 173 | 180 |
| 174 // The page that was showing before ShowSearchResults(true) was invoked. | 181 // The page that was showing before ShowSearchResults(true) was invoked. |
| 175 int page_before_search_; | 182 int page_before_search_; |
| 176 | 183 |
| 177 // Manages the pagination for the launcher pages. | 184 // Manages the pagination for the launcher pages. |
| 178 PaginationModel pagination_model_; | 185 PaginationModel pagination_model_; |
| 179 | 186 |
| 180 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 187 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
| 181 }; | 188 }; |
| 182 | 189 |
| 183 } // namespace app_list | 190 } // namespace app_list |
| 184 | 191 |
| 185 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 192 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
| OLD | NEW |