| 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 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (session) | 77 if (session) |
| 78 session->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind()); | 78 session->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 mus::Window* WindowManager::NewTopLevelWindow( | 81 mus::Window* WindowManager::NewTopLevelWindow( |
| 82 std::map<std::string, std::vector<uint8_t>>* properties) { | 82 std::map<std::string, std::vector<uint8_t>>* properties) { |
| 83 DCHECK(root_controller_); | 83 DCHECK(root_controller_); |
| 84 mus::Window* root = root_controller_->root(); | 84 mus::Window* root = root_controller_->root(); |
| 85 DCHECK(root); | 85 DCHECK(root); |
| 86 | 86 |
| 87 // TODO(sky): panels need a different frame, http:://crbug.com/614362. |
| 87 const bool provide_non_client_frame = | 88 const bool provide_non_client_frame = |
| 88 GetWindowType(*properties) == mus::mojom::WindowType::WINDOW; | 89 GetWindowType(*properties) == mus::mojom::WindowType::WINDOW || |
| 90 GetWindowType(*properties) == mus::mojom::WindowType::PANEL; |
| 89 if (provide_non_client_frame) | 91 if (provide_non_client_frame) |
| 90 (*properties)[mus::mojom::kWaitForUnderlay_Property].clear(); | 92 (*properties)[mus::mojom::kWaitForUnderlay_Property].clear(); |
| 91 | 93 |
| 92 // TODO(sky): constrain and validate properties before passing to server. | 94 // TODO(sky): constrain and validate properties before passing to server. |
| 93 mus::Window* window = root->connection()->NewWindow(properties); | 95 mus::Window* window = root->connection()->NewWindow(properties); |
| 94 window->SetBounds(CalculateDefaultBounds(window)); | 96 window->SetBounds(CalculateDefaultBounds(window)); |
| 95 | 97 |
| 96 mus::Window* container_window = nullptr; | 98 mus::Window* container_window = nullptr; |
| 97 if (window->HasSharedProperty(mojom::kWindowContainer_Property)) { | 99 if (window->HasSharedProperty(mojom::kWindowContainer_Property)) { |
| 98 container_window = | 100 container_window = |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 199 |
| 198 void WindowManager::ScreenlockStateChanged(bool locked) { | 200 void WindowManager::ScreenlockStateChanged(bool locked) { |
| 199 // Hide USER_PRIVATE_CONTAINER windows when the screen is locked. | 201 // Hide USER_PRIVATE_CONTAINER windows when the screen is locked. |
| 200 mus::Window* window = root_controller_->GetWindowForContainer( | 202 mus::Window* window = root_controller_->GetWindowForContainer( |
| 201 mash::wm::mojom::Container::USER_PRIVATE); | 203 mash::wm::mojom::Container::USER_PRIVATE); |
| 202 window->SetVisible(!locked); | 204 window->SetVisible(!locked); |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace wm | 207 } // namespace wm |
| 206 } // namespace mash | 208 } // namespace mash |
| OLD | NEW |