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

Unified Diff: ash/display/screen_position_controller.cc

Issue 10836065: Improve WorkspaceWindowResizer::CompleteDrag() so that the function moves the window to a root windo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final rebase Created 8 years, 4 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 | « ash/display/screen_position_controller.h ('k') | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/screen_position_controller.cc
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc
index 124b6d2eca05ab987df484dfaf1eb962ba3104aa..1deb4e20972d41538e558c7764390b1e35c9fd38 100644
--- a/ash/display/screen_position_controller.cc
+++ b/ash/display/screen_position_controller.cc
@@ -7,7 +7,6 @@
#include "ash/display/display_controller.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
-#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/system_modal_container_layout_manager.h"
#include "ash/wm/window_properties.h"
#include "ui/aura/client/activation_client.h"
@@ -24,8 +23,10 @@ namespace {
// Move all transient children to |dst_root|, including the ones in
// the child windows and transient children of the transient children.
-void MoveAllTransientChildrenToNewRoot(aura::RootWindow* dst_root,
- aura::Window* window) {
+void MoveAllTransientChildrenToNewRoot(const gfx::Display& display,
+ aura::Window* window) {
+ aura::RootWindow* dst_root = Shell::GetInstance()->display_controller()->
+ GetRootWindowForDisplayId(display.id());
aura::Window::Windows transient_children = window->transient_children();
for (aura::Window::Windows::iterator iter = transient_children.begin();
iter != transient_children.end(); ++iter) {
@@ -35,17 +36,16 @@ void MoveAllTransientChildrenToNewRoot(aura::RootWindow* dst_root,
aura::Window* container = Shell::GetContainer(dst_root, container_id);
gfx::Rect parent_bounds_in_screen = transient_child->GetBoundsInScreen();
container->AddChild(transient_child);
- transient_child->SetBoundsInScreen(parent_bounds_in_screen);
+ transient_child->SetBoundsInScreen(parent_bounds_in_screen, display);
// Transient children may have transient children.
- MoveAllTransientChildrenToNewRoot(dst_root,
- transient_child);
+ MoveAllTransientChildrenToNewRoot(display, transient_child);
}
// Move transient children of the child windows if any.
aura::Window::Windows children = window->children();
for (aura::Window::Windows::iterator iter = children.begin();
iter != children.end(); ++iter)
- MoveAllTransientChildrenToNewRoot(dst_root, *iter);
+ MoveAllTransientChildrenToNewRoot(display, *iter);
}
} // namespace
@@ -78,9 +78,10 @@ void ScreenPositionController::ConvertPointFromScreen(
aura::Window::ConvertPointToTarget(root, window, point);
}
-void ScreenPositionController::SetBounds(
- aura::Window* window,
- const gfx::Rect& bounds) {
+void ScreenPositionController::SetBounds(aura::Window* window,
+ const gfx::Rect& bounds,
+ const gfx::Display& display) {
+ DCHECK_NE(-1, display.id());
if (!DisplayController::IsExtendedDesktopEnabled() ||
!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) {
window->SetBounds(bounds);
@@ -90,7 +91,9 @@ void ScreenPositionController::SetBounds(
// Don't move a transient windows to other root window.
// It moves when its transient_parent moves.
if (!window->transient_parent()) {
- aura::RootWindow* dst_root = wm::GetRootWindowMatching(bounds);
+ aura::RootWindow* dst_root =
+ Shell::GetInstance()->display_controller()->GetRootWindowForDisplayId(
+ display.id());
aura::Window* dst_container = NULL;
if (dst_root != window->GetRootWindow()) {
int container_id = window->parent()->id();
@@ -116,7 +119,7 @@ void ScreenPositionController::SetBounds(
dst_container->AddChild(window);
- MoveAllTransientChildrenToNewRoot(dst_root, window);
+ MoveAllTransientChildrenToNewRoot(display, window);
// Restore focused/active window.
if (tracker.Contains(focused))
« no previous file with comments | « ash/display/screen_position_controller.h ('k') | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698