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" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 class AppListViewTestApi; | 35 class AppListViewTestApi; |
36 } | 36 } |
37 | 37 |
38 // AppListView is the top-level view and controller of app list UI. It creates | 38 // AppListView is the top-level view and controller of app list UI. It creates |
39 // and hosts a AppsGridView and passes AppListModel to it for display. | 39 // and hosts a AppsGridView and passes AppListModel to it for display. |
40 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 40 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, |
41 public SpeechUIModelObserver, | 41 public SpeechUIModelObserver, |
42 public display::DisplayObserver { | 42 public display::DisplayObserver { |
43 public: | 43 public: |
44 enum AppListState { | 44 enum AppListState { |
45 // If set, closes |app_list_main_view_| and dismisses the delegate. | 45 // Closes |app_list_main_view_| and dismisses the delegate. |
vadimt
2017/06/13 18:14:11
Good :)
newcomer
2017/06/13 18:51:46
Acknowledged.
| |
46 CLOSED = 0, | 46 CLOSED = 0, |
47 | 47 // The initial state for the app list when neither maximize or side shelf |
48 // The initial state for the app list. If set, the widget will peek over | 48 // modes are active. If set, the widget will peek over the shelf by |
49 // the shelf by kPeekingAppListHeight DIPs. | 49 // kPeekingAppListHeight DIPs. |
50 PEEKING, | 50 PEEKING, |
51 | 51 // Entered when text is entered into the search box from peeking mode. |
52 // If set, the widget will be repositioned to take up the whole screen. | 52 HALF, |
53 FULLSCREEN, | 53 // Default app list state in maximize and side shelf modes. Entered from an |
54 // upward swipe from |PEEKING| or from clicking the chevron. | |
55 FULLSCREEN_ALL_APPS, | |
56 // Entered from an upward swipe from |HALF| or by entering text in the | |
57 // search box from |FULLSCREEN_ALL_APPS|. | |
58 FULLSCREEN_SEARCH, | |
54 }; | 59 }; |
55 | 60 |
56 // Does not take ownership of |delegate|. | 61 // Does not take ownership of |delegate|. |
57 explicit AppListView(AppListViewDelegate* delegate); | 62 explicit AppListView(AppListViewDelegate* delegate); |
58 ~AppListView() override; | 63 ~AppListView() override; |
59 | 64 |
60 // Initializes the widget as a bubble or fullscreen view depending on if the | 65 // Initializes the widget as a bubble or fullscreen view depending on if the |
61 // fullscreen app list feature is set. |parent| and |initial_apps_page| are | 66 // fullscreen app list feature is set. |parent| and |initial_apps_page| are |
62 // used for both the bubble and fullscreen initialization. | 67 // used for both the bubble and fullscreen initialization. |
63 void Initialize(gfx::NativeView parent, int initial_apps_page); | 68 void Initialize(gfx::NativeView parent, |
69 int initial_apps_page, | |
70 bool is_mazimize_mode = false, | |
71 bool is_side_shelf = false); | |
64 | 72 |
65 void SetBubbleArrow(views::BubbleBorder::Arrow arrow); | 73 void SetBubbleArrow(views::BubbleBorder::Arrow arrow); |
66 | 74 |
67 void MaybeSetAnchorPoint(const gfx::Point& anchor_point); | 75 void MaybeSetAnchorPoint(const gfx::Point& anchor_point); |
68 | 76 |
69 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop | 77 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop |
70 // operations outside the application list. This has to be called after | 78 // operations outside the application list. This has to be called after |
71 // Initialize was called since the app list object needs to exist so that | 79 // Initialize was called since the app list object needs to exist so that |
72 // it can set the host. | 80 // it can set the host. |
73 void SetDragAndDropHostOfCurrentAppList( | 81 void SetDragAndDropHostOfCurrentAppList( |
(...skipping 28 matching lines...) Expand all Loading... | |
102 PaginationModel* GetAppsPaginationModel(); | 110 PaginationModel* GetAppsPaginationModel(); |
103 | 111 |
104 // Overridden from views::View: | 112 // Overridden from views::View: |
105 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 113 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
106 void Layout() override; | 114 void Layout() override; |
107 void SchedulePaintInRect(const gfx::Rect& rect) override; | 115 void SchedulePaintInRect(const gfx::Rect& rect) override; |
108 | 116 |
109 // Changes the app list state. | 117 // Changes the app list state. |
110 void SetState(AppListState new_state); | 118 void SetState(AppListState new_state); |
111 | 119 |
112 bool is_fullscreen() const { return app_list_state_ == FULLSCREEN; } | 120 // Changes the app list state based on the SearchBox text and the current |
121 // |app_list_state|. | |
vadimt
2017/06/13 18:14:11
the current |app_list_state| => app_list_state_
newcomer
2017/06/13 18:51:46
Done.
| |
122 void SetStateFromSearchBoxView(bool empty); | |
123 | |
124 bool is_fullscreen() const { | |
125 return app_list_state_ == FULLSCREEN_ALL_APPS || | |
126 app_list_state_ == FULLSCREEN_SEARCH; | |
127 } | |
128 | |
113 AppListState app_list_state() const { return app_list_state_; } | 129 AppListState app_list_state() const { return app_list_state_; } |
114 | 130 |
131 // Called from the AppListPresenterDelegate when maximize mode starts and | |
vadimt
2017/06/13 18:14:11
No from, only when.
newcomer
2017/06/13 18:51:46
Done.
| |
132 // ends. | |
133 void OnMaximizeModeChanged(bool shown); | |
134 | |
115 private: | 135 private: |
116 friend class test::AppListViewTestApi; | 136 friend class test::AppListViewTestApi; |
117 | 137 |
118 void InitContents(gfx::NativeView parent, int initial_apps_page); | 138 void InitContents(gfx::NativeView parent, int initial_apps_page); |
119 | 139 |
120 void InitChildWidgets(); | 140 void InitChildWidgets(); |
121 | 141 |
122 // Initializes the widget for fullscreen mode. | 142 // Initializes the widget for fullscreen mode. |
123 void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page); | 143 void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page); |
124 | 144 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 AppListMainView* app_list_main_view_; | 187 AppListMainView* app_list_main_view_; |
168 SpeechView* speech_view_; | 188 SpeechView* speech_view_; |
169 views::Widget* fullscreen_widget_ = nullptr; // Owned by AppListView. | 189 views::Widget* fullscreen_widget_ = nullptr; // Owned by AppListView. |
170 | 190 |
171 views::View* search_box_focus_host_; // Owned by the views hierarchy. | 191 views::View* search_box_focus_host_; // Owned by the views hierarchy. |
172 views::Widget* search_box_widget_; // Owned by the app list's widget. | 192 views::Widget* search_box_widget_; // Owned by the app list's widget. |
173 SearchBoxView* search_box_view_; // Owned by |search_box_widget_|. | 193 SearchBoxView* search_box_view_; // Owned by |search_box_widget_|. |
174 // Owned by the app list's widget. Null if the fullscreen app list is not | 194 // Owned by the app list's widget. Null if the fullscreen app list is not |
175 // enabled. | 195 // enabled. |
176 views::View* app_list_background_shield_ = nullptr; | 196 views::View* app_list_background_shield_ = nullptr; |
197 // Whether maximize mode is active. | |
198 bool is_maximize_mode_; | |
vadimt
2017/06/13 18:14:11
Initialize here
newcomer
2017/06/13 18:51:46
Done.
| |
199 // Whether the shelf is oriented on the side. | |
200 bool is_side_shelf_; | |
201 | |
177 // The gap between the initial gesture event and the top of the window. | 202 // The gap between the initial gesture event and the top of the window. |
178 gfx::Point initial_drag_point_; | 203 gfx::Point initial_drag_point_; |
179 // The velocity of the gesture event. | 204 // The velocity of the gesture event. |
180 float last_fling_velocity_ = 0; | 205 float last_fling_velocity_ = 0; |
181 // The state of the app list, controlled via SetState(). | 206 // The state of the app list, controlled via SetState(). |
182 AppListState app_list_state_; | 207 AppListState app_list_state_; |
183 | 208 |
184 // An observer that notifies AppListView when the display has changed. | 209 // An observer that notifies AppListView when the display has changed. |
185 ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; | 210 ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; |
186 | 211 |
187 // A semi-transparent white overlay that covers the app list while dialogs are | 212 // A semi-transparent white overlay that covers the app list while dialogs are |
188 // open. | 213 // open. |
189 views::View* overlay_view_; | 214 views::View* overlay_view_; |
190 | 215 |
191 std::unique_ptr<HideViewAnimationObserver> animation_observer_; | 216 std::unique_ptr<HideViewAnimationObserver> animation_observer_; |
192 | 217 |
193 // For UMA and testing. If non-null, triggered when the app list is painted. | 218 // For UMA and testing. If non-null, triggered when the app list is painted. |
194 base::Closure next_paint_callback_; | 219 base::Closure next_paint_callback_; |
195 | 220 |
196 DISALLOW_COPY_AND_ASSIGN(AppListView); | 221 DISALLOW_COPY_AND_ASSIGN(AppListView); |
197 }; | 222 }; |
198 | 223 |
199 } // namespace app_list | 224 } // namespace app_list |
200 | 225 |
201 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 226 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
OLD | NEW |