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

Unified Diff: ui/app_list/views/app_list_view.cc

Issue 2952763002: SearchBoxView now enables/disables cursor based on user interaction. (Closed)
Patch Set: rebased. Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | ui/app_list/views/search_box_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/app_list_view.cc
diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc
index 48a26d9691f3574d9d65d1e07384ba03e8c7dac8..e0e9a4c74e1e864bbb9ba343ddfb98e36d00e41c 100644
--- a/ui/app_list/views/app_list_view.cc
+++ b/ui/app_list/views/app_list_view.cc
@@ -199,6 +199,7 @@ AppListView::AppListView(AppListViewDelegate* delegate)
search_box_widget_(nullptr),
search_box_view_(nullptr),
is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()),
+ processing_scroll_event_series_(false),
app_list_state_(PEEKING),
display_observer_(this),
overlay_view_(nullptr),
@@ -495,6 +496,25 @@ void AppListView::InitializeBubble(gfx::NativeView parent,
overlay_view_->SetBoundsRect(GetContentsBounds());
}
+void AppListView::HandleClickOrTap() {
+ switch (app_list_state_) {
+ case HALF:
+ case FULLSCREEN_SEARCH:
+ search_box_view_->ClearSearch();
+ SetState(app_list_state_ == HALF ? PEEKING : FULLSCREEN_ALL_APPS);
+ break;
+ case PEEKING:
+ case FULLSCREEN_ALL_APPS:
+ if (search_box_view_->is_search_box_active())
+ search_box_view_->ClearSearch();
+ else
+ SetState(CLOSED);
+ break;
+ case CLOSED:
+ break;
+ }
+}
+
void AppListView::StartDrag(const gfx::Point& location) {
initial_drag_point_ = location;
}
@@ -516,6 +536,9 @@ void AppListView::UpdateDrag(const gfx::Point& location) {
}
void AppListView::EndDrag(const gfx::Point& location) {
+ // When the SearchBoxView closes the app list, ignore the final event.
+ if (app_list_state_ == CLOSED)
+ return;
// Change the app list state based on where the drag ended. If fling velocity
// was over the threshold, snap to the next state in the direction of the
// fling.
@@ -703,16 +726,8 @@ void AppListView::OnMouseEvent(ui::MouseEvent* event) {
switch (event->type()) {
case ui::ET_MOUSE_PRESSED:
- StartDrag(event->location());
- event->SetHandled();
- break;
- case ui::ET_MOUSE_DRAGGED:
- UpdateDrag(event->location());
- event->SetHandled();
- break;
- case ui::ET_MOUSE_RELEASED:
- EndDrag(event->location());
event->SetHandled();
+ HandleClickOrTap();
break;
default:
break;
@@ -724,17 +739,28 @@ void AppListView::OnGestureEvent(ui::GestureEvent* event) {
return;
switch (event->type()) {
+ case ui::ET_GESTURE_TAP:
+ processing_scroll_event_series_ = false;
+ event->SetHandled();
+ HandleClickOrTap();
+ break;
case ui::ET_SCROLL_FLING_START:
case ui::ET_GESTURE_SCROLL_BEGIN:
+ processing_scroll_event_series_ = true;
StartDrag(event->location());
event->SetHandled();
break;
case ui::ET_GESTURE_SCROLL_UPDATE:
+ processing_scroll_event_series_ = true;
last_fling_velocity_ = event->details().scroll_y();
UpdateDrag(event->location());
event->SetHandled();
break;
case ui::ET_GESTURE_END:
+ if (!processing_scroll_event_series_)
+ break;
+
+ processing_scroll_event_series_ = false;
EndDrag(event->location());
event->SetHandled();
break;
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | ui/app_list/views/search_box_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698