app_list_presenter_event_filter.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_APP_LIST_APP_LIST_PRESENTER_EVENT_FILTER_H_
  5. #define ASH_APP_LIST_APP_LIST_PRESENTER_EVENT_FILTER_H_
  6. #include "ash/ash_export.h"
  7. #include "ui/events/event_handler.h"
  8. namespace ui {
  9. class LocatedEvent;
  10. } // namespace ui
  11. namespace ash {
  12. class AppListControllerImpl;
  13. class AppListPresenterImpl;
  14. class AppListView;
  15. // Listens for mouse clicks and taps outside the app list to close the UI when
  16. // necessary. Used by the peeking/fullscreen launcher.
  17. class ASH_EXPORT AppListPresenterEventFilter : public ui::EventHandler {
  18. public:
  19. AppListPresenterEventFilter(AppListControllerImpl* controller,
  20. AppListPresenterImpl* presenter,
  21. AppListView* view);
  22. AppListPresenterEventFilter(const AppListPresenterEventFilter&) = delete;
  23. AppListPresenterEventFilter& operator=(const AppListPresenterEventFilter&) =
  24. delete;
  25. ~AppListPresenterEventFilter() override;
  26. // ui::EventHandler overrides:
  27. void OnMouseEvent(ui::MouseEvent* event) override;
  28. void OnGestureEvent(ui::GestureEvent* event) override;
  29. void OnKeyEvent(ui::KeyEvent* event) override;
  30. private:
  31. void ProcessLocatedEvent(ui::LocatedEvent* event);
  32. AppListControllerImpl* const controller_;
  33. AppListPresenterImpl* const presenter_;
  34. AppListView* const view_;
  35. };
  36. } // namespace ash
  37. #endif // ASH_APP_LIST_APP_LIST_PRESENTER_EVENT_FILTER_H_