| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mash/wm/window_manager.h" | 5 #include "mash/wm/window_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ash/wm/common/container_finder.h" | 11 #include "ash/wm/common/container_finder.h" |
| 12 #include "components/mus/common/types.h" | 12 #include "components/mus/common/types.h" |
| 13 #include "components/mus/public/cpp/property_type_converters.h" | 13 #include "components/mus/public/cpp/property_type_converters.h" |
| 14 #include "components/mus/public/cpp/window.h" | 14 #include "components/mus/public/cpp/window.h" |
| 15 #include "components/mus/public/cpp/window_property.h" | 15 #include "components/mus/public/cpp/window_property.h" |
| 16 #include "components/mus/public/cpp/window_tree_connection.h" | 16 #include "components/mus/public/cpp/window_tree_client.h" |
| 17 #include "components/mus/public/interfaces/input_events.mojom.h" | 17 #include "components/mus/public/interfaces/input_events.mojom.h" |
| 18 #include "components/mus/public/interfaces/mus_constants.mojom.h" | 18 #include "components/mus/public/interfaces/mus_constants.mojom.h" |
| 19 #include "components/mus/public/interfaces/window_manager.mojom.h" | 19 #include "components/mus/public/interfaces/window_manager.mojom.h" |
| 20 #include "mash/wm/bridge/wm_window_mus.h" | 20 #include "mash/wm/bridge/wm_window_mus.h" |
| 21 #include "mash/wm/non_client_frame_controller.h" | 21 #include "mash/wm/non_client_frame_controller.h" |
| 22 #include "mash/wm/property_util.h" | 22 #include "mash/wm/property_util.h" |
| 23 #include "mash/wm/public/interfaces/container.mojom.h" | 23 #include "mash/wm/public/interfaces/container.mojom.h" |
| 24 #include "mash/wm/root_window_controller.h" | 24 #include "mash/wm/root_window_controller.h" |
| 25 #include "ui/gfx/geometry/mojo/geometry_type_converters.h" | 25 #include "ui/gfx/geometry/mojo/geometry_type_converters.h" |
| 26 | 26 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 DCHECK(root); | 85 DCHECK(root); |
| 86 | 86 |
| 87 // TODO(sky): panels need a different frame, http:://crbug.com/614362. | 87 // TODO(sky): panels need a different frame, http:://crbug.com/614362. |
| 88 const bool provide_non_client_frame = | 88 const bool provide_non_client_frame = |
| 89 GetWindowType(*properties) == mus::mojom::WindowType::WINDOW || | 89 GetWindowType(*properties) == mus::mojom::WindowType::WINDOW || |
| 90 GetWindowType(*properties) == mus::mojom::WindowType::PANEL; | 90 GetWindowType(*properties) == mus::mojom::WindowType::PANEL; |
| 91 if (provide_non_client_frame) | 91 if (provide_non_client_frame) |
| 92 (*properties)[mus::mojom::kWaitForUnderlay_Property].clear(); | 92 (*properties)[mus::mojom::kWaitForUnderlay_Property].clear(); |
| 93 | 93 |
| 94 // TODO(sky): constrain and validate properties before passing to server. | 94 // TODO(sky): constrain and validate properties before passing to server. |
| 95 mus::Window* window = root->connection()->NewWindow(properties); | 95 mus::Window* window = root->window_tree()->NewWindow(properties); |
| 96 window->SetBounds(CalculateDefaultBounds(window)); | 96 window->SetBounds(CalculateDefaultBounds(window)); |
| 97 | 97 |
| 98 mus::Window* container_window = nullptr; | 98 mus::Window* container_window = nullptr; |
| 99 if (window->HasSharedProperty(mojom::kWindowContainer_Property)) { | 99 if (window->HasSharedProperty(mojom::kWindowContainer_Property)) { |
| 100 container_window = | 100 container_window = |
| 101 root_controller_->GetWindowForContainer(GetRequestedContainer(window)); | 101 root_controller_->GetWindowForContainer(GetRequestedContainer(window)); |
| 102 } else { | 102 } else { |
| 103 // TODO(sky): window->bounds() isn't quite right. | 103 // TODO(sky): window->bounds() isn't quite right. |
| 104 container_window = WmWindowMus::GetMusWindow( | 104 container_window = WmWindowMus::GetMusWindow( |
| 105 ash::wm::GetDefaultParent(WmWindowMus::Get(root_controller_->root()), | 105 ash::wm::GetDefaultParent(WmWindowMus::Get(root_controller_->root()), |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 void WindowManager::ScreenlockStateChanged(bool locked) { | 207 void WindowManager::ScreenlockStateChanged(bool locked) { |
| 208 // Hide USER_PRIVATE_CONTAINER windows when the screen is locked. | 208 // Hide USER_PRIVATE_CONTAINER windows when the screen is locked. |
| 209 mus::Window* window = root_controller_->GetWindowForContainer( | 209 mus::Window* window = root_controller_->GetWindowForContainer( |
| 210 mash::wm::mojom::Container::USER_PRIVATE); | 210 mash::wm::mojom::Container::USER_PRIVATE); |
| 211 window->SetVisible(!locked); | 211 window->SetVisible(!locked); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace wm | 214 } // namespace wm |
| 215 } // namespace mash | 215 } // namespace mash |
| OLD | NEW |