Commit 60c5f33a authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

desks: Disable removing a virtual desk while dragging a window

Test: manual
Change-Id: Id3142bbe89caa2aa002f0b41f846bb885f6b56a2
Fixed: 1048315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037715Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738368}
parent 722abec9
......@@ -68,6 +68,7 @@
#include "ash/wm/desks/desks_controller.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_session.h"
#include "ash/wm/screen_pinning_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_window_manager.h"
......@@ -150,6 +151,20 @@ enum class RotationAcceleratorAction {
kMaxValue = kAlreadyAcceptedDialog,
};
bool IsAnyWindowDragged() {
OverviewController* overview_controller = Shell::Get()->overview_controller();
if (overview_controller->InOverviewSession() &&
overview_controller->overview_session()->IsAnyOverviewItemDragged()) {
return true;
}
for (aura::Window* window :
Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk)) {
if (WindowState::Get(window)->is_dragged())
return true;
}
return false;
}
void RecordRotationAcceleratorAction(const RotationAcceleratorAction& action) {
UMA_HISTOGRAM_ENUMERATION("Ash.Accelerators.Rotation.Usage", action);
}
......@@ -368,6 +383,9 @@ void HandleNewDesk() {
}
void HandleRemoveCurrentDesk() {
if (IsAnyWindowDragged())
return;
auto* desks_controller = DesksController::Get();
if (!desks_controller->CanRemoveDesks()) {
ShowToast(kVirtualDesksToastId,
......
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