OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APP_LIST_MAIN_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "ui/app_list/app_list_export.h" | 13 #include "ui/app_list/app_list_export.h" |
14 #include "ui/app_list/views/apps_grid_view_delegate.h" | 14 #include "ui/app_list/views/apps_grid_view_delegate.h" |
15 #include "ui/app_list/views/search_box_view_delegate.h" | 15 #include "ui/app_list/views/search_box_view_delegate.h" |
16 #include "ui/app_list/views/search_result_list_view_delegate.h" | 16 #include "ui/app_list/views/search_result_list_view_delegate.h" |
17 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
18 | 18 |
19 namespace views { | 19 namespace views { |
20 class Widget; | 20 class Widget; |
21 } | 21 } |
22 | 22 |
23 namespace app_list { | 23 namespace app_list { |
24 | 24 |
25 class AppListItem; | 25 class AppListItem; |
26 class AppListModel; | 26 class AppListModel; |
| 27 class AppListView; |
27 class AppListViewDelegate; | 28 class AppListViewDelegate; |
28 class ApplicationDragAndDropHost; | 29 class ApplicationDragAndDropHost; |
29 class ContentsView; | 30 class ContentsView; |
30 class PaginationModel; | 31 class PaginationModel; |
31 class SearchBoxView; | 32 class SearchBoxView; |
32 | 33 |
33 // AppListMainView contains the normal view of the app list, which is shown | 34 // AppListMainView contains the normal view of the app list, which is shown |
34 // when the user is signed in. | 35 // when the user is signed in. |
35 class APP_LIST_EXPORT AppListMainView : public views::View, | 36 class APP_LIST_EXPORT AppListMainView : public views::View, |
36 public AppsGridViewDelegate, | 37 public AppsGridViewDelegate, |
37 public SearchBoxViewDelegate, | 38 public SearchBoxViewDelegate, |
38 public SearchResultListViewDelegate { | 39 public SearchResultListViewDelegate { |
39 public: | 40 public: |
40 // Takes ownership of |delegate|. | 41 // Takes ownership of |delegate|. |
41 explicit AppListMainView(AppListViewDelegate* delegate, | 42 explicit AppListMainView(AppListView* app_list_view, |
| 43 AppListViewDelegate* delegate, |
42 PaginationModel* pagination_model, | 44 PaginationModel* pagination_model, |
43 gfx::NativeView parent); | 45 gfx::NativeView parent); |
44 virtual ~AppListMainView(); | 46 virtual ~AppListMainView(); |
45 | 47 |
46 void ShowAppListWhenReady(); | 48 void ShowAppListWhenReady(); |
47 | 49 |
48 void Close(); | 50 void Close(); |
49 | 51 |
50 void Prerender(); | 52 void Prerender(); |
51 | 53 |
(...skipping 24 matching lines...) Expand all Loading... |
76 void OnItemIconLoaded(IconLoader* loader); | 78 void OnItemIconLoaded(IconLoader* loader); |
77 | 79 |
78 // Overridden from AppsGridViewDelegate: | 80 // Overridden from AppsGridViewDelegate: |
79 virtual void ActivateApp(AppListItem* item, int event_flags) OVERRIDE; | 81 virtual void ActivateApp(AppListItem* item, int event_flags) OVERRIDE; |
80 virtual void GetShortcutPathForApp( | 82 virtual void GetShortcutPathForApp( |
81 const std::string& app_id, | 83 const std::string& app_id, |
82 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; | 84 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; |
83 | 85 |
84 // Overridden from SearchBoxViewDelegate: | 86 // Overridden from SearchBoxViewDelegate: |
85 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; | 87 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; |
| 88 virtual void SearchBoxVisibilityChanged(SearchBoxView* sender) OVERRIDE; |
86 | 89 |
87 // Overridden from SearchResultListViewDelegate: | 90 // Overridden from SearchResultListViewDelegate: |
88 virtual void OpenResult(SearchResult* result, | 91 virtual void OpenResult(SearchResult* result, |
89 bool auto_launch, | 92 bool auto_launch, |
90 int event_flags) OVERRIDE; | 93 int event_flags) OVERRIDE; |
91 virtual void InvokeResultAction(SearchResult* result, | 94 virtual void InvokeResultAction(SearchResult* result, |
92 int action_index, | 95 int action_index, |
93 int event_flags) OVERRIDE; | 96 int event_flags) OVERRIDE; |
94 virtual void OnResultInstalled(SearchResult* result) OVERRIDE; | 97 virtual void OnResultInstalled(SearchResult* result) OVERRIDE; |
95 virtual void OnResultUninstalled(SearchResult* result) OVERRIDE; | 98 virtual void OnResultUninstalled(SearchResult* result) OVERRIDE; |
96 | 99 |
97 AppListViewDelegate* delegate_; // Owned by parent view (AppListView). | 100 AppListViewDelegate* delegate_; // Owned by parent view (AppListView). |
98 PaginationModel* pagination_model_; // Owned by AppListController. | 101 PaginationModel* pagination_model_; // Owned by AppListController. |
99 AppListModel* model_; // Unowned; ownership is handled by |delegate_|. | 102 AppListModel* model_; // Unowned; ownership is handled by |delegate_|. |
100 | 103 |
| 104 AppListView* app_list_view_; // Owned by view hierarchy. |
101 SearchBoxView* search_box_view_; // Owned by views hierarchy. | 105 SearchBoxView* search_box_view_; // Owned by views hierarchy. |
102 ContentsView* contents_view_; // Owned by views hierarchy. | 106 ContentsView* contents_view_; // Owned by views hierarchy. |
103 | 107 |
104 // A timer that fires when maximum allowed time to wait for icon loading has | 108 // A timer that fires when maximum allowed time to wait for icon loading has |
105 // passed. | 109 // passed. |
106 base::OneShotTimer<AppListMainView> icon_loading_wait_timer_; | 110 base::OneShotTimer<AppListMainView> icon_loading_wait_timer_; |
107 | 111 |
108 ScopedVector<IconLoader> pending_icon_loaders_; | 112 ScopedVector<IconLoader> pending_icon_loaders_; |
109 | 113 |
110 base::WeakPtrFactory<AppListMainView> weak_ptr_factory_; | 114 base::WeakPtrFactory<AppListMainView> weak_ptr_factory_; |
111 | 115 |
112 DISALLOW_COPY_AND_ASSIGN(AppListMainView); | 116 DISALLOW_COPY_AND_ASSIGN(AppListMainView); |
113 }; | 117 }; |
114 | 118 |
115 } // namespace app_list | 119 } // namespace app_list |
116 | 120 |
117 #endif // UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ | 121 #endif // UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ |
OLD | NEW |