| 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 <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "ash/wm/panels/panel_layout_manager.h" | 33 #include "ash/wm/panels/panel_layout_manager.h" |
| 34 #include "ash/wm/panels/panel_window_event_handler.h" | 34 #include "ash/wm/panels/panel_window_event_handler.h" |
| 35 #include "ash/wm/root_window_layout_manager.h" | 35 #include "ash/wm/root_window_layout_manager.h" |
| 36 #include "ash/wm/screen_dimmer.h" | 36 #include "ash/wm/screen_dimmer.h" |
| 37 #include "ash/wm/stacking_controller.h" | 37 #include "ash/wm/stacking_controller.h" |
| 38 #include "ash/wm/status_area_layout_manager.h" | 38 #include "ash/wm/status_area_layout_manager.h" |
| 39 #include "ash/wm/system_background_controller.h" | 39 #include "ash/wm/system_background_controller.h" |
| 40 #include "ash/wm/system_modal_container_layout_manager.h" | 40 #include "ash/wm/system_modal_container_layout_manager.h" |
| 41 #include "ash/wm/toplevel_window_event_handler.h" | 41 #include "ash/wm/toplevel_window_event_handler.h" |
| 42 #include "ash/wm/window_properties.h" | 42 #include "ash/wm/window_properties.h" |
| 43 #include "ash/wm/window_state.h" |
| 43 #include "ash/wm/window_util.h" | 44 #include "ash/wm/window_util.h" |
| 44 #include "ash/wm/workspace_controller.h" | 45 #include "ash/wm/workspace_controller.h" |
| 45 #include "base/command_line.h" | 46 #include "base/command_line.h" |
| 46 #include "base/time/time.h" | 47 #include "base/time/time.h" |
| 47 #include "ui/aura/client/aura_constants.h" | 48 #include "ui/aura/client/aura_constants.h" |
| 48 #include "ui/aura/client/drag_drop_client.h" | 49 #include "ui/aura/client/drag_drop_client.h" |
| 49 #include "ui/aura/client/tooltip_client.h" | 50 #include "ui/aura/client/tooltip_client.h" |
| 50 #include "ui/aura/root_window.h" | 51 #include "ui/aura/root_window.h" |
| 51 #include "ui/aura/window.h" | 52 #include "ui/aura/window.h" |
| 52 #include "ui/aura/window_delegate.h" | 53 #include "ui/aura/window_delegate.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 container->Init(ui::LAYER_NOT_DRAWN); | 90 container->Init(ui::LAYER_NOT_DRAWN); |
| 90 parent->AddChild(container); | 91 parent->AddChild(container); |
| 91 if (window_id != internal::kShellWindowId_UnparentedControlContainer) | 92 if (window_id != internal::kShellWindowId_UnparentedControlContainer) |
| 92 container->Show(); | 93 container->Show(); |
| 93 return container; | 94 return container; |
| 94 } | 95 } |
| 95 | 96 |
| 96 // Reparents |window| to |new_parent|. | 97 // Reparents |window| to |new_parent|. |
| 97 void ReparentWindow(aura::Window* window, aura::Window* new_parent) { | 98 void ReparentWindow(aura::Window* window, aura::Window* new_parent) { |
| 98 // Update the restore bounds to make it relative to the display. | 99 // Update the restore bounds to make it relative to the display. |
| 99 gfx::Rect restore_bounds(GetRestoreBoundsInParent(window)); | 100 wm::WindowState* state = wm::GetWindowState(window); |
| 101 gfx::Rect restore_bounds; |
| 102 bool has_restore_bounds = state->HasRestoreBounds(); |
| 103 if (has_restore_bounds) |
| 104 restore_bounds = state->GetRestoreBoundsInParent(); |
| 100 new_parent->AddChild(window); | 105 new_parent->AddChild(window); |
| 101 if (!restore_bounds.IsEmpty()) | 106 if (has_restore_bounds) |
| 102 SetRestoreBoundsInParent(window, restore_bounds); | 107 state->SetRestoreBoundsInParent(restore_bounds); |
| 103 } | 108 } |
| 104 | 109 |
| 105 // Reparents the appropriate set of windows from |src| to |dst|. | 110 // Reparents the appropriate set of windows from |src| to |dst|. |
| 106 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { | 111 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { |
| 107 // Set of windows to move. | 112 // Set of windows to move. |
| 108 const int kContainerIdsToMove[] = { | 113 const int kContainerIdsToMove[] = { |
| 109 internal::kShellWindowId_DefaultContainer, | 114 internal::kShellWindowId_DefaultContainer, |
| 110 internal::kShellWindowId_DockedContainer, | 115 internal::kShellWindowId_DockedContainer, |
| 111 internal::kShellWindowId_PanelContainer, | 116 internal::kShellWindowId_PanelContainer, |
| 112 internal::kShellWindowId_AlwaysOnTopContainer, | 117 internal::kShellWindowId_AlwaysOnTopContainer, |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 506 |
| 502 void RootWindowController::UpdateShelfVisibility() { | 507 void RootWindowController::UpdateShelfVisibility() { |
| 503 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | 508 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
| 504 } | 509 } |
| 505 | 510 |
| 506 const aura::Window* RootWindowController::GetTopmostFullscreenWindow() const { | 511 const aura::Window* RootWindowController::GetTopmostFullscreenWindow() const { |
| 507 const aura::Window::Windows& windows = | 512 const aura::Window::Windows& windows = |
| 508 GetContainer(kShellWindowId_DefaultContainer)->children(); | 513 GetContainer(kShellWindowId_DefaultContainer)->children(); |
| 509 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); | 514 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); |
| 510 iter != windows.rend(); ++iter) { | 515 iter != windows.rend(); ++iter) { |
| 511 if (wm::IsWindowFullscreen(*iter)) | 516 if (wm::GetWindowState(*iter)->IsFullscreen()) |
| 512 return *iter; | 517 return *iter; |
| 513 } | 518 } |
| 514 return NULL; | 519 return NULL; |
| 515 } | 520 } |
| 516 | 521 |
| 517 void RootWindowController::InitKeyboard() { | 522 void RootWindowController::InitKeyboard() { |
| 518 if (keyboard::IsKeyboardEnabled()) { | 523 if (keyboard::IsKeyboardEnabled()) { |
| 519 aura::Window* parent = root_window(); | 524 aura::Window* parent = root_window(); |
| 520 | 525 |
| 521 keyboard::KeyboardControllerProxy* proxy = | 526 keyboard::KeyboardControllerProxy* proxy = |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 DisableTouchHudProjection(); | 822 DisableTouchHudProjection(); |
| 818 } | 823 } |
| 819 | 824 |
| 820 RootWindowController* GetRootWindowController( | 825 RootWindowController* GetRootWindowController( |
| 821 const aura::RootWindow* root_window) { | 826 const aura::RootWindow* root_window) { |
| 822 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 827 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
| 823 } | 828 } |
| 824 | 829 |
| 825 } // namespace internal | 830 } // namespace internal |
| 826 } // namespace ash | 831 } // namespace ash |
| OLD | NEW |