+void AppListFolderView::UpdateFolderViewBackground(bool show_bubble) {
+ if (hide_for_reparent_)
+ return;
+
+ // Before showing the folder container inking bubble, hide the folder name.
+ if (show_bubble)
+ UpdateFolderNameVisibility(false);
+
+ container_view_->folder_background_view()->UpdateFolderContainerBubble(
+ show_bubble ? FolderBackgroundView::SHOW_BUBBLE :
+ FolderBackgroundView::HIDE_BUBBLE);
+}
+
+void AppListFolderView::UpdateFolderNameVisibility(bool visible) {
+ folder_header_view_->UpdateFolderNameVisibility(visible);
+}
+
+bool AppListFolderView::IsPointOutsideOfFolderBoundray(
+ const gfx::Point& point) {
+ if (!GetLocalBounds().Contains(point))
+ return true;
+
+ gfx::Point center = GetLocalBounds().CenterPoint();
+ float delta = (point - center).Length();
+ return delta > container_view_->folder_background_view()->
+ GetFolderContainerBubbleRadius() + kOutOfFolderContainerBubbleDelta;
+}
+
+// When user drags a folder item out of the folder boundary ink bubble, the
+// folder view UI will be hidden, and switch back to top level AppsGridView.
+// The dragged item will seamlessly move on the top level AppsGridView.
+// In order to achieve the above, we keep the folder view and its child grid
+// view visible with opacity 0, so that the drag_view_ on the hidden grid view
+// will keep receiving mouse event. At the same time, we initiated a new
+// drag_view_ in the top level grid view, and keep it moving with the hidden
+// grid view's drag_view_, so that the dragged item can be engaged in drag and
+// drop flow in the top level grid view. During the reparenting process, the
+// drag_view_ in hidden grid view will dispatch the drag and drop event to
+// the top level grid view, until the drag ends.
+void AppListFolderView::ReparentItem(
+ AppListItemView* original_drag_view,
+ const gfx::Point& drag_point_in_folder_grid) {
+ // Convert the drag point relative to the root level AppsGridView.
+ gfx::Point to_root_level_grid = drag_point_in_folder_grid;
+ ConvertPointToTarget(items_grid_view_,
+ container_view_->apps_grid_view(),
+ &to_root_level_grid);
+ StartSetupDragInRootLevelAppsGridView(original_drag_view, to_root_level_grid);
+ container_view_->ReparentFolderItemTransit(folder_item_);
+}
+
+void AppListFolderView::DispatchDragEventForReparent(
+ AppsGridView::Pointer pointer,
+ const ui::LocatedEvent& event) {
+ container_view_->apps_grid_view()->UpdateDragFromReparentItem(pointer, event);
+}
+
+void AppListFolderView::DispatchEndDragEventForReparent(
+ bool events_forwarded_to_drag_drop_host) {
+ container_view_->apps_grid_view()->
+ EndDragFromReparentItemInRootLevel(events_forwarded_to_drag_drop_host);
+}
+
+
+void AppListFolderView::HideViewImmediately() {
+ SetVisible(false);
+ hide_for_reparent_ = false;
+}
+