OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace/auto_window_management.h" | 5 #include "ash/wm/workspace/auto_window_management.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/property_util.h" | 9 #include "ash/wm/property_util.h" |
10 #include "ash/wm/window_animations.h" | 10 #include "ash/wm/window_animations.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Bail if we find a second usable window. | 62 // Bail if we find a second usable window. |
63 if (*other_window) | 63 if (*other_window) |
64 return false; | 64 return false; |
65 *other_window = iterated_window; | 65 *other_window = iterated_window; |
66 } | 66 } |
67 } | 67 } |
68 return *other_window != NULL; | 68 return *other_window != NULL; |
69 } | 69 } |
70 | 70 |
71 // Get the work area for a given |window|. | 71 // Get the work area for a given |window|. |
72 gfx::Rect GetWorkAreaForWindow(const aura::Window* window) { | 72 gfx::Rect GetWorkAreaForWindow(aura::Window* window) { |
| 73 #if defined(OS_WIN) |
| 74 // On Win 8, the host window can't be resized, so |
| 75 // use window's bounds instead. |
| 76 // TODO(oshima): Emulate host window resize on win8. |
73 gfx::Rect work_area = gfx::Rect(window->parent()->bounds().size()); | 77 gfx::Rect work_area = gfx::Rect(window->parent()->bounds().size()); |
74 work_area.Inset(Shell::GetScreen()->GetDisplayMatching( | 78 work_area.Inset(Shell::GetScreen()->GetDisplayMatching( |
75 work_area).GetWorkAreaInsets()); | 79 work_area).GetWorkAreaInsets()); |
76 return work_area; | 80 return work_area; |
| 81 #else |
| 82 return Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
| 83 #endif |
77 } | 84 } |
78 | 85 |
79 // Move the given |bounds| on the available |parent_width| to the | 86 // Move the given |bounds| on the available |parent_width| to the |
80 // direction. If |move_right| is true, the rectangle gets moved to the right | 87 // direction. If |move_right| is true, the rectangle gets moved to the right |
81 // corner, otherwise to the left one. | 88 // corner, otherwise to the left one. |
82 bool MoveRectToOneSide(int parent_width, bool move_right, gfx::Rect* bounds) { | 89 bool MoveRectToOneSide(int parent_width, bool move_right, gfx::Rect* bounds) { |
83 if (move_right) { | 90 if (move_right) { |
84 if (parent_width > bounds->right()) { | 91 if (parent_width > bounds->right()) { |
85 bounds->set_x(parent_width - bounds->width()); | 92 bounds->set_x(parent_width - bounds->width()); |
86 return true; | 93 return true; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Since it is just coming into view, we do not need to animate it. | 192 // Since it is just coming into view, we do not need to animate it. |
186 gfx::Rect added_bounds = added_window->bounds(); | 193 gfx::Rect added_bounds = added_window->bounds(); |
187 ash::wm::SetPreAutoManageWindowBounds(added_window, added_bounds); | 194 ash::wm::SetPreAutoManageWindowBounds(added_window, added_bounds); |
188 if (MoveRectToOneSide(work_area.width(), !move_right, &added_bounds)) | 195 if (MoveRectToOneSide(work_area.width(), !move_right, &added_bounds)) |
189 added_window->SetBounds(added_bounds); | 196 added_window->SetBounds(added_bounds); |
190 } | 197 } |
191 } | 198 } |
192 | 199 |
193 } // namespace internal | 200 } // namespace internal |
194 } // namespace ash | 201 } // namespace ash |
OLD | NEW |