Commit c035b3ff authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

applist: Allow swiping up on shelf to show applist when autohide.

Test: manual
Bug: 881483, 891366
Change-Id: I88c5d7a5d41f7ef4013c84debf5c4e963f891d21
Reviewed-on: https://chromium-review.googlesource.com/c/1279356
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599778}
parent e89d87c7
...@@ -729,7 +729,8 @@ bool AppListControllerImpl::ProcessHomeLauncherGesture( ...@@ -729,7 +729,8 @@ bool AppListControllerImpl::ProcessHomeLauncherGesture(
return home_launcher_gesture_handler_->OnScrollEvent( return home_launcher_gesture_handler_->OnScrollEvent(
screen_location, event->details().scroll_y()); screen_location, event->details().scroll_y());
case ui::ET_GESTURE_END: case ui::ET_GESTURE_END:
return home_launcher_gesture_handler_->OnReleaseEvent(screen_location); return home_launcher_gesture_handler_->OnReleaseEvent(
screen_location, /*out_dragged_down=*/nullptr);
default: default:
break; break;
} }
......
...@@ -58,10 +58,6 @@ bool CanProcessWindow(aura::Window* window, ...@@ -58,10 +58,6 @@ bool CanProcessWindow(aura::Window* window,
if (!window) if (!window)
return false; return false;
// Window should not be fullscreen as we do not allow swiping up when auto
// hide for shelf.
DCHECK(!wm::GetWindowState(window)->IsFullscreen());
if (!window->IsVisible() && if (!window->IsVisible() &&
mode == HomeLauncherGestureHandler::Mode::kSlideUpToShow) { mode == HomeLauncherGestureHandler::Mode::kSlideUpToShow) {
return false; return false;
...@@ -208,6 +204,7 @@ bool HomeLauncherGestureHandler::OnPressEvent(Mode mode, ...@@ -208,6 +204,7 @@ bool HomeLauncherGestureHandler::OnPressEvent(Mode mode,
return false; return false;
mode_ = mode; mode_ = mode;
initial_event_location_ = location;
last_event_location_ = base::make_optional(location); last_event_location_ = base::make_optional(location);
UpdateWindows(0.0, /*animate=*/false); UpdateWindows(0.0, /*animate=*/false);
...@@ -221,17 +218,29 @@ bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location, ...@@ -221,17 +218,29 @@ bool HomeLauncherGestureHandler::OnScrollEvent(const gfx::Point& location,
last_event_location_ = base::make_optional(location); last_event_location_ = base::make_optional(location);
last_scroll_y_ = scroll_y; last_scroll_y_ = scroll_y;
if (mode_ == Mode::kSlideUpToShow &&
(*last_event_location_ - initial_event_location_).y() > 0) {
UpdateWindows(0.0, /*animate=*/false);
return true;
}
DCHECK(display_.is_valid()); DCHECK(display_.is_valid());
UpdateWindows(GetHeightInWorkAreaAsRatio(location, display_.work_area()), UpdateWindows(GetHeightInWorkAreaAsRatio(location, display_.work_area()),
/*animate=*/false); /*animate=*/false);
return true; return true;
} }
bool HomeLauncherGestureHandler::OnReleaseEvent(const gfx::Point& location) { bool HomeLauncherGestureHandler::OnReleaseEvent(const gfx::Point& location,
bool* out_dragged_down) {
if (!IsDragInProgress()) if (!IsDragInProgress())
return false; return false;
last_event_location_ = base::make_optional(location); last_event_location_ = base::make_optional(location);
if (out_dragged_down) {
DCHECK_EQ(mode_, Mode::kSlideUpToShow);
*out_dragged_down =
(*last_event_location_ - initial_event_location_).y() > 0;
}
AnimateToFinalState(); AnimateToFinalState();
return true; return true;
} }
......
...@@ -53,7 +53,7 @@ class ASH_EXPORT HomeLauncherGestureHandler : aura::WindowObserver, ...@@ -53,7 +53,7 @@ class ASH_EXPORT HomeLauncherGestureHandler : aura::WindowObserver,
// was not processed. // was not processed.
bool OnPressEvent(Mode mode, const gfx::Point& location); bool OnPressEvent(Mode mode, const gfx::Point& location);
bool OnScrollEvent(const gfx::Point& location, float scroll_y); bool OnScrollEvent(const gfx::Point& location, float scroll_y);
bool OnReleaseEvent(const gfx::Point& location); bool OnReleaseEvent(const gfx::Point& location, bool* out_dragged_down);
// Cancel a current drag and animates the items to their final state based on // Cancel a current drag and animates the items to their final state based on
// |last_event_location_|. // |last_event_location_|.
...@@ -155,6 +155,8 @@ class ASH_EXPORT HomeLauncherGestureHandler : aura::WindowObserver, ...@@ -155,6 +155,8 @@ class ASH_EXPORT HomeLauncherGestureHandler : aura::WindowObserver,
// hidden so the home launcher is visible when swiping up. // hidden so the home launcher is visible when swiping up.
std::vector<aura::Window*> hidden_windows_; std::vector<aura::Window*> hidden_windows_;
gfx::Point initial_event_location_;
// Tracks the location of the last received event in screen coordinates. Empty // Tracks the location of the last received event in screen coordinates. Empty
// if there is currently no window being processed. // if there is currently no window being processed.
base::Optional<gfx::Point> last_event_location_; base::Optional<gfx::Point> last_event_location_;
......
...@@ -1212,7 +1212,7 @@ void ShelfLayoutManager::StartGestureDrag( ...@@ -1212,7 +1212,7 @@ void ShelfLayoutManager::StartGestureDrag(
} else { } else {
HomeLauncherGestureHandler* home_launcher_handler = HomeLauncherGestureHandler* home_launcher_handler =
Shell::Get()->app_list_controller()->home_launcher_gesture_handler(); Shell::Get()->app_list_controller()->home_launcher_gesture_handler();
if (home_launcher_handler && visibility_state() == SHELF_VISIBLE && if (home_launcher_handler && IsVisible() &&
home_launcher_handler->OnPressEvent( home_launcher_handler->OnPressEvent(
HomeLauncherGestureHandler::Mode::kSlideUpToShow, HomeLauncherGestureHandler::Mode::kSlideUpToShow,
gesture_in_screen.location())) { gesture_in_screen.location())) {
...@@ -1237,7 +1237,7 @@ void ShelfLayoutManager::UpdateGestureDrag( ...@@ -1237,7 +1237,7 @@ void ShelfLayoutManager::UpdateGestureDrag(
const ui::GestureEvent& gesture_in_screen) { const ui::GestureEvent& gesture_in_screen) {
HomeLauncherGestureHandler* home_launcher_handler = HomeLauncherGestureHandler* home_launcher_handler =
Shell::Get()->app_list_controller()->home_launcher_gesture_handler(); Shell::Get()->app_list_controller()->home_launcher_gesture_handler();
if (home_launcher_handler && visibility_state() == SHELF_VISIBLE && if (home_launcher_handler && IsVisible() &&
home_launcher_handler->OnScrollEvent( home_launcher_handler->OnScrollEvent(
gesture_in_screen.location(), gesture_in_screen.location(),
gesture_in_screen.details().scroll_y())) { gesture_in_screen.details().scroll_y())) {
...@@ -1301,8 +1301,16 @@ void ShelfLayoutManager::CompleteAppListDrag( ...@@ -1301,8 +1301,16 @@ void ShelfLayoutManager::CompleteAppListDrag(
HomeLauncherGestureHandler* home_launcher_handler = HomeLauncherGestureHandler* home_launcher_handler =
Shell::Get()->app_list_controller()->home_launcher_gesture_handler(); Shell::Get()->app_list_controller()->home_launcher_gesture_handler();
if (home_launcher_handler && visibility_state() == SHELF_VISIBLE && bool dragged_down;
home_launcher_handler->OnReleaseEvent(gesture_in_screen.location())) { if (home_launcher_handler && IsVisible() &&
home_launcher_handler->OnReleaseEvent(gesture_in_screen.location(),
&dragged_down)) {
if (dragged_down && visibility_state() == SHELF_AUTO_HIDE) {
DCHECK_EQ(SHELF_AUTO_HIDE_SHOWN, gesture_drag_auto_hide_state_);
gesture_drag_auto_hide_state_ = SHELF_AUTO_HIDE_HIDDEN;
gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS;
UpdateVisibilityState();
}
gesture_drag_status_ = GESTURE_DRAG_NONE; gesture_drag_status_ = GESTURE_DRAG_NONE;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment