Skip to content

Commit

Permalink
Remove HomeLauncherGestureHandler
Browse files Browse the repository at this point in the history
With recent changes HomeLauncherGestureHandler has become a wrapper
around a SwipeHomeToOverviewController used by ShelfLayoutManager.
This CL adds SwipeHomeToOverviewController to ShelfLayoutManager, and
removes the unnecessary level of abstraction.

BUG=1137452

Change-Id: I19974b96a57718186137ba663dc2fc6b53ee90ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532971
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Reviewed-by: Alex Newcomer <newcomer@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827308}
  • Loading branch information
Toni Barzic authored and Commit Bot committed Nov 13, 2020
1 parent ed1eba4 commit 9965523
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 330 deletions.
2 changes: 0 additions & 2 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,6 @@ component("ash") {
"highlighter/highlighter_view.h",
"home_screen/drag_window_from_shelf_controller.cc",
"home_screen/drag_window_from_shelf_controller.h",
"home_screen/home_launcher_gesture_handler.cc",
"home_screen/home_launcher_gesture_handler.h",
"home_screen/home_screen_controller.cc",
"home_screen/home_screen_controller.h",
"home_screen/home_screen_delegate.h",
Expand Down
1 change: 0 additions & 1 deletion ash/app_list/app_list_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "ash/assistant/ui/assistant_view_delegate.h"
#include "ash/assistant/util/assistant_util.h"
#include "ash/assistant/util/deep_link_util.h"
#include "ash/home_screen/home_launcher_gesture_handler.h"
#include "ash/home_screen/home_screen_controller.h"
#include "ash/keyboard/ui/keyboard_ui_controller.h"
#include "ash/public/cpp/app_list/app_list_client.h"
Expand Down
1 change: 0 additions & 1 deletion ash/app_list/app_list_controller_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "ash/app_list/views/expand_arrow_view.h"
#include "ash/app_list/views/search_box_view.h"
#include "ash/app_list/views/test/apps_grid_view_test_api.h"
#include "ash/home_screen/home_launcher_gesture_handler.h"
#include "ash/home_screen/home_screen_controller.h"
#include "ash/ime/ime_controller_impl.h"
#include "ash/ime/test_ime_controller_client.h"
Expand Down
2 changes: 1 addition & 1 deletion ash/app_list/views/contents_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void ContentsView::ResetForShow() {
SetActiveState(AppListState::kStateApps, /*animate=*/false);
// In side shelf, the opacity of the contents is not animated so set it to the
// final state. In tablet mode, opacity of the elements is controlled by the
// HomeLauncherGestureHandler which expects these elements to be opaque.
// HomeScreenController which expects these elements to be opaque.
// Otherwise the contents animate from 0 to 1 so set the initial opacity to 0.
if (app_list_view_->is_side_shelf() || app_list_view_->is_tablet_mode()) {
AnimateToViewState(AppListViewState::kFullscreenAllApps, base::TimeDelta());
Expand Down
100 changes: 0 additions & 100 deletions ash/home_screen/home_launcher_gesture_handler.cc

This file was deleted.

91 changes: 0 additions & 91 deletions ash/home_screen/home_launcher_gesture_handler.h

This file was deleted.

5 changes: 1 addition & 4 deletions ash/home_screen/home_screen_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <vector>

#include "ash/app_list/app_list_controller_impl.h"
#include "ash/home_screen/home_launcher_gesture_handler.h"
#include "ash/home_screen/home_screen_delegate.h"
#include "ash/home_screen/window_scale_animation.h"
#include "ash/public/cpp/ash_features.h"
Expand Down Expand Up @@ -105,9 +104,7 @@ class WindowAnimationsCallback : public ui::LayerAnimationObserver {

} // namespace

HomeScreenController::HomeScreenController()
: home_launcher_gesture_handler_(
std::make_unique<HomeLauncherGestureHandler>()) {
HomeScreenController::HomeScreenController() {
Shell::Get()->overview_controller()->AddObserver(this);
Shell::Get()->wallpaper_controller()->AddObserver(this);
}
Expand Down
14 changes: 2 additions & 12 deletions ash/home_screen/home_screen_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ class ThroughputTracker;

namespace ash {

class HomeLauncherGestureHandler;
class HomeScreenDelegate;

// HomeScreenController handles the home launcher (e.g., tablet-mode app list)
// and owns the HomeLauncherGestureHandler that transitions the launcher window
// and other windows when the launcher is shown, hidden or animated.
// HomeScreenController provides functionality to control the home launcher -
// the tablet mode app list.
class ASH_EXPORT HomeScreenController : public OverviewObserver,
public SplitViewObserver,
public WallpaperControllerObserver {
Expand Down Expand Up @@ -85,10 +83,6 @@ class ASH_EXPORT HomeScreenController : public OverviewObserver,

HomeScreenDelegate* delegate() { return delegate_; }

HomeLauncherGestureHandler* home_launcher_gesture_handler() {
return home_launcher_gesture_handler_.get();
}

private:
// OverviewObserver:
void OnOverviewModeStarting() override;
Expand Down Expand Up @@ -122,10 +116,6 @@ class ASH_EXPORT HomeScreenController : public OverviewObserver,
// Not owned.
HomeScreenDelegate* delegate_ = nullptr;

// Owned pointer to the object which handles gestures related to the home
// launcher.
std::unique_ptr<HomeLauncherGestureHandler> home_launcher_gesture_handler_;

// Presenter that manages home screen animations.
HomeScreenPresenter home_screen_presenter_{this};

Expand Down
2 changes: 1 addition & 1 deletion ash/home_screen/swipe_home_to_overview_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace ash {

// Used by HomeLauncherGestureHandler to handle gesture drag events while the
// Used by ShelfLayoutManager to handle gesture drag events while the
// handler is in kSwipeHomeToOverview mode. The controller handles swipe gesture
// from hot seat on the home screen. The gesture, if detected, transitions the
// home screen to the overview UI.
Expand Down
12 changes: 4 additions & 8 deletions ash/shelf/home_to_overview_nudge_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include "ash/shelf/home_to_overview_nudge_controller.h"

#include "ash/home_screen/home_launcher_gesture_handler.h"
#include "ash/home_screen/home_screen_controller.h"
#include "ash/home_screen/swipe_home_to_overview_controller.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_pref_names.h"
Expand Down Expand Up @@ -625,9 +623,8 @@ TEST_F(HomeToOverviewNudgeControllerTest, NoNudgeAfterSuccessfulGestures) {
// transition to overview (which happens after swipe moves far
// enough), run it to trigger transition to overview.
SwipeHomeToOverviewController* swipe_controller =
Shell::Get()
->home_screen_controller()
->home_launcher_gesture_handler()
GetPrimaryShelf()
->shelf_layout_manager()
->swipe_home_to_overview_controller_for_testing();
ASSERT_TRUE(swipe_controller);

Expand Down Expand Up @@ -678,9 +675,8 @@ TEST_F(HomeToOverviewNudgeControllerTest, HomeToOverviewGestureFromNudge) {
// transition to overview (which happens after swipe moves far
// enough), run it to trigger transition to overview.
SwipeHomeToOverviewController* swipe_controller =
Shell::Get()
->home_screen_controller()
->home_launcher_gesture_handler()
GetPrimaryShelf()
->shelf_layout_manager()
->swipe_home_to_overview_controller_for_testing();
ASSERT_TRUE(swipe_controller);

Expand Down
4 changes: 2 additions & 2 deletions ash/shelf/hotseat_widget_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1590,8 +1590,8 @@ TEST_P(HotseatWidgetTest, HotseatFlushWithScreenBottomInClamshell) {
EXPECT_EQ(hotseat_bottom, display_height);
}

// Tests that when hotseat and drag-window-to-overview features are both
// enabled, HomeLauncherGestureHandler can receive and process events properly.
// Tests that upward drag gesture from the shelf in tablet mode affects the
// active window presentation.
TEST_P(HotseatWidgetTest, DragActiveWindowInTabletMode) {
GetPrimaryShelf()->SetAutoHideBehavior(shelf_auto_hide_behavior());
TabletModeControllerTestApi().EnterTabletMode();
Expand Down
Loading

0 comments on commit 9965523

Please sign in to comment.