apps_grid_view_folder_delegate.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2014 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_APPS_GRID_VIEW_FOLDER_DELEGATE_H_
  5. #define ASH_APP_LIST_VIEWS_APPS_GRID_VIEW_FOLDER_DELEGATE_H_
  6. #include <memory>
  7. #include "ash/app_list/views/app_drag_icon_proxy.h"
  8. #include "ash/app_list/views/apps_grid_view.h"
  9. #include "ash/ash_export.h"
  10. namespace gfx {
  11. class Point;
  12. }
  13. namespace ash {
  14. class AppListItemView;
  15. // A delegate which allows an AppsGridView to communicate with its host folder.
  16. class ASH_EXPORT AppsGridViewFolderDelegate {
  17. public:
  18. // Called when a folder item is dragged out of the folder to be re-parented.
  19. // `original_drag_view` is the `drag_view_` inside the folder's grid view.
  20. // `drag_point_in_folder_grid` is the last drag point in coordinate of the
  21. // AppsGridView inside the folder. `pointer` describes the type of pointer
  22. // used for the drag action (mouse or touch).
  23. virtual void ReparentItem(AppsGridView::Pointer pointer,
  24. AppListItemView* original_drag_view,
  25. const gfx::Point& drag_point_in_folder_grid) = 0;
  26. // Dispatches drag event from the hidden grid view to the root level grid view
  27. // for re-parenting a folder item.
  28. virtual void DispatchDragEventForReparent(
  29. AppsGridView::Pointer pointer,
  30. const gfx::Point& drag_point_in_folder_grid) = 0;
  31. // Dispatches EndDrag event from the hidden grid view to the root level grid
  32. // view for reparenting a folder item.
  33. // |events_forwarded_to_drag_drop_host|: True if the dragged item is dropped
  34. // to the drag_drop_host, eg. dropped on shelf.
  35. // |cancel_drag|: True if the drag is ending because it has been canceled.
  36. // |drag_icon_proxy|: The drag icon proxy that was created for the dragged app
  37. // item view, if any.
  38. virtual void DispatchEndDragEventForReparent(
  39. bool events_forwarded_to_drag_drop_host,
  40. bool cancel_drag,
  41. std::unique_ptr<AppDragIconProxy> drag_icon_proxy) = 0;
  42. // Returns whether |drag_point| in the folder apps grid bounds is within the
  43. // folder view's bounds.
  44. virtual bool IsDragPointOutsideOfFolder(const gfx::Point& drag_point) = 0;
  45. // Returns true if the associated folder item is an OEM folder.
  46. virtual bool IsOEMFolder() const = 0;
  47. // Moves |reparented_item| to the root level's grid view, left/right/up/down
  48. // of the folder's grid position.
  49. virtual void HandleKeyboardReparent(AppListItemView* reparented_view,
  50. ui::KeyboardCode key_code) = 0;
  51. protected:
  52. virtual ~AppsGridViewFolderDelegate() {}
  53. };
  54. } // namespace ash
  55. #endif // ASH_APP_LIST_VIEWS_APPS_GRID_VIEW_FOLDER_DELEGATE_H_