app_list_keyboard_controller.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2022 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_VIEWS_APP_LIST_KEYBOARD_CONTROLLER_H_
  5. #define ASH_APP_LIST_VIEWS_APP_LIST_KEYBOARD_CONTROLLER_H_
  6. #include "ash/ash_export.h"
  7. namespace ash {
  8. class AppListViewProvider;
  9. // Common code that implements keyboard traversal logic in
  10. // `AppListBubbleAppsPage` and `AppsContainerView`.
  11. class ASH_EXPORT AppListKeyboardController {
  12. public:
  13. explicit AppListKeyboardController(AppListViewProvider* view_provider);
  14. AppListKeyboardController(const AppListKeyboardController&) = delete;
  15. AppListKeyboardController& operator=(const AppListKeyboardController&) =
  16. delete;
  17. ~AppListKeyboardController() = default;
  18. // Moves focus down/up and out (usually to the apps grid / continue tasks).
  19. // `column` is the column of the items that was focused in the recent apps
  20. // list.
  21. void MoveFocusDownFromRecents(int column);
  22. void MoveFocusUpFromRecents();
  23. // Attempts to move focus down/up and out (usually to the apps grid / recent
  24. // apps).
  25. // `column` is the column of the item that was focused before moving
  26. // focus on this toast container.
  27. bool MoveFocusDownFromToast(int column);
  28. bool MoveFocusUpFromToast(int column);
  29. // Attempts to move focus up and out (usually to the recent apps list).
  30. // `column` is the column of the item that was focused in the grid.
  31. bool MoveFocusUpFromAppsGrid(int column);
  32. private:
  33. // Helper functions to move the focus to RecentAppsView/AppsGridView.
  34. bool HandleMovingFocusToAppsGrid(int column);
  35. bool HandleMovingFocusToRecents(int column);
  36. AppListViewProvider* const view_provider_;
  37. };
  38. } // namespace ash
  39. #endif // ASH_APP_LIST_VIEWS_APP_LIST_KEYBOARD_CONTROLLER_H_