| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mus/root_window_controller.h" | 5 #include "ash/mus/root_window_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // TODO(sky): constrain and validate properties before passing to server. | 96 // TODO(sky): constrain and validate properties before passing to server. |
| 97 ui::Window* window = root_->window_tree()->NewWindow(properties); | 97 ui::Window* window = root_->window_tree()->NewWindow(properties); |
| 98 window->SetBounds(CalculateDefaultBounds(window)); | 98 window->SetBounds(CalculateDefaultBounds(window)); |
| 99 | 99 |
| 100 ui::Window* container_window = nullptr; | 100 ui::Window* container_window = nullptr; |
| 101 int container_id = kShellWindowId_Invalid; | 101 int container_id = kShellWindowId_Invalid; |
| 102 if (GetRequestedContainer(window, &container_id)) { | 102 if (GetRequestedContainer(window, &container_id)) { |
| 103 container_window = GetWindowByShellWindowId(container_id)->mus_window(); | 103 container_window = GetWindowByShellWindowId(container_id)->mus_window(); |
| 104 } else { | 104 } else { |
| 105 // TODO(sky): window->bounds() isn't quite right. | 105 const gfx::Point top_right_in_screen = |
| 106 wm_root_window_controller_->ConvertPointToScreen( |
| 107 WmWindowMus::Get(window), window->bounds().top_right()); |
| 108 |
| 109 const gfx::Point bottom_left_in_screen = |
| 110 wm_root_window_controller_->ConvertPointToScreen( |
| 111 WmWindowMus::Get(window), window->bounds().bottom_left()); |
| 112 |
| 113 const gfx::Rect bounds_in_screen = |
| 114 gfx::Rect(bottom_left_in_screen.x(), top_right_in_screen.y(), |
| 115 top_right_in_screen.x() - bottom_left_in_screen.x(), |
| 116 bottom_left_in_screen.y() - top_right_in_screen.y()); |
| 117 |
| 106 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( | 118 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( |
| 107 WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds())); | 119 WmWindowMus::Get(root_), WmWindowMus::Get(window), bounds_in_screen)); |
| 108 } | 120 } |
| 109 DCHECK(WmWindowMus::Get(container_window)->IsContainer()); | 121 DCHECK(WmWindowMus::Get(container_window)->IsContainer()); |
| 110 | 122 |
| 111 if (provide_non_client_frame) { | 123 if (provide_non_client_frame) { |
| 112 NonClientFrameController::Create(container_window, window, | 124 NonClientFrameController::Create(container_window, window, |
| 113 window_manager_->window_manager_client()); | 125 window_manager_->window_manager_client()); |
| 114 } else { | 126 } else { |
| 115 container_window->AddChild(window); | 127 container_window->AddChild(window); |
| 116 } | 128 } |
| 117 | 129 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void RootWindowController::CreateLayoutManagers() { | 189 void RootWindowController::CreateLayoutManagers() { |
| 178 // Override the default layout managers for certain containers. | 190 // Override the default layout managers for certain containers. |
| 179 WmWindowMus* lock_screen_container = | 191 WmWindowMus* lock_screen_container = |
| 180 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); | 192 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); |
| 181 layout_managers_[lock_screen_container->mus_window()].reset( | 193 layout_managers_[lock_screen_container->mus_window()].reset( |
| 182 new ScreenlockLayout(lock_screen_container->mus_window())); | 194 new ScreenlockLayout(lock_screen_container->mus_window())); |
| 183 } | 195 } |
| 184 | 196 |
| 185 } // namespace mus | 197 } // namespace mus |
| 186 } // namespace ash | 198 } // namespace ash |
| OLD | NEW |