| 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_connection.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" | |
| 26 | 25 |
| 27 namespace mash { | 26 namespace mash { |
| 28 namespace wm { | 27 namespace wm { |
| 29 | 28 |
| 30 WindowManager::WindowManager() | 29 WindowManager::WindowManager() |
| 31 : root_controller_(nullptr), | 30 : root_controller_(nullptr), |
| 32 window_manager_client_(nullptr), | 31 window_manager_client_(nullptr), |
| 33 binding_(this) {} | 32 binding_(this) {} |
| 34 | 33 |
| 35 WindowManager::~WindowManager() { | 34 WindowManager::~WindowManager() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 } | 57 } |
| 59 } | 58 } |
| 60 | 59 |
| 61 // The insets are roughly what is needed by CustomFrameView. The expectation | 60 // The insets are roughly what is needed by CustomFrameView. The expectation |
| 62 // is at some point we'll write our own NonClientFrameView and get the insets | 61 // is at some point we'll write our own NonClientFrameView and get the insets |
| 63 // from it. | 62 // from it. |
| 64 mus::mojom::FrameDecorationValuesPtr frame_decoration_values = | 63 mus::mojom::FrameDecorationValuesPtr frame_decoration_values = |
| 65 mus::mojom::FrameDecorationValues::New(); | 64 mus::mojom::FrameDecorationValues::New(); |
| 66 const gfx::Insets client_area_insets = | 65 const gfx::Insets client_area_insets = |
| 67 NonClientFrameController::GetPreferredClientAreaInsets(); | 66 NonClientFrameController::GetPreferredClientAreaInsets(); |
| 68 frame_decoration_values->normal_client_area_insets = | 67 frame_decoration_values->normal_client_area_insets = client_area_insets; |
| 69 mojo::Insets::From(client_area_insets); | 68 frame_decoration_values->maximized_client_area_insets = client_area_insets; |
| 70 frame_decoration_values->maximized_client_area_insets = | |
| 71 mojo::Insets::From(client_area_insets); | |
| 72 frame_decoration_values->max_title_bar_button_width = | 69 frame_decoration_values->max_title_bar_button_width = |
| 73 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 70 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
| 74 window_manager_client_->SetFrameDecorationValues( | 71 window_manager_client_->SetFrameDecorationValues( |
| 75 std::move(frame_decoration_values)); | 72 std::move(frame_decoration_values)); |
| 76 | 73 |
| 77 if (session) | 74 if (session) |
| 78 session->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind()); | 75 session->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind()); |
| 79 } | 76 } |
| 80 | 77 |
| 81 mus::Window* WindowManager::NewTopLevelWindow( | 78 mus::Window* WindowManager::NewTopLevelWindow( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 203 |
| 207 void WindowManager::ScreenlockStateChanged(bool locked) { | 204 void WindowManager::ScreenlockStateChanged(bool locked) { |
| 208 // Hide USER_PRIVATE_CONTAINER windows when the screen is locked. | 205 // Hide USER_PRIVATE_CONTAINER windows when the screen is locked. |
| 209 mus::Window* window = root_controller_->GetWindowForContainer( | 206 mus::Window* window = root_controller_->GetWindowForContainer( |
| 210 mash::wm::mojom::Container::USER_PRIVATE); | 207 mash::wm::mojom::Container::USER_PRIVATE); |
| 211 window->SetVisible(!locked); | 208 window->SetVisible(!locked); |
| 212 } | 209 } |
| 213 | 210 |
| 214 } // namespace wm | 211 } // namespace wm |
| 215 } // namespace mash | 212 } // namespace mash |
| OLD | NEW |