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

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 moved to namespac… 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..fc67b7fdceb21e56703cd959bf333ad4cad3ef9b 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -209,6 +209,16 @@ void SetWindowPositionManaged(gfx::NativeWindow window, bool value) {
#endif
}
+// Returns true if |tab_strip| browser window is docked.
+bool IsDocked(const TabStrip* tab_strip) {
+#if defined(USE_ASH)
+ DCHECK(tab_strip);
+ return ash::wm::GetWindowState(
+ tab_strip->GetWidget()->GetNativeWindow())->IsDocked();
+#endif
+ return false;
+}
+
// Returns true if |bounds| contains the y-coordinate |y|. The y-coordinate
// of |bounds| is adjusted by |vertical_adjustment|.
bool DoesRectContainVerticalPointExpanded(
@@ -484,7 +494,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 +1883,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 +1899,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_),

Powered by Google App Engine
This is Rietveld 408576698