Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4119)

Unified Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 2640433004: ChromeOS MD: Fix cannot drag tab onto immersive fullscreen window (Closed)
Patch Set: modify test coverage, but it is a disabled test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tabs/tab_drag_controller.cc
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index 1997b873a2349ff601ee1869a531a63314eee050..0eff41ef5f725a517a302a4ebb93fb50dd086889 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -823,7 +823,7 @@ TabDragController::Liveness TabDragController::GetTargetTabStripForPoint(
// behavior. See crbug.com/336691
if (!GetModalTransient(local_window)) {
TabStrip* result = GetTabStripForWindow(local_window);
- if (result && DoesTabStripContain(result, point_in_screen)) {
+ if (result && DoesTabStripContain(result, point_in_screen, local_window)) {
*tab_strip = result;
return Liveness::ALIVE;
}
@@ -853,17 +853,40 @@ TabStrip* TabDragController::GetTabStripForWindow(gfx::NativeWindow window) {
other_tabstrip : NULL;
}
-bool TabDragController::DoesTabStripContain(
- TabStrip* tabstrip,
- const gfx::Point& point_in_screen) const {
+bool TabDragController::DoesTabStripContain(TabStrip* tabstrip,
+ const gfx::Point& point_in_screen,
+ gfx::NativeWindow window) const {
// Make sure the specified screen point is actually within the bounds of the
- // specified tabstrip...
+ // specified tabstrip.
gfx::Rect tabstrip_bounds = GetViewScreenBounds(tabstrip);
- return point_in_screen.x() < tabstrip_bounds.right() &&
+#if defined(OS_CHROMEOS)
sky 2017/01/17 18:07:01 Why does this need to be chromeos specific? Immers
Qiang(Joe) Xu 2017/01/18 01:13:52 done
+ DCHECK(window);
+ BrowserView* browser_view =
+ BrowserView::GetBrowserViewForNativeWindow(window);
+ DCHECK(browser_view);
+ bool hidden_top_views =
+ browser_view->immersive_mode_controller()->ShouldHideTopViews();
+ // When |window| is immersive non-revealed mode, get |tabstrip_bounds| from
+ // non-client view coordinates where tabstrip should be laid when revealed.
+ if (hidden_top_views) {
+ tabstrip_bounds = browser_view->frame()->GetBoundsForTabStrip(tabstrip);
+ aura::Window::ConvertRectToTarget(window, window->GetRootWindow(),
+ &tabstrip_bounds);
+ }
+#endif
+
+ bool res =
+ point_in_screen.x() < tabstrip_bounds.right() &&
point_in_screen.x() >= tabstrip_bounds.x() &&
- DoesRectContainVerticalPointExpanded(tabstrip_bounds,
- kVerticalDetachMagnetism,
- point_in_screen.y());
+ DoesRectContainVerticalPointExpanded(
+ tabstrip_bounds, kVerticalDetachMagnetism, point_in_screen.y());
+#if defined(OS_CHROMEOS)
+ if (res && hidden_top_views) {
+ tabstrip->SetVisible(true);
sky 2017/01/17 18:07:01 This function is meant to check whether the tabstr
Qiang(Joe) Xu 2017/01/18 01:13:52 done by moving to DragBrowserToNewTabStrip
+ tabstrip->SetBoundsRect(tabstrip_bounds);
+ }
+#endif
+ return res;
}
void TabDragController::Attach(TabStrip* attached_tabstrip,

Powered by Google App Engine
This is Rietveld 408576698