| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 void WindowManager::Initialize(RootWindowController* root_controller, | 35 void WindowManager::Initialize(RootWindowController* root_controller, |
| 36 session::mojom::Session* session) { | 36 session::mojom::Session* session) { |
| 37 DCHECK(root_controller); | 37 DCHECK(root_controller); |
| 38 DCHECK(!root_controller_); | 38 DCHECK(!root_controller_); |
| 39 root_controller_ = root_controller; | 39 root_controller_ = root_controller; |
| 40 | 40 |
| 41 // Observe all the containers so that windows can be added to/removed from the | 41 // Observe all the containers so that windows can be added to/removed from the |
| 42 // |disconnected_app_handler_|. | 42 // |disconnected_app_handler_|. |
| 43 int count = static_cast<int>(mojom::Container::COUNT); | 43 int count = static_cast<int>(mojom::Container::COUNT); |
| 44 for (int id = static_cast<int>(mojom::Container::ROOT) + 1; id < count; | 44 for (int id = static_cast<int>(mojom::Container::ROOT_CONTAINER) + 1; |
| 45 ++id) { | 45 id < count; ++id) { |
| 46 mus::Window* container = root_controller_->GetWindowForContainer( | 46 mus::Window* container = root_controller_->GetWindowForContainer( |
| 47 static_cast<mojom::Container>(id)); | 47 static_cast<mojom::Container>(id)); |
| 48 Add(container); | 48 Add(container); |
| 49 | 49 |
| 50 // Add any pre-existing windows in the container to | 50 // Add any pre-existing windows in the container to |
| 51 // |disconnected_app_handler_|. | 51 // |disconnected_app_handler_|. |
| 52 for (auto child : container->children()) { | 52 for (auto child : container->children()) { |
| 53 if (!root_controller_->WindowIsContainer(child)) | 53 if (!root_controller_->WindowIsContainer(child)) |
| 54 disconnected_app_handler_.Add(child); | 54 disconnected_app_handler_.Add(child); |
| 55 } | 55 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 mus::Window* WindowManager::OnWmCreateTopLevelWindow( | 168 mus::Window* WindowManager::OnWmCreateTopLevelWindow( |
| 169 std::map<std::string, std::vector<uint8_t>>* properties) { | 169 std::map<std::string, std::vector<uint8_t>>* properties) { |
| 170 return NewTopLevelWindow(properties); | 170 return NewTopLevelWindow(properties); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) { | 173 void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) { |
| 174 root_controller_->OnAccelerator(id, std::move(event)); | 174 root_controller_->OnAccelerator(id, std::move(event)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void WindowManager::ScreenlockStateChanged(bool locked) { | 177 void WindowManager::ScreenlockStateChanged(bool locked) { |
| 178 // Hide USER_PRIVATE windows when the screen is locked. | 178 // Hide USER_PRIVATE_CONTAINER windows when the screen is locked. |
| 179 mus::Window* window = root_controller_->GetWindowForContainer( | 179 mus::Window* window = root_controller_->GetWindowForContainer( |
| 180 mash::wm::mojom::Container::USER_PRIVATE); | 180 mash::wm::mojom::Container::USER_PRIVATE_CONTAINER); |
| 181 window->SetVisible(!locked); | 181 window->SetVisible(!locked); |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace wm | 184 } // namespace wm |
| 185 } // namespace mash | 185 } // namespace mash |
| OLD | NEW |