Commit 899b84ea authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Revert "Mac: Disallow dragging tab into blocked tabstrip"

This reverts commit 002dfaef.

Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=903706#c1

Original change's description:
> Mac: Disallow dragging tab into blocked tabstrip
> 
> This is a really longwinded way for me to fix some NOTIMPLEMENTED spam,
> though I'm pretty sure the thing that happens right now when you open
> a certificate prompt and drag a tab into the parent window is bad.
> 
> This introduces a new method because we're not sure if it matches the
> Aura semantics, and this is better than the nothing we were doing previously.
> 
> Bug: 825834
> Change-Id: I316ca4fbaa7a27dacb09bce0866203b79567016d
> Reviewed-on: https://chromium-review.googlesource.com/c/1315956
> Commit-Queue: Leonard Grey <lgrey@chromium.org>
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#606619}

TBR=ellyjones@chromium.org,lgrey@chromium.org

Change-Id: If2a6470657f160a0e7fa2fd9978078ab46ae048a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 825834
Reviewed-on: https://chromium-review.googlesource.com/c/1329341Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606828}
parent 4a996f29
......@@ -181,6 +181,17 @@ bool CanDetachFromTabStrip(TabStrip* tabstrip) {
#endif // #if defined(OS_CHROMEOS)
#if defined(USE_AURA)
gfx::NativeWindow GetModalTransient(gfx::NativeWindow window) {
return wm::GetModalTransient(window);
}
#else
gfx::NativeWindow GetModalTransient(gfx::NativeWindow window) {
NOTIMPLEMENTED();
return NULL;
}
#endif
// Returns true if |bounds| contains the y-coordinate |y|. The y-coordinate
// of |bounds| is adjusted by |vertical_adjustment|.
bool DoesRectContainVerticalPointExpanded(
......@@ -1017,19 +1028,18 @@ TabDragController::Liveness TabDragController::GetTargetTabStripForPoint(
// Do not allow dragging into a window with a modal dialog, it causes a weird
// behavior. See crbug.com/336691
if (local_window && !ShouldDisallowDrag(local_window)) {
TabStrip* destination_tab_strip = GetTabStripForWindow(local_window);
if (ShouldAttachOnEnd(destination_tab_strip)) {
if (!GetModalTransient(local_window)) {
TabStrip* result = GetTabStripForWindow(local_window);
if (ShouldAttachOnEnd(result)) {
// No need to check if the specified screen point is within the bounds of
// the tabstrip as arriving here we know that the window is currently
// showing in overview mode in Chrome OS and its bounds contain the
// specified screen point, and these two conditions are enough for a
// window to be a valid target window to attach the dragged tabs.
*tab_strip = destination_tab_strip;
*tab_strip = result;
return Liveness::ALIVE;
} else if (destination_tab_strip &&
DoesTabStripContain(destination_tab_strip, point_in_screen)) {
*tab_strip = destination_tab_strip;
} else if (result && DoesTabStripContain(result, point_in_screen)) {
*tab_strip = result;
return Liveness::ALIVE;
}
}
......@@ -1994,17 +2004,6 @@ void TabDragController::ClearTabDraggingInfo() {
#endif
}
bool TabDragController::ShouldDisallowDrag(gfx::NativeWindow window) {
#if defined(USE_AURA)
return wm::GetModalTransient(window) != nullptr;
#else
TabStrip* tab_strip = GetTabStripForWindow(window);
TabStripModel* model = GetModel(tab_strip);
DCHECK(model);
return model->IsTabBlocked(model->active_index());
#endif
}
void TabDragController::SetDeferredTargetTabstrip(
TabStrip* deferred_target_tabstrip) {
#if defined(OS_CHROMEOS)
......
......@@ -470,10 +470,6 @@ class TabDragController : public views::WidgetObserver,
// property.
void SetDeferredTargetTabstrip(TabStrip* deferred_target_tabstrip);
// Whether a drag to |window| should be blocked (for example, if the window
// is showing a modal).
bool ShouldDisallowDrag(gfx::NativeWindow window);
EventSource event_source_;
// The TabStrip the drag originated from. This is set to null if destroyed
......
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