Chromium Code Reviews| 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 gfx::Point origin = wm_root_window_controller_->ConvertPointToScreen( |
| 106 WmWindowMus::Get(root_), gfx::Point()); | |
| 107 gfx::Rect bounds_in_screen(origin, window->bounds().size()); | |
|
mfomitchev
2016/11/23 23:02:12
What if one of the window's parents is transformed
| |
| 106 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( | 108 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( |
| 107 WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds())); | 109 WmWindowMus::Get(root_), WmWindowMus::Get(window), bounds_in_screen)); |
| 108 } | 110 } |
| 109 DCHECK(WmWindowMus::Get(container_window)->IsContainer()); | 111 DCHECK(WmWindowMus::Get(container_window)->IsContainer()); |
| 110 | 112 |
| 111 if (provide_non_client_frame) { | 113 if (provide_non_client_frame) { |
| 112 NonClientFrameController::Create(container_window, window, | 114 NonClientFrameController::Create(container_window, window, |
| 113 window_manager_->window_manager_client()); | 115 window_manager_->window_manager_client()); |
| 114 } else { | 116 } else { |
| 115 container_window->AddChild(window); | 117 container_window->AddChild(window); |
| 116 } | 118 } |
| 117 | 119 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 void RootWindowController::CreateLayoutManagers() { | 179 void RootWindowController::CreateLayoutManagers() { |
| 178 // Override the default layout managers for certain containers. | 180 // Override the default layout managers for certain containers. |
| 179 WmWindowMus* lock_screen_container = | 181 WmWindowMus* lock_screen_container = |
| 180 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); | 182 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); |
| 181 layout_managers_[lock_screen_container->mus_window()].reset( | 183 layout_managers_[lock_screen_container->mus_window()].reset( |
| 182 new ScreenlockLayout(lock_screen_container->mus_window())); | 184 new ScreenlockLayout(lock_screen_container->mus_window())); |
| 183 } | 185 } |
| 184 | 186 |
| 185 } // namespace mus | 187 } // namespace mus |
| 186 } // namespace ash | 188 } // namespace ash |
| OLD | NEW |