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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 gfx::Rect other_bounds = other_shown_window->bounds(); | 321 gfx::Rect other_bounds = other_shown_window->bounds(); |
322 gfx::Rect work_area = GetWorkAreaForWindowInParent(added_window); | 322 gfx::Rect work_area = GetWorkAreaForWindowInParent(added_window); |
323 bool move_other_right = | 323 bool move_other_right = |
324 other_bounds.CenterPoint().x() > work_area.x() + work_area.width() / 2; | 324 other_bounds.CenterPoint().x() > work_area.x() + work_area.width() / 2; |
325 | 325 |
326 // Push the other window to the size only if there are two windows left. | 326 // Push the other window to the size only if there are two windows left. |
327 if (single_window) { | 327 if (single_window) { |
328 // When going from one to two windows both windows loose their | 328 // When going from one to two windows both windows loose their |
329 // "positioned by user" flags. | 329 // "positioned by user" flags. |
330 added_window_state->set_bounds_changed_by_user(false); | 330 added_window_state->SetBoundsChangedByUser(false); |
331 wm::WindowState* other_window_state = | 331 wm::WindowState* other_window_state = |
332 wm::GetWindowState(other_shown_window); | 332 wm::GetWindowState(other_shown_window); |
333 other_window_state->set_bounds_changed_by_user(false); | 333 other_window_state->SetBoundsChangedByUser(false); |
334 | 334 |
335 if (WindowPositionCanBeManaged(other_shown_window)) { | 335 if (WindowPositionCanBeManaged(other_shown_window)) { |
336 // Don't override pre auto managed bounds as the current bounds | 336 // Don't override pre auto managed bounds as the current bounds |
337 // may not be original. | 337 // may not be original. |
338 if (!other_window_state->pre_auto_manage_window_bounds()) | 338 if (!other_window_state->pre_auto_manage_window_bounds()) |
339 other_window_state->SetPreAutoManageWindowBounds(other_bounds); | 339 other_window_state->SetPreAutoManageWindowBounds(other_bounds); |
340 | 340 |
341 // Push away the other window after remembering its current position. | 341 // Push away the other window after remembering its current position. |
342 if (MoveRectToOneSide(work_area, move_other_right, &other_bounds)) | 342 if (MoveRectToOneSide(work_area, move_other_right, &other_bounds)) |
343 SetBoundsAnimated(other_shown_window, other_bounds); | 343 SetBoundsAnimated(other_shown_window, other_bounds); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 // If the alignment was pushing the window out of the screen, we ignore the | 539 // If the alignment was pushing the window out of the screen, we ignore the |
540 // alignment for that call. | 540 // alignment for that call. |
541 if (abs(pos.right() - work_area.right()) < grid) | 541 if (abs(pos.right() - work_area.right()) < grid) |
542 x = work_area.right() - w; | 542 x = work_area.right() - w; |
543 if (abs(pos.bottom() - work_area.bottom()) < grid) | 543 if (abs(pos.bottom() - work_area.bottom()) < grid) |
544 y = work_area.bottom() - h; | 544 y = work_area.bottom() - h; |
545 return gfx::Rect(x, y, w, h); | 545 return gfx::Rect(x, y, w, h); |
546 } | 546 } |
547 | 547 |
548 } // namespace ash | 548 } // namespace ash |
OLD | NEW |