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

Unified Diff: ash/root_window_controller.cc

Issue 2703333003: Clamp the restore bounds to new workspace when a display is disconnected. (Closed)
Patch Set: removed unnnecessary checks Created 3 years, 10 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
« no previous file with comments | « no previous file | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/root_window_controller.cc
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index be538ba54484eb94cc4a183971ce60ef03bfda59..dde74bfe0942b6acf274acfe1c779490e324b9ae 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -35,6 +35,7 @@
#include "ash/common/wm/switchable_windows.h"
#include "ash/common/wm/system_modal_container_layout_manager.h"
#include "ash/common/wm/window_state.h"
+#include "ash/common/wm/wm_screen_util.h"
#include "ash/common/wm/workspace/workspace_layout_manager.h"
#include "ash/common/wm/workspace_controller.h"
#include "ash/common/wm_shell.h"
@@ -175,15 +176,20 @@ void ReparentWindow(WmWindow* window, WmWindow* new_parent) {
bool update_bounds =
(state->IsNormalOrSnapped() || state->IsMinimized()) &&
new_parent->GetShellWindowId() != kShellWindowId_DockedContainer;
+ gfx::Rect work_area_in_new_parent =
+ wm::GetDisplayWorkAreaBoundsInParent(new_parent);
+
gfx::Rect local_bounds;
if (update_bounds) {
local_bounds = state->window()->GetBounds();
MoveOriginRelativeToSize(src_size, dst_size, &local_bounds);
+ local_bounds.AdjustToFit(work_area_in_new_parent);
}
if (has_restore_bounds) {
restore_bounds = state->GetRestoreBoundsInParent();
MoveOriginRelativeToSize(src_size, dst_size, &restore_bounds);
+ restore_bounds.AdjustToFit(work_area_in_new_parent);
}
new_parent->AddChild(window);
« no previous file with comments | « no previous file | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698