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 5 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_FOLDER_DELEGATE_H_ 6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_FOLDER_DELEGATE_H_ 7 8 #include "ui/app_list/app_list_export.h" 9 #include "ui/app_list/views/apps_grid_view.h" 10 11 namespace gfx { 12 class Point; 13 } 14 15 namespace ui { 16 class LocatedEvent; 17 } 18 19 namespace app_list { 20 21 class AppListItemView; 22 23 // A delegate which allows an AppsGridView to communicate with its host folder. 24 class APP_LIST_EXPORT AppsGridViewFolderDelegate { 25 public: 26 // Updates the folder view background to show or hide folder container ink 27 // bubble. 28 virtual void UpdateFolderViewBackground(bool show_bubble) = 0; 29 30 // Called when a folder item is dragged out of the folder to be re-parented. 31 // |original_drag_view| is the |drag_view_| inside the folder's grid view. 32 // |drag_point_in_folder_grid| is the last drag point in coordinate of the 33 // AppsGridView inside the folder. 34 virtual void ReparentItem(AppListItemView* original_drag_view, 35 const gfx::Point& drag_point_in_folder_grid) = 0; 36 37 // Dispatches drag event from the hidden grid view to the root level grid view 38 // for re-parenting a folder item. 39 virtual void DispatchDragEventForReparent( 40 AppsGridView::Pointer pointer, 41 const gfx::Point& drag_point_in_folder_grid) = 0; 42 43 // Dispatches EndDrag event from the hidden grid view to the root level grid 44 // view for reparenting a folder item. 45 // |events_forwarded_to_drag_drop_host|: True if the dragged item is dropped 46 // to the drag_drop_host, eg. dropped on shelf. 47 // |cancel_drag|: True if the drag is ending because it has been canceled. 48 virtual void DispatchEndDragEventForReparent( 49 bool events_forwarded_to_drag_drop_host, 50 bool cancel_drag) = 0; 51 52 // Returns true if |point| falls outside of the folder container ink bubble. 53 virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) = 0; 54 55 // Returns true if the associated folder item is an OEM folder. 56 virtual bool IsOEMFolder() const = 0; 57 58 // Hides or show the root level's grid view. This is needed so that the 59 // synchronous drag has an icon for reparenting while it loads. 60 virtual void SetRootLevelDragViewVisible(bool visible) = 0; 61 62 protected: ~AppsGridViewFolderDelegate()63 virtual ~AppsGridViewFolderDelegate() {} 64 }; 65 66 } // namespace app_list 67 68 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_FOLDER_DELEGATE_H_ 69