OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/window_positioner.h" | 5 #include "ash/wm/window_positioner.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 gfx::Rect other_bounds = other_shown_window->bounds(); | 318 gfx::Rect other_bounds = other_shown_window->bounds(); |
319 gfx::Rect work_area = GetWorkAreaForWindowInParent(added_window); | 319 gfx::Rect work_area = GetWorkAreaForWindowInParent(added_window); |
320 bool move_other_right = | 320 bool move_other_right = |
321 other_bounds.CenterPoint().x() > work_area.x() + work_area.width() / 2; | 321 other_bounds.CenterPoint().x() > work_area.x() + work_area.width() / 2; |
322 | 322 |
323 // Push the other window to the size only if there are two windows left. | 323 // Push the other window to the size only if there are two windows left. |
324 if (single_window) { | 324 if (single_window) { |
325 // When going from one to two windows both windows loose their | 325 // When going from one to two windows both windows loose their |
326 // "positioned by user" flags. | 326 // "positioned by user" flags. |
327 added_window_state->set_bounds_changed_by_user(false); | 327 added_window_state->SetBoundsChangedByUser(false); |
328 wm::WindowState* other_window_state = | 328 wm::WindowState* other_window_state = |
329 wm::GetWindowState(other_shown_window); | 329 wm::GetWindowState(other_shown_window); |
330 other_window_state->set_bounds_changed_by_user(false); | 330 other_window_state->SetBoundsChangedByUser(false); |
331 | 331 |
332 if (WindowPositionCanBeManaged(other_shown_window)) { | 332 if (WindowPositionCanBeManaged(other_shown_window)) { |
333 // Don't override pre auto managed bounds as the current bounds | 333 // Don't override pre auto managed bounds as the current bounds |
334 // may not be original. | 334 // may not be original. |
335 if (!other_window_state->pre_auto_manage_window_bounds()) | 335 if (!other_window_state->pre_auto_manage_window_bounds()) |
336 other_window_state->SetPreAutoManageWindowBounds(other_bounds); | 336 other_window_state->SetPreAutoManageWindowBounds(other_bounds); |
337 | 337 |
338 // Push away the other window after remembering its current position. | 338 // Push away the other window after remembering its current position. |
339 if (MoveRectToOneSide(work_area, move_other_right, &other_bounds)) | 339 if (MoveRectToOneSide(work_area, move_other_right, &other_bounds)) |
340 SetBoundsAnimated(other_shown_window, other_bounds); | 340 SetBoundsAnimated(other_shown_window, other_bounds); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // If the alignment was pushing the window out of the screen, we ignore the | 531 // If the alignment was pushing the window out of the screen, we ignore the |
532 // alignment for that call. | 532 // alignment for that call. |
533 if (abs(pos.right() - work_area.right()) < grid) | 533 if (abs(pos.right() - work_area.right()) < grid) |
534 x = work_area.right() - w; | 534 x = work_area.right() - w; |
535 if (abs(pos.bottom() - work_area.bottom()) < grid) | 535 if (abs(pos.bottom() - work_area.bottom()) < grid) |
536 y = work_area.bottom() - h; | 536 y = work_area.bottom() - h; |
537 return gfx::Rect(x, y, w, h); | 537 return gfx::Rect(x, y, w, h); |
538 } | 538 } |
539 | 539 |
540 } // namespace ash | 540 } // namespace ash |
OLD | NEW |