| 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 |
| 11 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/mus/accelerators/accelerator_handler.h" | 12 #include "ash/mus/accelerators/accelerator_handler.h" |
| 13 #include "ash/mus/accelerators/accelerator_ids.h" | 13 #include "ash/mus/accelerators/accelerator_ids.h" |
| 14 #include "ash/mus/app_list_presenter_mus.h" |
| 14 #include "ash/mus/bridge/wm_lookup_mus.h" | 15 #include "ash/mus/bridge/wm_lookup_mus.h" |
| 15 #include "ash/mus/bridge/wm_shell_mus.h" | 16 #include "ash/mus/bridge/wm_shell_mus.h" |
| 16 #include "ash/mus/bridge/wm_window_mus.h" | 17 #include "ash/mus/bridge/wm_window_mus.h" |
| 17 #include "ash/mus/move_event_handler.h" | 18 #include "ash/mus/move_event_handler.h" |
| 18 #include "ash/mus/non_client_frame_controller.h" | 19 #include "ash/mus/non_client_frame_controller.h" |
| 19 #include "ash/mus/property_util.h" | 20 #include "ash/mus/property_util.h" |
| 20 #include "ash/mus/root_window_controller.h" | 21 #include "ash/mus/root_window_controller.h" |
| 21 #include "ash/mus/shadow_controller.h" | 22 #include "ash/mus/shadow_controller.h" |
| 22 #include "ash/mus/shell_delegate_mus.h" | 23 #include "ash/mus/shell_delegate_mus.h" |
| 23 #include "ash/mus/window_manager_observer.h" | 24 #include "ash/mus/window_manager_observer.h" |
| 24 #include "ash/public/interfaces/container.mojom.h" | 25 #include "ash/public/interfaces/container.mojom.h" |
| 26 #include "base/memory/ptr_util.h" |
| 25 #include "services/ui/common/event_matcher_util.h" | 27 #include "services/ui/common/event_matcher_util.h" |
| 26 #include "services/ui/common/types.h" | 28 #include "services/ui/common/types.h" |
| 27 #include "services/ui/public/cpp/property_type_converters.h" | 29 #include "services/ui/public/cpp/property_type_converters.h" |
| 28 #include "services/ui/public/cpp/window.h" | 30 #include "services/ui/public/cpp/window.h" |
| 29 #include "services/ui/public/cpp/window_property.h" | 31 #include "services/ui/public/cpp/window_property.h" |
| 30 #include "services/ui/public/cpp/window_tree_client.h" | 32 #include "services/ui/public/cpp/window_tree_client.h" |
| 31 #include "services/ui/public/interfaces/mus_constants.mojom.h" | 33 #include "services/ui/public/interfaces/mus_constants.mojom.h" |
| 32 #include "services/ui/public/interfaces/window_manager.mojom.h" | 34 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 33 #include "ui/app_list/presenter/app_list_presenter.h" | |
| 34 #include "ui/base/hit_test.h" | 35 #include "ui/base/hit_test.h" |
| 35 #include "ui/events/mojo/event.mojom.h" | 36 #include "ui/events/mojo/event.mojom.h" |
| 36 #include "ui/views/mus/pointer_watcher_event_router.h" | 37 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 37 #include "ui/views/mus/screen_mus.h" | 38 #include "ui/views/mus/screen_mus.h" |
| 38 | 39 |
| 39 namespace { | |
| 40 | |
| 41 // TODO(jamescook): Port ash::sysui::AppListPresenterMus and eliminate this. | |
| 42 class AppListPresenterStub : public app_list::AppListPresenter { | |
| 43 public: | |
| 44 AppListPresenterStub() {} | |
| 45 ~AppListPresenterStub() override {} | |
| 46 | |
| 47 // app_list::AppListPresenter: | |
| 48 void Show(int64_t display_id) override { NOTIMPLEMENTED(); } | |
| 49 void Dismiss() override { NOTIMPLEMENTED(); } | |
| 50 void ToggleAppList(int64_t display_id) override { NOTIMPLEMENTED(); } | |
| 51 bool IsVisible() const override { | |
| 52 NOTIMPLEMENTED(); | |
| 53 return false; | |
| 54 } | |
| 55 bool GetTargetVisibility() const override { | |
| 56 NOTIMPLEMENTED(); | |
| 57 return false; | |
| 58 } | |
| 59 | |
| 60 private: | |
| 61 DISALLOW_COPY_AND_ASSIGN(AppListPresenterStub); | |
| 62 }; | |
| 63 | |
| 64 } // namespace | |
| 65 | |
| 66 namespace ash { | 40 namespace ash { |
| 67 namespace mus { | 41 namespace mus { |
| 68 | 42 |
| 69 WindowManager::WindowManager(shell::Connector* connector) | 43 WindowManager::WindowManager(shell::Connector* connector) |
| 70 : connector_(connector) {} | 44 : connector_(connector) {} |
| 71 | 45 |
| 72 WindowManager::~WindowManager() { | 46 WindowManager::~WindowManager() { |
| 73 Shutdown(); | 47 Shutdown(); |
| 74 } | 48 } |
| 75 | 49 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 91 ui::mojom::FrameDecorationValues::New(); | 65 ui::mojom::FrameDecorationValues::New(); |
| 92 const gfx::Insets client_area_insets = | 66 const gfx::Insets client_area_insets = |
| 93 NonClientFrameController::GetPreferredClientAreaInsets(); | 67 NonClientFrameController::GetPreferredClientAreaInsets(); |
| 94 frame_decoration_values->normal_client_area_insets = client_area_insets; | 68 frame_decoration_values->normal_client_area_insets = client_area_insets; |
| 95 frame_decoration_values->maximized_client_area_insets = client_area_insets; | 69 frame_decoration_values->maximized_client_area_insets = client_area_insets; |
| 96 frame_decoration_values->max_title_bar_button_width = | 70 frame_decoration_values->max_title_bar_button_width = |
| 97 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 71 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
| 98 window_manager_client_->SetFrameDecorationValues( | 72 window_manager_client_->SetFrameDecorationValues( |
| 99 std::move(frame_decoration_values)); | 73 std::move(frame_decoration_values)); |
| 100 | 74 |
| 101 std::unique_ptr<ShellDelegate> shell_delegate(new ShellDelegateMus( | 75 shell_.reset(new WmShellMus(base::MakeUnique<ShellDelegateMus>(connector_), |
| 102 base::MakeUnique<AppListPresenterStub>(), connector_)); | 76 this, pointer_watcher_event_router_.get())); |
| 103 shell_.reset(new WmShellMus(std::move(shell_delegate), this, | |
| 104 pointer_watcher_event_router_.get())); | |
| 105 shell_->Initialize(blocking_pool); | 77 shell_->Initialize(blocking_pool); |
| 106 lookup_.reset(new WmLookupMus); | 78 lookup_.reset(new WmLookupMus); |
| 107 } | 79 } |
| 108 | 80 |
| 109 void WindowManager::SetScreenLocked(bool is_locked) { | 81 void WindowManager::SetScreenLocked(bool is_locked) { |
| 110 // TODO: screen locked state needs to be persisted for newly added displays. | 82 // TODO: screen locked state needs to be persisted for newly added displays. |
| 111 for (auto& root_window_controller : root_window_controllers_) { | 83 for (auto& root_window_controller : root_window_controllers_) { |
| 112 WmWindowMus* non_lock_screen_containers_container = | 84 WmWindowMus* non_lock_screen_containers_container = |
| 113 root_window_controller->GetWindowByShellWindowId( | 85 root_window_controller->GetWindowByShellWindowId( |
| 114 kShellWindowId_NonLockScreenContainersContainer); | 86 kShellWindowId_NonLockScreenContainersContainer); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 const ui::Event& event) { | 296 const ui::Event& event) { |
| 325 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); | 297 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); |
| 326 if (iter == accelerator_handlers_.end()) | 298 if (iter == accelerator_handlers_.end()) |
| 327 return ui::mojom::EventResult::HANDLED; | 299 return ui::mojom::EventResult::HANDLED; |
| 328 | 300 |
| 329 return iter->second->OnAccelerator(id, event); | 301 return iter->second->OnAccelerator(id, event); |
| 330 } | 302 } |
| 331 | 303 |
| 332 } // namespace mus | 304 } // namespace mus |
| 333 } // namespace ash | 305 } // namespace ash |
| OLD | NEW |