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 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "components/web_modal/modal_dialog_host.h" |
15 #include "ui/app_list/app_list_export.h" | 16 #include "ui/app_list/app_list_export.h" |
16 #include "ui/app_list/app_list_model.h" | 17 #include "ui/app_list/app_list_model.h" |
17 #include "ui/app_list/pagination_model.h" | 18 #include "ui/app_list/pagination_model.h" |
18 #include "ui/app_list/pagination_model_observer.h" | 19 #include "ui/app_list/pagination_model_observer.h" |
19 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
20 #include "ui/views/view_model.h" | 21 #include "ui/views/view_model.h" |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 class Rect; | 24 class Rect; |
24 } | 25 } |
(...skipping 12 matching lines...) Expand all Loading... |
37 class SearchResultListView; | 38 class SearchResultListView; |
38 class SearchResultPageView; | 39 class SearchResultPageView; |
39 class StartPageView; | 40 class StartPageView; |
40 | 41 |
41 // A view to manage launcher pages within the Launcher (eg. start page, apps | 42 // A view to manage launcher pages within the Launcher (eg. start page, apps |
42 // grid view, search results). There can be any number of launcher pages, only | 43 // grid view, search results). There can be any number of launcher pages, only |
43 // one of which can be active at a given time. ContentsView provides the user | 44 // one of which can be active at a given time. ContentsView provides the user |
44 // interface for switching between launcher pages, and animates the transition | 45 // interface for switching between launcher pages, and animates the transition |
45 // between them. | 46 // between them. |
46 class APP_LIST_EXPORT ContentsView : public views::View, | 47 class APP_LIST_EXPORT ContentsView : public views::View, |
47 public PaginationModelObserver { | 48 public PaginationModelObserver, |
| 49 public web_modal::ModalDialogHost { |
48 public: | 50 public: |
49 ContentsView(AppListMainView* app_list_main_view); | 51 ContentsView(AppListMainView* app_list_main_view); |
50 ~ContentsView() override; | 52 ~ContentsView() override; |
51 | 53 |
52 // Initialize the pages of the launcher. In the experimental launcher, should | 54 // Initialize the pages of the launcher. In the experimental launcher, should |
53 // be called after set_contents_switcher_view(), or switcher buttons will not | 55 // be called after set_contents_switcher_view(), or switcher buttons will not |
54 // be created. | 56 // be created. |
55 void Init(AppListModel* model); | 57 void Init(AppListModel* model); |
56 | 58 |
57 // The app list gets closed and drag and drop operations need to be cancelled. | 59 // The app list gets closed and drag and drop operations need to be cancelled. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 gfx::Size GetPreferredSize() const override; | 126 gfx::Size GetPreferredSize() const override; |
125 void Layout() override; | 127 void Layout() override; |
126 bool OnKeyPressed(const ui::KeyEvent& event) override; | 128 bool OnKeyPressed(const ui::KeyEvent& event) override; |
127 | 129 |
128 // Overridden from PaginationModelObserver: | 130 // Overridden from PaginationModelObserver: |
129 void TotalPagesChanged() override; | 131 void TotalPagesChanged() override; |
130 void SelectedPageChanged(int old_selected, int new_selected) override; | 132 void SelectedPageChanged(int old_selected, int new_selected) override; |
131 void TransitionStarted() override; | 133 void TransitionStarted() override; |
132 void TransitionChanged() override; | 134 void TransitionChanged() override; |
133 | 135 |
| 136 // Overridden from web_modal::ModalDialogHost: |
| 137 gfx::NativeView GetHostView() const override; |
| 138 gfx::Point GetDialogPosition(const gfx::Size& size) override; |
| 139 void AddObserver(web_modal::ModalDialogHostObserver* observer) override; |
| 140 void RemoveObserver(web_modal::ModalDialogHostObserver* observer) override; |
| 141 |
134 private: | 142 private: |
135 // Sets the active launcher page, accounting for whether the change is for | 143 // Sets the active launcher page, accounting for whether the change is for |
136 // search results. | 144 // search results. |
137 void SetActivePageInternal(int page_index, bool show_search_results); | 145 void SetActivePageInternal(int page_index, bool show_search_results); |
138 | 146 |
139 // Invoked when active view is changed. | 147 // Invoked when active view is changed. |
140 void ActivePageChanged(); | 148 void ActivePageChanged(); |
141 | 149 |
142 // Returns the size of the default content area. | 150 // Returns the size of the default content area. |
143 gfx::Size GetDefaultContentsSize() const; | 151 gfx::Size GetDefaultContentsSize() const; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 227 |
220 // The animator for transitions not found in |contents_animators_|. | 228 // The animator for transitions not found in |contents_animators_|. |
221 scoped_ptr<ContentsAnimator> default_animator_; | 229 scoped_ptr<ContentsAnimator> default_animator_; |
222 | 230 |
223 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 231 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
224 }; | 232 }; |
225 | 233 |
226 } // namespace app_list | 234 } // namespace app_list |
227 | 235 |
228 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 236 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |