| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/top_level_window_factory.h" | 5 #include "ash/mus/top_level_window_factory.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/container_finder.h" | 7 #include "ash/common/wm/container_finder.h" |
| 8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 aura::Window* CreateAndParentTopLevelWindow( | 201 aura::Window* CreateAndParentTopLevelWindow( |
| 202 WindowManager* window_manager, | 202 WindowManager* window_manager, |
| 203 ui::mojom::WindowType window_type, | 203 ui::mojom::WindowType window_type, |
| 204 std::map<std::string, std::vector<uint8_t>>* properties) { | 204 std::map<std::string, std::vector<uint8_t>>* properties) { |
| 205 RootWindowController* root_window_controller = | 205 RootWindowController* root_window_controller = |
| 206 GetRootWindowControllerForNewTopLevelWindow(properties); | 206 GetRootWindowControllerForNewTopLevelWindow(properties); |
| 207 aura::Window* window = CreateAndParentTopLevelWindowInRoot( | 207 aura::Window* window = CreateAndParentTopLevelWindowInRoot( |
| 208 window_manager, root_window_controller, window_type, properties); | 208 window_manager, root_window_controller, window_type, properties); |
| 209 DisconnectedAppHandler::Create(window); | 209 DisconnectedAppHandler::Create(window); |
| 210 if (properties->count( | 210 |
| 211 ui::mojom::WindowManager::kWindowIgnoredByShelf_Property)) { | 211 auto ignored_by_shelf_iter = properties->find( |
| 212 ui::mojom::WindowManager::kWindowIgnoredByShelf_InitProperty); |
| 213 if (ignored_by_shelf_iter != properties->end()) { |
| 212 wm::WindowState* window_state = WmWindow::Get(window)->GetWindowState(); | 214 wm::WindowState* window_state = WmWindow::Get(window)->GetWindowState(); |
| 213 window_state->set_ignored_by_shelf(mojo::ConvertTo<bool>( | 215 window_state->set_ignored_by_shelf( |
| 214 (*properties) | 216 mojo::ConvertTo<bool>(ignored_by_shelf_iter->second)); |
| 215 [ui::mojom::WindowManager::kWindowIgnoredByShelf_Property])); | |
| 216 // No need to persist this value. | 217 // No need to persist this value. |
| 217 properties->erase(ui::mojom::WindowManager::kWindowIgnoredByShelf_Property); | 218 properties->erase(ignored_by_shelf_iter); |
| 218 } | 219 } |
| 219 if (properties->count(ui::mojom::WindowManager::kFocusable_InitProperty)) { | 220 |
| 220 bool can_focus = mojo::ConvertTo<bool>( | 221 auto focusable_iter = |
| 221 (*properties)[ui::mojom::WindowManager::kFocusable_InitProperty]); | 222 properties->find(ui::mojom::WindowManager::kFocusable_InitProperty); |
| 223 if (focusable_iter != properties->end()) { |
| 224 bool can_focus = mojo::ConvertTo<bool>(focusable_iter->second); |
| 222 window_manager->window_tree_client()->SetCanFocus(window, can_focus); | 225 window_manager->window_tree_client()->SetCanFocus(window, can_focus); |
| 223 NonClientFrameController* non_client_frame_controller = | 226 NonClientFrameController* non_client_frame_controller = |
| 224 NonClientFrameController::Get(window); | 227 NonClientFrameController::Get(window); |
| 225 if (non_client_frame_controller) | 228 if (non_client_frame_controller) |
| 226 non_client_frame_controller->set_can_activate(can_focus); | 229 non_client_frame_controller->set_can_activate(can_focus); |
| 227 // No need to persist this value. | 230 // No need to persist this value. |
| 228 properties->erase(ui::mojom::WindowManager::kFocusable_InitProperty); | 231 properties->erase(focusable_iter); |
| 229 } | 232 } |
| 230 return window; | 233 return window; |
| 231 } | 234 } |
| 232 | 235 |
| 233 } // namespace mus | 236 } // namespace mus |
| 234 } // namespace ash | 237 } // namespace ash |
| OLD | NEW |