| 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "ash/common/wm/always_on_top_controller.h" | 28 #include "ash/common/wm/always_on_top_controller.h" |
| 29 #include "ash/common/wm/container_finder.h" | 29 #include "ash/common/wm/container_finder.h" |
| 30 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 30 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 31 #include "ash/common/wm/fullscreen_window_finder.h" | 31 #include "ash/common/wm/fullscreen_window_finder.h" |
| 32 #include "ash/common/wm/lock_layout_manager.h" | 32 #include "ash/common/wm/lock_layout_manager.h" |
| 33 #include "ash/common/wm/panels/panel_layout_manager.h" | 33 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 34 #include "ash/common/wm/root_window_layout_manager.h" | 34 #include "ash/common/wm/root_window_layout_manager.h" |
| 35 #include "ash/common/wm/switchable_windows.h" | 35 #include "ash/common/wm/switchable_windows.h" |
| 36 #include "ash/common/wm/system_modal_container_layout_manager.h" | 36 #include "ash/common/wm/system_modal_container_layout_manager.h" |
| 37 #include "ash/common/wm/window_state.h" | 37 #include "ash/common/wm/window_state.h" |
| 38 #include "ash/common/wm/wm_screen_util.h" |
| 38 #include "ash/common/wm/workspace/workspace_layout_manager.h" | 39 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
| 39 #include "ash/common/wm/workspace_controller.h" | 40 #include "ash/common/wm/workspace_controller.h" |
| 40 #include "ash/common/wm_shell.h" | 41 #include "ash/common/wm_shell.h" |
| 41 #include "ash/common/wm_window.h" | 42 #include "ash/common/wm_window.h" |
| 42 #include "ash/high_contrast/high_contrast_controller.h" | 43 #include "ash/high_contrast/high_contrast_controller.h" |
| 43 #include "ash/host/ash_window_tree_host.h" | 44 #include "ash/host/ash_window_tree_host.h" |
| 44 #include "ash/public/cpp/shelf_types.h" | 45 #include "ash/public/cpp/shelf_types.h" |
| 45 #include "ash/public/cpp/shell_window_ids.h" | 46 #include "ash/public/cpp/shell_window_ids.h" |
| 46 #include "ash/root_window_settings.h" | 47 #include "ash/root_window_settings.h" |
| 47 #include "ash/shelf/shelf_window_targeter.h" | 48 #include "ash/shelf/shelf_window_targeter.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 const gfx::Size src_size = window->GetParent()->GetBounds().size(); | 169 const gfx::Size src_size = window->GetParent()->GetBounds().size(); |
| 169 const gfx::Size dst_size = new_parent->GetBounds().size(); | 170 const gfx::Size dst_size = new_parent->GetBounds().size(); |
| 170 // Update the restore bounds to make it relative to the display. | 171 // Update the restore bounds to make it relative to the display. |
| 171 wm::WindowState* state = window->GetWindowState(); | 172 wm::WindowState* state = window->GetWindowState(); |
| 172 gfx::Rect restore_bounds; | 173 gfx::Rect restore_bounds; |
| 173 bool has_restore_bounds = state->HasRestoreBounds(); | 174 bool has_restore_bounds = state->HasRestoreBounds(); |
| 174 | 175 |
| 175 bool update_bounds = | 176 bool update_bounds = |
| 176 (state->IsNormalOrSnapped() || state->IsMinimized()) && | 177 (state->IsNormalOrSnapped() || state->IsMinimized()) && |
| 177 new_parent->GetShellWindowId() != kShellWindowId_DockedContainer; | 178 new_parent->GetShellWindowId() != kShellWindowId_DockedContainer; |
| 179 gfx::Rect work_area_in_new_parent = |
| 180 wm::GetDisplayWorkAreaBoundsInParent(new_parent); |
| 181 |
| 178 gfx::Rect local_bounds; | 182 gfx::Rect local_bounds; |
| 179 if (update_bounds) { | 183 if (update_bounds) { |
| 180 local_bounds = state->window()->GetBounds(); | 184 local_bounds = state->window()->GetBounds(); |
| 181 MoveOriginRelativeToSize(src_size, dst_size, &local_bounds); | 185 MoveOriginRelativeToSize(src_size, dst_size, &local_bounds); |
| 186 local_bounds.AdjustToFit(work_area_in_new_parent); |
| 182 } | 187 } |
| 183 | 188 |
| 184 if (has_restore_bounds) { | 189 if (has_restore_bounds) { |
| 185 restore_bounds = state->GetRestoreBoundsInParent(); | 190 restore_bounds = state->GetRestoreBoundsInParent(); |
| 186 MoveOriginRelativeToSize(src_size, dst_size, &restore_bounds); | 191 MoveOriginRelativeToSize(src_size, dst_size, &restore_bounds); |
| 192 restore_bounds.AdjustToFit(work_area_in_new_parent); |
| 187 } | 193 } |
| 188 | 194 |
| 189 new_parent->AddChild(window); | 195 new_parent->AddChild(window); |
| 190 | 196 |
| 191 // Docked windows have bounds handled by the layout manager in AddChild(). | 197 // Docked windows have bounds handled by the layout manager in AddChild(). |
| 192 if (update_bounds) | 198 if (update_bounds) |
| 193 window->SetBounds(local_bounds); | 199 window->SetBounds(local_bounds); |
| 194 | 200 |
| 195 if (has_restore_bounds) | 201 if (has_restore_bounds) |
| 196 state->SetRestoreBoundsInParent(restore_bounds); | 202 state->SetRestoreBoundsInParent(restore_bounds); |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 EnableTouchHudProjection(); | 1154 EnableTouchHudProjection(); |
| 1149 else | 1155 else |
| 1150 DisableTouchHudProjection(); | 1156 DisableTouchHudProjection(); |
| 1151 } | 1157 } |
| 1152 | 1158 |
| 1153 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1159 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
| 1154 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1160 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
| 1155 } | 1161 } |
| 1156 | 1162 |
| 1157 } // namespace ash | 1163 } // namespace ash |
| OLD | NEW |