Chromium Code Reviews| 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 "ash/mus/window_manager.h" | 5 #include "ash/mus/window_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #include "ash/shell_init_params.h" | 31 #include "ash/shell_init_params.h" |
| 32 #include "ash/wm/ash_focus_rules.h" | 32 #include "ash/wm/ash_focus_rules.h" |
| 33 #include "base/memory/ptr_util.h" | 33 #include "base/memory/ptr_util.h" |
| 34 #include "base/threading/sequenced_worker_pool.h" | 34 #include "base/threading/sequenced_worker_pool.h" |
| 35 #include "services/service_manager/public/cpp/connector.h" | 35 #include "services/service_manager/public/cpp/connector.h" |
| 36 #include "services/ui/common/accelerator_util.h" | 36 #include "services/ui/common/accelerator_util.h" |
| 37 #include "services/ui/common/types.h" | 37 #include "services/ui/common/types.h" |
| 38 #include "services/ui/public/cpp/property_type_converters.h" | 38 #include "services/ui/public/cpp/property_type_converters.h" |
| 39 #include "services/ui/public/interfaces/constants.mojom.h" | 39 #include "services/ui/public/interfaces/constants.mojom.h" |
| 40 #include "services/ui/public/interfaces/window_manager.mojom.h" | 40 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 41 #include "ui/aura/client/aura_constants.h" | |
| 41 #include "ui/aura/client/window_parenting_client.h" | 42 #include "ui/aura/client/window_parenting_client.h" |
| 42 #include "ui/aura/env.h" | 43 #include "ui/aura/env.h" |
| 43 #include "ui/aura/mus/capture_synchronizer.h" | 44 #include "ui/aura/mus/capture_synchronizer.h" |
| 44 #include "ui/aura/mus/property_converter.h" | 45 #include "ui/aura/mus/property_converter.h" |
| 45 #include "ui/aura/mus/window_tree_client.h" | 46 #include "ui/aura/mus/window_tree_client.h" |
| 46 #include "ui/aura/mus/window_tree_host_mus.h" | 47 #include "ui/aura/mus/window_tree_host_mus.h" |
| 47 #include "ui/aura/window.h" | 48 #include "ui/aura/window.h" |
| 48 #include "ui/base/class_property.h" | 49 #include "ui/base/class_property.h" |
| 49 #include "ui/base/hit_test.h" | 50 #include "ui/base/hit_test.h" |
| 50 #include "ui/display/display_observer.h" | 51 #include "ui/display/display_observer.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 bool WindowManager::OnWmSetProperty( | 317 bool WindowManager::OnWmSetProperty( |
| 317 aura::Window* window, | 318 aura::Window* window, |
| 318 const std::string& name, | 319 const std::string& name, |
| 319 std::unique_ptr<std::vector<uint8_t>>* new_data) { | 320 std::unique_ptr<std::vector<uint8_t>>* new_data) { |
| 320 if (property_converter_->IsTransportNameRegistered(name)) | 321 if (property_converter_->IsTransportNameRegistered(name)) |
| 321 return true; | 322 return true; |
| 322 DVLOG(1) << "unknown property changed, ignoring " << name; | 323 DVLOG(1) << "unknown property changed, ignoring " << name; |
| 323 return false; | 324 return false; |
| 324 } | 325 } |
| 325 | 326 |
| 327 void WindowManager::OnWmSetModalType(aura::Window* window, ui::ModalType type) { | |
| 328 ui::ModalType old_type = window->GetProperty(aura::client::kModalKey); | |
| 329 if (type == old_type) | |
| 330 return; | |
| 331 | |
| 332 window->SetProperty(aura::client::kModalKey, type); | |
|
sky
2017/03/20 20:14:30
If the property changes from system shouldn't you
Hadi
2017/03/20 20:28:58
Right. The following if won't return if old_type i
| |
| 333 if (type != ui::MODAL_TYPE_SYSTEM && old_type != ui::MODAL_TYPE_SYSTEM) | |
| 334 return; | |
| 335 | |
| 336 WmWindow* new_parent = | |
| 337 wm::GetDefaultParent(WmWindow::Get(window), window->bounds()); | |
| 338 DCHECK(window->parent()); | |
|
sky
2017/03/20 20:14:30
Why should the window already have a parent?
Hadi
2017/03/20 20:28:58
Done.
| |
| 339 window->parent()->RemoveChild(window); | |
| 340 DCHECK(new_parent); | |
| 341 new_parent->aura_window()->AddChild(window); | |
| 342 } | |
| 343 | |
| 326 void WindowManager::OnWmSetCanFocus(aura::Window* window, bool can_focus) { | 344 void WindowManager::OnWmSetCanFocus(aura::Window* window, bool can_focus) { |
| 327 NonClientFrameController* non_client_frame_controller = | 345 NonClientFrameController* non_client_frame_controller = |
| 328 NonClientFrameController::Get(window); | 346 NonClientFrameController::Get(window); |
| 329 if (non_client_frame_controller) | 347 if (non_client_frame_controller) |
| 330 non_client_frame_controller->set_can_activate(can_focus); | 348 non_client_frame_controller->set_can_activate(can_focus); |
| 331 } | 349 } |
| 332 | 350 |
| 333 aura::Window* WindowManager::OnWmCreateTopLevelWindow( | 351 aura::Window* WindowManager::OnWmCreateTopLevelWindow( |
| 334 ui::mojom::WindowType window_type, | 352 ui::mojom::WindowType window_type, |
| 335 std::map<std::string, std::vector<uint8_t>>* properties) { | 353 std::map<std::string, std::vector<uint8_t>>* properties) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 bool WindowManager::IsWindowActive(aura::Window* window) { | 475 bool WindowManager::IsWindowActive(aura::Window* window) { |
| 458 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; | 476 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; |
| 459 } | 477 } |
| 460 | 478 |
| 461 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { | 479 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { |
| 462 Shell::GetInstance()->activation_client()->DeactivateWindow(window); | 480 Shell::GetInstance()->activation_client()->DeactivateWindow(window); |
| 463 } | 481 } |
| 464 | 482 |
| 465 } // namespace mus | 483 } // namespace mus |
| 466 } // namespace ash | 484 } // namespace ash |
| OLD | NEW |