Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1042)

Side by Side Diff: ui/app_list/views/app_list_view.h

Issue 2939693004: Added HALF, FULLSCREEN_ALL_APPS, and FULLSCREEN_SEARCH. (Closed)
Patch Set: Addressed comments. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
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,
xiyuan 2017/06/13 21:38:59 Avoid using default arguments. Either update all c
newcomer 2017/06/13 22:22:48 Done.
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
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_.
oshima 2017/06/13 22:26:04 document |empty| argument.
newcomer 2017/06/13 23:00:39 I changed the variable to |search_box_is_empty|, I
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 when maximize mode starts and ends.
132 void OnMaximizeModeChanged(bool shown);
133
115 private: 134 private:
116 friend class test::AppListViewTestApi; 135 friend class test::AppListViewTestApi;
117 136
118 void InitContents(gfx::NativeView parent, int initial_apps_page); 137 void InitContents(gfx::NativeView parent, int initial_apps_page);
119 138
120 void InitChildWidgets(); 139 void InitChildWidgets();
121 140
122 // Initializes the widget for fullscreen mode. 141 // Initializes the widget for fullscreen mode.
123 void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page); 142 void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page);
124 143
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 AppListMainView* app_list_main_view_; 186 AppListMainView* app_list_main_view_;
168 SpeechView* speech_view_; 187 SpeechView* speech_view_;
169 views::Widget* fullscreen_widget_ = nullptr; // Owned by AppListView. 188 views::Widget* fullscreen_widget_ = nullptr; // Owned by AppListView.
170 189
171 views::View* search_box_focus_host_; // Owned by the views hierarchy. 190 views::View* search_box_focus_host_; // Owned by the views hierarchy.
172 views::Widget* search_box_widget_; // Owned by the app list's widget. 191 views::Widget* search_box_widget_; // Owned by the app list's widget.
173 SearchBoxView* search_box_view_; // Owned by |search_box_widget_|. 192 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 193 // Owned by the app list's widget. Null if the fullscreen app list is not
175 // enabled. 194 // enabled.
176 views::View* app_list_background_shield_ = nullptr; 195 views::View* app_list_background_shield_ = nullptr;
196 // Whether maximize mode is active.
197 bool is_maximize_mode_ = false;
198 // Whether the shelf is oriented on the side.
199 bool is_side_shelf_ = false;
200
177 // The gap between the initial gesture event and the top of the window. 201 // The gap between the initial gesture event and the top of the window.
178 gfx::Point initial_drag_point_; 202 gfx::Point initial_drag_point_;
179 // The velocity of the gesture event. 203 // The velocity of the gesture event.
180 float last_fling_velocity_ = 0; 204 float last_fling_velocity_ = 0;
181 // The state of the app list, controlled via SetState(). 205 // The state of the app list, controlled via SetState().
182 AppListState app_list_state_; 206 AppListState app_list_state_;
183 207
184 // An observer that notifies AppListView when the display has changed. 208 // An observer that notifies AppListView when the display has changed.
185 ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; 209 ScopedObserver<display::Screen, display::DisplayObserver> display_observer_;
186 210
187 // A semi-transparent white overlay that covers the app list while dialogs are 211 // A semi-transparent white overlay that covers the app list while dialogs are
188 // open. 212 // open.
189 views::View* overlay_view_; 213 views::View* overlay_view_;
190 214
191 std::unique_ptr<HideViewAnimationObserver> animation_observer_; 215 std::unique_ptr<HideViewAnimationObserver> animation_observer_;
192 216
193 // For UMA and testing. If non-null, triggered when the app list is painted. 217 // For UMA and testing. If non-null, triggered when the app list is painted.
194 base::Closure next_paint_callback_; 218 base::Closure next_paint_callback_;
195 219
196 DISALLOW_COPY_AND_ASSIGN(AppListView); 220 DISALLOW_COPY_AND_ASSIGN(AppListView);
197 }; 221 };
198 222
199 } // namespace app_list 223 } // namespace app_list
200 224
201 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ 225 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698