summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvarkha@chromium.org <varkha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-21 04:08:49 +0000
committervarkha@chromium.org <varkha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-21 04:08:49 +0000
commit07315365f8173a5129ce7aa8335421162ee8c4a4 (patch)
tree909cd1ce28d0377631b25089e859a59a2f38adc8
parent41b69ee613ca3094f75422751af45369e05022f3 (diff)
downloadchromium_src-07315365f8173a5129ce7aa8335421162ee8c4a4.zip
chromium_src-07315365f8173a5129ce7aa8335421162ee8c4a4.tar.gz
chromium_src-07315365f8173a5129ce7aa8335421162ee8c4a4.tar.bz2
Maximize a tab dragged from a maximized window
This affects behavior on all platforms not just ash. BUG=171435 TEST=interactive_ui_tests --gtest_filter=*DetachToOwnWindowFromMaximizedWindow* TEST=interactive_ui_tests --gtest_filter=*DragInMaximizedWindow* Review URL: https://chromiumcodereview.appspot.com/23620059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224558 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller.cc21
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller.h10
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc10
3 files changed, 36 insertions, 5 deletions
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index 6b49986..41ba792 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -51,6 +51,7 @@
#if defined(USE_ASH)
#include "ash/shell.h"
+#include "ash/shell_delegate.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/window_state.h"
#include "ui/aura/env.h"
@@ -373,6 +374,9 @@ TabDragController::TabDragController()
move_behavior_(REORDER),
mouse_move_direction_(0),
is_dragging_window_(false),
+ is_dragging_new_browser_(false),
+ was_source_maximized_(false),
+ was_source_fullscreen_(false),
end_run_loop_behavior_(END_RUN_LOOP_STOP_DRAGGING),
waiting_for_run_loop_to_exit_(false),
tab_strip_to_attach_to_after_exit_(NULL),
@@ -424,6 +428,8 @@ void TabDragController::Init(
DCHECK(!tabs.empty());
DCHECK(std::find(tabs.begin(), tabs.end(), source_tab) != tabs.end());
source_tabstrip_ = source_tabstrip;
+ was_source_maximized_ = source_tabstrip->GetWidget()->IsMaximized();
+ was_source_fullscreen_ = source_tabstrip->GetWidget()->IsFullscreen();
screen_ = gfx::Screen::GetScreenFor(
source_tabstrip->GetWidget()->GetNativeView());
host_desktop_type_ = chrome::GetHostDesktopTypeForNativeView(
@@ -812,6 +818,7 @@ void TabDragController::ContinueDragging(const gfx::Point& point_in_screen) {
last_point_in_screen_ = point_in_screen;
if (tab_strip_changed) {
+ is_dragging_new_browser_ = false;
if (detach_into_browser_ &&
DragBrowserToNewTabStrip(target_tabstrip, point_in_screen) ==
DRAG_BROWSER_RESULT_STOP) {
@@ -1831,6 +1838,19 @@ void TabDragController::CompleteDrag() {
initial_tab_positions_,
move_behavior_ == MOVE_VISIBILE_TABS,
true);
+ if (is_dragging_new_browser_) {
+ // If source window was maximized - maximize the new window as well.
+ if (was_source_maximized_)
+ attached_tabstrip_->GetWidget()->Maximize();
+#if defined(USE_ASH)
+ if (was_source_fullscreen_ &&
+ host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) {
+ // In fullscreen mode it is only possible to get here if the source
+ // was in "immersive fullscreen" mode, so toggle it back on.
+ ash::Shell::GetInstance()->delegate()->ToggleFullscreen();
+ }
+#endif
+ }
} else {
if (dock_info_.type() != DockInfo::NONE) {
switch (dock_info_.type()) {
@@ -2151,6 +2171,7 @@ Browser* TabDragController::CreateBrowserForDrag(
host_desktop_type_);
create_params.initial_bounds = new_bounds;
Browser* browser = new Browser(create_params);
+ is_dragging_new_browser_ = true;
SetTrackedByWorkspace(browser->window()->GetNativeWindow(), false);
SetWindowPositionManaged(browser->window()->GetNativeWindow(), false);
// If the window is created maximized then the bounds we supplied are ignored.
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.h b/chrome/browser/ui/views/tabs/tab_drag_controller.h
index eb7defd..4dd86ed 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.h
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.h
@@ -606,6 +606,16 @@ class TabDragController : public content::WebContentsDelegate,
// See description above getter.
bool is_dragging_window_;
+ // True if |attached_tabstrip_| is in a browser specifically created for
+ // the drag.
+ bool is_dragging_new_browser_;
+
+ // True if |source_tabstrip_| was maximized before the drag.
+ bool was_source_maximized_;
+
+ // True if |source_tabstrip_| was in immersive fullscreen before the drag.
+ bool was_source_fullscreen_;
+
EndRunLoopBehavior end_run_loop_behavior_;
// If true, we're waiting for a move loop to complete.
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index 8cda23f..bd7183a 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -678,8 +678,8 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
EXPECT_TRUE(IsWindowPositionManaged(
new_browser->window()->GetNativeWindow()));
- // The new window should not be maximized.
- EXPECT_FALSE(new_browser->window()->IsMaximized());
+ // The new window should be maximized.
+ EXPECT_TRUE(new_browser->window()->IsMaximized());
}
// Deletes a tab being dragged before the user moved enough to start a drag.
@@ -1243,10 +1243,10 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
EXPECT_TRUE(GetTrackedByWorkspace(browser()));
EXPECT_TRUE(GetTrackedByWorkspace(new_browser));
- // The source window should be maximized, but the new window should now
- // be restored.
+ // The source window should be maximized.
EXPECT_TRUE(browser()->window()->IsMaximized());
- EXPECT_FALSE(new_browser->window()->IsMaximized());
+ // The new window should be maximized.
+ EXPECT_TRUE(new_browser->window()->IsMaximized());
}
// Subclass of DetachToBrowserInSeparateDisplayTabDragControllerTest that