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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // A view to manage launcher pages within the Launcher (eg. start page, apps | 38 // 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 | 39 // 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 | 40 // 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 | 41 // interface for switching between launcher pages, and animates the transition |
42 // between them. | 42 // between them. |
43 class APP_LIST_EXPORT ContentsView : public views::View, | 43 class APP_LIST_EXPORT ContentsView : public views::View, |
44 public PaginationModelObserver { | 44 public PaginationModelObserver { |
45 public: | 45 public: |
46 ContentsView(AppListMainView* app_list_main_view); | 46 ContentsView(AppListMainView* app_list_main_view); |
47 virtual ~ContentsView(); | 47 ~ContentsView() override; |
48 | 48 |
49 // Initialize the pages of the launcher. In the experimental launcher, should | 49 // Initialize the pages of the launcher. In the experimental launcher, should |
50 // be called after set_contents_switcher_view(), or switcher buttons will not | 50 // be called after set_contents_switcher_view(), or switcher buttons will not |
51 // be created. | 51 // be created. |
52 void Init(AppListModel* model, AppListViewDelegate* view_delegate); | 52 void Init(AppListModel* model, AppListViewDelegate* view_delegate); |
53 | 53 |
54 // The app list gets closed and drag and drop operations need to be cancelled. | 54 // The app list gets closed and drag and drop operations need to be cancelled. |
55 void CancelDrag(); | 55 void CancelDrag(); |
56 | 56 |
57 // If |drag_and_drop| is not NULL it will be called upon drag and drop | 57 // If |drag_and_drop| is not NULL it will be called upon drag and drop |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 // Returns search box bounds to use for content views that do not specify | 100 // Returns search box bounds to use for content views that do not specify |
101 // their own custom layout. | 101 // their own custom layout. |
102 gfx::Rect GetDefaultSearchBoxBounds() const; | 102 gfx::Rect GetDefaultSearchBoxBounds() const; |
103 | 103 |
104 // Returns the content area bounds to use for content views that do not | 104 // Returns the content area bounds to use for content views that do not |
105 // specify their own custom layout. | 105 // specify their own custom layout. |
106 gfx::Rect GetDefaultContentsBounds() const; | 106 gfx::Rect GetDefaultContentsBounds() const; |
107 | 107 |
108 // Overridden from views::View: | 108 // Overridden from views::View: |
109 virtual gfx::Size GetPreferredSize() const override; | 109 gfx::Size GetPreferredSize() const override; |
110 virtual void Layout() override; | 110 void Layout() override; |
111 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 111 bool OnKeyPressed(const ui::KeyEvent& event) override; |
112 | 112 |
113 // Overridden from PaginationModelObserver: | 113 // Overridden from PaginationModelObserver: |
114 virtual void TotalPagesChanged() override; | 114 void TotalPagesChanged() override; |
115 virtual void SelectedPageChanged(int old_selected, int new_selected) override; | 115 void SelectedPageChanged(int old_selected, int new_selected) override; |
116 virtual void TransitionStarted() override; | 116 void TransitionStarted() override; |
117 virtual void TransitionChanged() override; | 117 void TransitionChanged() override; |
118 | 118 |
119 private: | 119 private: |
120 // Sets the active launcher page, accounting for whether the change is for | 120 // Sets the active launcher page, accounting for whether the change is for |
121 // search results. | 121 // search results. |
122 void SetActivePageInternal(int page_index, bool show_search_results); | 122 void SetActivePageInternal(int page_index, bool show_search_results); |
123 | 123 |
124 // Invoked when active view is changed. | 124 // Invoked when active view is changed. |
125 void ActivePageChanged(bool show_search_results); | 125 void ActivePageChanged(bool show_search_results); |
126 | 126 |
127 // Returns the size of the default content area. | 127 // Returns the size of the default content area. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // Manages the pagination for the launcher pages. | 173 // Manages the pagination for the launcher pages. |
174 PaginationModel pagination_model_; | 174 PaginationModel pagination_model_; |
175 | 175 |
176 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 176 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
177 }; | 177 }; |
178 | 178 |
179 } // namespace app_list | 179 } // namespace app_list |
180 | 180 |
181 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 181 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |