Commit d456989a authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

overview: Simplify code from CL 1560298

Code from this CL is now unnecessarily complicated (and might have been
so all along):
https://chromium-review.googlesource.com/c/chromium/src/+/1560298
There is no need for OverviewSession::GetGridWithOverviewItem() when we
have OverviewItem::overview_grid(). Then there is also no need for
OverviewSession::AddDropTargetForDraggingFromOverview() or
OverviewSession::RemoveDropTargetForDraggingFromOverview(), as the whole
purpose of putting them in OverviewSession was so that they could call
OverviewSession::GetGridWithOverviewItem(). In fact, currently,
OverviewWindowDragController::CompleteNormalDrag() uses
item_->overview_grid()->RemoveDropTarget() whereas
OverviewWindowDragController::ResetGesture() uses
overview_session_->RemoveDropTargetForDraggingFromOverview(item_), and
there is no reason why they should use different code to remove the drop
target.

Test: manual
Change-Id: Ic973e90d08c9b81b00566306e6b3e3e655939ef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1628233Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663084}
parent 408491d2
...@@ -505,23 +505,12 @@ void OverviewSession::RemoveItem(OverviewItem* overview_item) { ...@@ -505,23 +505,12 @@ void OverviewSession::RemoveItem(OverviewItem* overview_item) {
restore_focus_window_ = nullptr; restore_focus_window_ = nullptr;
} }
GetGridWithOverviewItem(overview_item)->RemoveItem(overview_item); overview_item->overview_grid()->RemoveItem(overview_item);
--num_items_; --num_items_;
MaybeCreateAndPositionNoWindowsWidget(); MaybeCreateAndPositionNoWindowsWidget();
} }
void OverviewSession::AddDropTargetForDraggingFromOverview(
OverviewItem* dragged_item) {
GetGridWithOverviewItem(dragged_item)
->AddDropTargetForDraggingFromOverview(dragged_item);
}
void OverviewSession::RemoveDropTargetForDraggingFromOverview(
OverviewItem* dragged_item) {
GetGridWithOverviewItem(dragged_item)->RemoveDropTarget();
}
void OverviewSession::InitiateDrag(OverviewItem* item, void OverviewSession::InitiateDrag(OverviewItem* item,
const gfx::PointF& location_in_screen) { const gfx::PointF& location_in_screen) {
window_drag_controller_ = window_drag_controller_ =
...@@ -969,11 +958,6 @@ void OverviewSession::OnSplitViewDividerPositionChanged() { ...@@ -969,11 +958,6 @@ void OverviewSession::OnSplitViewDividerPositionChanged() {
MaybeCreateAndPositionNoWindowsWidget(); MaybeCreateAndPositionNoWindowsWidget();
} }
OverviewGrid* OverviewSession::GetGridWithOverviewItem(OverviewItem* item) {
DCHECK(GetGridWithRootWindow(item->GetWindow()->GetRootWindow()));
return GetGridWithRootWindow(item->GetWindow()->GetRootWindow());
}
void OverviewSession::ResetFocusRestoreWindow(bool focus) { void OverviewSession::ResetFocusRestoreWindow(bool focus) {
if (!restore_focus_window_) if (!restore_focus_window_)
return; return;
......
...@@ -163,13 +163,6 @@ class ASH_EXPORT OverviewSession : public display::DisplayObserver, ...@@ -163,13 +163,6 @@ class ASH_EXPORT OverviewSession : public display::DisplayObserver,
// repositioned. // repositioned.
void RemoveItem(OverviewItem* overview_item); void RemoveItem(OverviewItem* overview_item);
// Adds a drop target that visually appears to be revealed as |dragged_item|
// is dragged off of it.
void AddDropTargetForDraggingFromOverview(OverviewItem* dragged_item);
// Removes the drop target from the grid containing |dragged_item|.
void RemoveDropTargetForDraggingFromOverview(OverviewItem* dragged_item);
void InitiateDrag(OverviewItem* item, const gfx::PointF& location_in_screen); void InitiateDrag(OverviewItem* item, const gfx::PointF& location_in_screen);
void Drag(OverviewItem* item, const gfx::PointF& location_in_screen); void Drag(OverviewItem* item, const gfx::PointF& location_in_screen);
void CompleteDrag(OverviewItem* item, const gfx::PointF& location_in_screen); void CompleteDrag(OverviewItem* item, const gfx::PointF& location_in_screen);
...@@ -303,9 +296,6 @@ class ASH_EXPORT OverviewSession : public display::DisplayObserver, ...@@ -303,9 +296,6 @@ class ASH_EXPORT OverviewSession : public display::DisplayObserver,
private: private:
friend class OverviewSessionTest; friend class OverviewSessionTest;
// Retrieves the window grid containing |item|.
OverviewGrid* GetGridWithOverviewItem(OverviewItem* item);
// |focus|, restores focus to the stored window. // |focus|, restores focus to the stored window.
void ResetFocusRestoreWindow(bool focus); void ResetFocusRestoreWindow(bool focus);
......
...@@ -192,7 +192,7 @@ void OverviewWindowDragController::StartNormalDragMode( ...@@ -192,7 +192,7 @@ void OverviewWindowDragController::StartNormalDragMode(
original_scaled_size_ = item_->target_bounds().size(); original_scaled_size_ = item_->target_bounds().size();
if (should_allow_split_view_) { if (should_allow_split_view_) {
overview_session_->AddDropTargetForDraggingFromOverview(item_); item_->overview_grid()->AddDropTargetForDraggingFromOverview(item_);
overview_session_->SetSplitViewDragIndicatorsIndicatorState( overview_session_->SetSplitViewDragIndicatorsIndicatorState(
CanSnapInSplitview(item_->GetWindow()) ? IndicatorState::kDragArea CanSnapInSplitview(item_->GetWindow()) ? IndicatorState::kDragArea
: IndicatorState::kCannotSnap, : IndicatorState::kCannotSnap,
...@@ -254,7 +254,7 @@ void OverviewWindowDragController::ResetGesture() { ...@@ -254,7 +254,7 @@ void OverviewWindowDragController::ResetGesture() {
if (current_drag_behavior_ == DragBehavior::kNormalDrag) { if (current_drag_behavior_ == DragBehavior::kNormalDrag) {
Shell::Get()->mouse_cursor_filter()->HideSharedEdgeIndicator(); Shell::Get()->mouse_cursor_filter()->HideSharedEdgeIndicator();
item_->DestroyPhantomsForDragging(); item_->DestroyPhantomsForDragging();
overview_session_->RemoveDropTargetForDraggingFromOverview(item_); item_->overview_grid()->RemoveDropTarget();
overview_session_->SetSplitViewDragIndicatorsIndicatorState( overview_session_->SetSplitViewDragIndicatorsIndicatorState(
IndicatorState::kNone, gfx::Point()); IndicatorState::kNone, gfx::Point());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment