app_list_folder_controller.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_VIEWS_APP_LIST_FOLDER_CONTROLLER_H_
  5. #define ASH_APP_LIST_VIEWS_APP_LIST_FOLDER_CONTROLLER_H_
  6. #include "base/callback_forward.h"
  7. namespace ash {
  8. class AppListFolderItem;
  9. class AppListItemView;
  10. // An interface used to abstract app list folder UI activation from
  11. // AppsGridView. Tapping a folder item in the apps grid is expected to show
  12. // folder UI for that item. Apps grid view itself does not know how to show a
  13. // folder view - folder UI is managed by apps grid view's embedders. This
  14. // interface lets AppsGridView request folder UI state changes without making
  15. // assumptions about the context in which it's shown.
  16. class AppListFolderController {
  17. public:
  18. virtual ~AppListFolderController() = default;
  19. // Shows a folder view for the provided app list folder item view. The folder
  20. // will be anchored at `folder_item_view`, and it will show the contents of
  21. // the associated folder item (`folder_item_view->item()`).
  22. // `focus_name_input` indicates whether the folder name textfield should
  23. // receive focus by default.
  24. // `hide_callback` is a callback run when the folder view gets hidden.
  25. virtual void ShowFolderForItemView(AppListItemView* folder_item_view,
  26. bool focus_name_input,
  27. base::OnceClosure hide_callback) = 0;
  28. // Shows the root level apps list. Called when the UI navigates back from the
  29. // folder for `folder_item_view`. If `folder_item_view` is nullptr skips
  30. // animation. If `folder_item_view` is non-null and `select_folder` is true,
  31. // the folder item is selected (e.g. for keyboard navigation).
  32. virtual void ShowApps(AppListItemView* folder_item_view,
  33. bool select_folder) = 0;
  34. // Transits the UI from folder view to root level apps grid view when
  35. // re-parenting a child item of |folder_item|.
  36. virtual void ReparentFolderItemTransit(AppListFolderItem* folder_item) = 0;
  37. // Notifies the container that a reparent drag has completed.
  38. virtual void ReparentDragEnded() = 0;
  39. };
  40. } // namespace ash
  41. #endif // ASH_APP_LIST_VIEWS_APP_LIST_FOLDER_CONTROLLER_H_