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_APP_LIST_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "ui/app_list/app_list_export.h" | 14 #include "ui/app_list/app_list_export.h" |
15 #include "ui/app_list/app_list_view_delegate_observer.h" | 15 #include "ui/app_list/app_list_view_delegate_observer.h" |
16 #include "ui/app_list/speech_ui_model_observer.h" | 16 #include "ui/app_list/speech_ui_model_observer.h" |
17 #include "ui/views/bubble/bubble_dialog_delegate.h" | 17 #include "ui/views/bubble/bubble_dialog_delegate.h" |
18 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class FilePath; | 21 class FilePath; |
22 } | 22 } |
23 | 23 |
24 namespace test { | |
25 class AppListViewTestApi; | |
26 } | |
27 | |
28 namespace views { | 24 namespace views { |
29 class ImageView; | 25 class ImageView; |
30 } | 26 } |
31 | 27 |
32 namespace app_list { | 28 namespace app_list { |
33 class ApplicationDragAndDropHost; | 29 class ApplicationDragAndDropHost; |
34 class AppListMainView; | 30 class AppListMainView; |
35 class AppListModel; | 31 class AppListModel; |
36 class AppListViewDelegate; | 32 class AppListViewDelegate; |
37 class AppListViewObserver; | 33 class AppListViewObserver; |
38 class HideViewAnimationObserver; | 34 class HideViewAnimationObserver; |
39 class PaginationModel; | 35 class PaginationModel; |
40 class SearchBoxView; | 36 class SearchBoxView; |
41 class SpeechView; | 37 class SpeechView; |
42 | 38 |
| 39 namespace test { |
| 40 class AppListViewTestApi; |
| 41 } |
| 42 |
43 // AppListView is the top-level view and controller of app list UI. It creates | 43 // AppListView is the top-level view and controller of app list UI. It creates |
44 // and hosts a AppsGridView and passes AppListModel to it for display. | 44 // and hosts a AppsGridView and passes AppListModel to it for display. |
45 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 45 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, |
46 public AppListViewDelegateObserver, | 46 public AppListViewDelegateObserver, |
47 public SpeechUIModelObserver { | 47 public SpeechUIModelObserver { |
48 public: | 48 public: |
49 // Does not take ownership of |delegate|. | 49 // Does not take ownership of |delegate|. |
50 explicit AppListView(AppListViewDelegate* delegate); | 50 explicit AppListView(AppListViewDelegate* delegate); |
51 ~AppListView() override; | 51 ~AppListView() override; |
52 | 52 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void SetAppListOverlayVisible(bool visible); | 96 void SetAppListOverlayVisible(bool visible); |
97 | 97 |
98 // Returns true if the app list should be centered and in landscape mode. | 98 // Returns true if the app list should be centered and in landscape mode. |
99 bool ShouldCenterWindow() const; | 99 bool ShouldCenterWindow() const; |
100 | 100 |
101 views::Widget* search_box_widget() const { return search_box_widget_; } | 101 views::Widget* search_box_widget() const { return search_box_widget_; } |
102 | 102 |
103 // Overridden from views::View: | 103 // Overridden from views::View: |
104 gfx::Size GetPreferredSize() const override; | 104 gfx::Size GetPreferredSize() const override; |
105 void OnPaint(gfx::Canvas* canvas) override; | 105 void OnPaint(gfx::Canvas* canvas) override; |
106 void OnThemeChanged() override; | |
107 | 106 |
108 // WidgetDelegate overrides: | 107 // WidgetDelegate overrides: |
109 bool ShouldHandleSystemCommands() const override; | 108 bool ShouldHandleSystemCommands() const override; |
110 bool ShouldDescendIntoChildForEventHandling( | 109 bool ShouldDescendIntoChildForEventHandling( |
111 gfx::NativeView child, | 110 gfx::NativeView child, |
112 const gfx::Point& location) override; | 111 const gfx::Point& location) override; |
113 | 112 |
114 // Overridden from AppListViewDelegateObserver: | 113 // Overridden from AppListViewDelegateObserver: |
115 void OnProfilesChanged() override; | 114 void OnProfilesChanged() override; |
116 void OnShutdown() override; | 115 void OnShutdown() override; |
117 | 116 |
118 void Prerender(); | |
119 | |
120 void SetProfileByPath(const base::FilePath& profile_path); | 117 void SetProfileByPath(const base::FilePath& profile_path); |
121 | 118 |
122 void AddObserver(AppListViewObserver* observer); | 119 void AddObserver(AppListViewObserver* observer); |
123 void RemoveObserver(AppListViewObserver* observer); | 120 void RemoveObserver(AppListViewObserver* observer); |
124 | 121 |
125 // Set a callback to be called the next time any app list paints. | |
126 void SetNextPaintCallback(const base::Closure& callback); | |
127 | |
128 #if defined(OS_WIN) | |
129 HWND GetHWND() const; | |
130 #endif | |
131 | |
132 AppListMainView* app_list_main_view() { return app_list_main_view_; } | 122 AppListMainView* app_list_main_view() { return app_list_main_view_; } |
133 | 123 |
134 // Gets the PaginationModel owned by this view's apps grid. | 124 // Gets the PaginationModel owned by this view's apps grid. |
135 PaginationModel* GetAppsPaginationModel(); | 125 PaginationModel* GetAppsPaginationModel(); |
136 | 126 |
137 // Overridden from views::View: | 127 // Overridden from views::View: |
138 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 128 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
139 void Layout() override; | 129 void Layout() override; |
140 void SchedulePaintInRect(const gfx::Rect& rect) override; | 130 void SchedulePaintInRect(const gfx::Rect& rect) override; |
141 | 131 |
142 private: | 132 private: |
143 friend class ::test::AppListViewTestApi; | 133 friend class test::AppListViewTestApi; |
144 | 134 |
145 void InitContents(gfx::NativeView parent, int initial_apps_page); | 135 void InitContents(gfx::NativeView parent, int initial_apps_page); |
146 | 136 |
147 void InitChildWidgets(); | 137 void InitChildWidgets(); |
148 | 138 |
149 void InitAsBubbleInternal(gfx::NativeView parent, | 139 void InitAsBubbleInternal(gfx::NativeView parent, |
150 int initial_apps_page, | 140 int initial_apps_page, |
151 views::BubbleBorder::Arrow arrow, | 141 views::BubbleBorder::Arrow arrow, |
152 bool border_accepts_events, | 142 bool border_accepts_events, |
153 const gfx::Vector2d& anchor_offset); | 143 const gfx::Vector2d& anchor_offset); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 179 |
190 // For UMA and testing. If non-null, triggered when the app list is painted. | 180 // For UMA and testing. If non-null, triggered when the app list is painted. |
191 base::Closure next_paint_callback_; | 181 base::Closure next_paint_callback_; |
192 | 182 |
193 DISALLOW_COPY_AND_ASSIGN(AppListView); | 183 DISALLOW_COPY_AND_ASSIGN(AppListView); |
194 }; | 184 }; |
195 | 185 |
196 } // namespace app_list | 186 } // namespace app_list |
197 | 187 |
198 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 188 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
OLD | NEW |