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 const gfx::Point& screen_point_top_right = |
|
mfomitchev
2016/11/18 17:36:24
Nit: Any particular reason you are using const ref
thanhph
2016/11/18 19:15:44
Done.
| |
| 106 wm_root_window_controller_->ConvertPointToScreen( | |
| 107 WmWindowMus::Get(window), window->bounds().top_right()); | |
| 108 | |
| 109 const gfx::Point& screen_point_bottom_left = | |
| 110 wm_root_window_controller_->ConvertPointToScreen( | |
| 111 WmWindowMus::Get(window), window->bounds().bottom_left()); | |
| 112 | |
| 113 const gfx::Rect& screen_bound = | |
|
mfomitchev
2016/11/18 17:36:24
The variable name is a little confusing - sounds l
thanhph
2016/11/18 19:15:44
Done. Thanks!
| |
| 114 gfx::Rect(screen_point_bottom_left.x(), screen_point_top_right.y(), | |
| 115 screen_point_top_right.x() - screen_point_bottom_left.x(), | |
| 116 screen_point_bottom_left.y() - screen_point_top_right.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), screen_bound)); |
| 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 | |
| 118 window_count_++; | 129 window_count_++; |
| 119 | |
| 120 return window; | 130 return window; |
| 121 } | 131 } |
| 122 | 132 |
| 123 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { | 133 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { |
| 124 return WmWindowMus::AsWmWindowMus( | 134 return WmWindowMus::AsWmWindowMus( |
| 125 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); | 135 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); |
| 126 } | 136 } |
| 127 | 137 |
| 128 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { | 138 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { |
| 129 gfx::Rect old_work_area = display_.work_area(); | 139 gfx::Rect old_work_area = display_.work_area(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 void RootWindowController::CreateLayoutManagers() { | 187 void RootWindowController::CreateLayoutManagers() { |
| 178 // Override the default layout managers for certain containers. | 188 // Override the default layout managers for certain containers. |
| 179 WmWindowMus* lock_screen_container = | 189 WmWindowMus* lock_screen_container = |
| 180 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); | 190 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); |
| 181 layout_managers_[lock_screen_container->mus_window()].reset( | 191 layout_managers_[lock_screen_container->mus_window()].reset( |
| 182 new ScreenlockLayout(lock_screen_container->mus_window())); | 192 new ScreenlockLayout(lock_screen_container->mus_window())); |
| 183 } | 193 } |
| 184 | 194 |
| 185 } // namespace mus | 195 } // namespace mus |
| 186 } // namespace ash | 196 } // namespace ash |
| OLD | NEW |