| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "ui/aura/mus/window_tree_client.h" | 44 #include "ui/aura/mus/window_tree_client.h" |
| 45 #include "ui/aura/mus/window_tree_host_mus.h" | 45 #include "ui/aura/mus/window_tree_host_mus.h" |
| 46 #include "ui/aura/window.h" | 46 #include "ui/aura/window.h" |
| 47 #include "ui/base/class_property.h" | 47 #include "ui/base/class_property.h" |
| 48 #include "ui/base/hit_test.h" | 48 #include "ui/base/hit_test.h" |
| 49 #include "ui/display/display_observer.h" | 49 #include "ui/display/display_observer.h" |
| 50 #include "ui/events/mojo/event.mojom.h" | 50 #include "ui/events/mojo/event.mojom.h" |
| 51 #include "ui/views/mus/pointer_watcher_event_router.h" | 51 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 52 #include "ui/views/mus/screen_mus.h" | 52 #include "ui/views/mus/screen_mus.h" |
| 53 #include "ui/wm/core/capture_controller.h" | 53 #include "ui/wm/core/capture_controller.h" |
| 54 #include "ui/wm/core/shadow_types.h" |
| 54 #include "ui/wm/core/wm_state.h" | 55 #include "ui/wm/core/wm_state.h" |
| 55 #include "ui/wm/public/activation_client.h" | 56 #include "ui/wm/public/activation_client.h" |
| 56 | 57 |
| 57 namespace ash { | 58 namespace ash { |
| 58 namespace mus { | 59 namespace mus { |
| 59 | 60 |
| 60 // TODO: need to register OSExchangeDataProviderMus. http://crbug.com/665077. | 61 // TODO: need to register OSExchangeDataProviderMus. http://crbug.com/665077. |
| 61 WindowManager::WindowManager(service_manager::Connector* connector) | 62 WindowManager::WindowManager(service_manager::Connector* connector) |
| 62 : connector_(connector), | 63 : connector_(connector), |
| 63 wm_state_(base::MakeUnique<::wm::WMState>()), | 64 wm_state_(base::MakeUnique<::wm::WMState>()), |
| 64 property_converter_(base::MakeUnique<aura::PropertyConverter>()) { | 65 property_converter_(base::MakeUnique<aura::PropertyConverter>()) { |
| 65 property_converter_->RegisterProperty( | 66 property_converter_->RegisterProperty( |
| 66 kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property); | 67 kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property); |
| 67 property_converter_->RegisterProperty( | 68 property_converter_->RegisterProperty( |
| 68 kRenderTitleAreaProperty, | 69 kRenderTitleAreaProperty, |
| 69 ui::mojom::WindowManager::kRenderParentTitleArea_Property); | 70 ui::mojom::WindowManager::kRenderParentTitleArea_Property); |
| 70 property_converter_->RegisterProperty( | 71 property_converter_->RegisterProperty( |
| 71 kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property); | 72 kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property); |
| 73 property_converter_->RegisterProperty( |
| 74 ::wm::kShadowElevationKey, |
| 75 ui::mojom::WindowManager::kShadowElevation_Property); |
| 72 } | 76 } |
| 73 | 77 |
| 74 WindowManager::~WindowManager() { | 78 WindowManager::~WindowManager() { |
| 75 Shutdown(); | 79 Shutdown(); |
| 76 ash::Shell::set_window_tree_client(nullptr); | 80 ash::Shell::set_window_tree_client(nullptr); |
| 77 ash::Shell::set_window_manager_client(nullptr); | 81 ash::Shell::set_window_manager_client(nullptr); |
| 78 } | 82 } |
| 79 | 83 |
| 80 void WindowManager::Init( | 84 void WindowManager::Init( |
| 81 std::unique_ptr<aura::WindowTreeClient> window_tree_client, | 85 std::unique_ptr<aura::WindowTreeClient> window_tree_client, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 aura::Window* window, | 313 aura::Window* window, |
| 310 const std::string& name, | 314 const std::string& name, |
| 311 std::unique_ptr<std::vector<uint8_t>>* new_data) { | 315 std::unique_ptr<std::vector<uint8_t>>* new_data) { |
| 312 // TODO(sky): constrain this to set of keys we know about, and allowed values. | 316 // TODO(sky): constrain this to set of keys we know about, and allowed values. |
| 313 if (name == ui::mojom::WindowManager::kWindowIgnoredByShelf_Property) { | 317 if (name == ui::mojom::WindowManager::kWindowIgnoredByShelf_Property) { |
| 314 wm::WindowState* window_state = WmWindow::Get(window)->GetWindowState(); | 318 wm::WindowState* window_state = WmWindow::Get(window)->GetWindowState(); |
| 315 window_state->set_ignored_by_shelf( | 319 window_state->set_ignored_by_shelf( |
| 316 new_data ? mojo::ConvertTo<bool>(**new_data) : false); | 320 new_data ? mojo::ConvertTo<bool>(**new_data) : false); |
| 317 return false; // Won't attempt to map through property converter. | 321 return false; // Won't attempt to map through property converter. |
| 318 } | 322 } |
| 319 return name == ui::mojom::WindowManager::kAppIcon_Property || | 323 if (property_converter_->IsTransportNameRegistered(name)) |
| 320 name == ui::mojom::WindowManager::kShowState_Property || | 324 return true; |
| 321 name == ui::mojom::WindowManager::kPreferredSize_Property || | 325 DVLOG(1) << "unknown property changed, ignoring " << name; |
| 322 name == ui::mojom::WindowManager::kResizeBehavior_Property || | 326 return false; |
| 323 name == ui::mojom::WindowManager::kShelfItemType_Property || | |
| 324 name == ui::mojom::WindowManager::kWindowIcon_Property || | |
| 325 name == ui::mojom::WindowManager::kWindowTitle_Property; | |
| 326 } | 327 } |
| 327 | 328 |
| 328 void WindowManager::OnWmSetCanFocus(aura::Window* window, bool can_focus) { | 329 void WindowManager::OnWmSetCanFocus(aura::Window* window, bool can_focus) { |
| 329 NonClientFrameController* non_client_frame_controller = | 330 NonClientFrameController* non_client_frame_controller = |
| 330 NonClientFrameController::Get(window); | 331 NonClientFrameController::Get(window); |
| 331 if (non_client_frame_controller) | 332 if (non_client_frame_controller) |
| 332 non_client_frame_controller->set_can_activate(can_focus); | 333 non_client_frame_controller->set_can_activate(can_focus); |
| 333 } | 334 } |
| 334 | 335 |
| 335 aura::Window* WindowManager::OnWmCreateTopLevelWindow( | 336 aura::Window* WindowManager::OnWmCreateTopLevelWindow( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 bool WindowManager::IsWindowActive(aura::Window* window) { | 460 bool WindowManager::IsWindowActive(aura::Window* window) { |
| 460 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; | 461 return Shell::GetInstance()->activation_client()->GetActiveWindow() == window; |
| 461 } | 462 } |
| 462 | 463 |
| 463 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { | 464 void WindowManager::OnWmDeactivateWindow(aura::Window* window) { |
| 464 Shell::GetInstance()->activation_client()->DeactivateWindow(window); | 465 Shell::GetInstance()->activation_client()->DeactivateWindow(window); |
| 465 } | 466 } |
| 466 | 467 |
| 467 } // namespace mus | 468 } // namespace mus |
| 468 } // namespace ash | 469 } // namespace ash |
| OLD | NEW |