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

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

Issue 38073004: Not moving a docked window when restoring a previously maximized window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Not moving a docked window when restoring a previously maximized window (IsDocked local to TabDragC… Created 7 years, 2 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 8462a63e4b82b80caade1fe7fb4c5cfdb4ed2ea5..3eeea6df7c6088b16844f58c0450f01183ae4d10 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -484,7 +484,7 @@ void TabDragController::Init(
}
// static
-bool TabDragController::IsAttachedTo(TabStrip* tab_strip) {
+bool TabDragController::IsAttachedTo(const TabStrip* tab_strip) {
return (instance_ && instance_->active() &&
instance_->attached_tabstrip() == tab_strip);
}
@@ -1873,6 +1873,11 @@ void TabDragController::CompleteDrag() {
if (attached_tabstrip_) {
if (is_dragging_new_browser_) {
+ if (IsDocked(attached_tabstrip_)) {
+ DCHECK_EQ(host_desktop_type_, chrome::HOST_DESKTOP_TYPE_ASH);
+ was_source_maximized_ = false;
+ was_source_fullscreen_ = false;
+ }
// If source window was maximized - maximize the new window as well.
if (was_source_maximized_)
attached_tabstrip_->GetWidget()->Maximize();
@@ -1884,6 +1889,14 @@ void TabDragController::CompleteDrag() {
ash::Shell::GetInstance()->delegate()->ToggleFullscreen();
}
#endif
+ } else {
+ // When dragging results in maximized or fullscreen browser window getting
+ // docked, restore it.
+ if ((was_source_fullscreen_ || was_source_maximized_) &&
+ (IsDocked(attached_tabstrip_))) {
+ DCHECK_EQ(host_desktop_type_, chrome::HOST_DESKTOP_TYPE_ASH);
+ attached_tabstrip_->GetWidget()->Restore();
+ }
}
attached_tabstrip_->StoppedDraggingTabs(
GetTabsMatchingDraggedContents(attached_tabstrip_),
@@ -2265,3 +2278,13 @@ gfx::Vector2d TabDragController::GetWindowOffset(
views::View::ConvertPointFromScreen(toplevel_view, &point);
return point.OffsetFromOrigin();
}
+
+// static
+bool TabDragController::IsDocked(const TabStrip* tab_strip) {
+#if defined(USE_ASH)
+ DCHECK(tab_strip);
+ return ash::wm::GetWindowState(
+ tab_strip->GetWidget()->GetNativeWindow())->IsDocked();
+#endif
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698