| 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/bridge/wm_lookup_mus.h" | 12 #include "ash/mus/bridge/wm_lookup_mus.h" |
| 13 #include "ash/mus/bridge/wm_shell_mus.h" | 13 #include "ash/mus/bridge/wm_shell_mus.h" |
| 14 #include "ash/mus/bridge/wm_window_mus.h" | 14 #include "ash/mus/bridge/wm_window_mus.h" |
| 15 #include "ash/mus/frame/move_event_handler.h" | 15 #include "ash/mus/frame/move_event_handler.h" |
| 16 #include "ash/mus/non_client_frame_controller.h" | 16 #include "ash/mus/non_client_frame_controller.h" |
| 17 #include "ash/mus/property_util.h" | 17 #include "ash/mus/property_util.h" |
| 18 #include "ash/mus/root_window_controller.h" | 18 #include "ash/mus/root_window_controller.h" |
| 19 #include "ash/mus/shadow_controller.h" | 19 #include "ash/mus/shadow_controller.h" |
| 20 #include "ash/mus/shell_delegate_mus.h" |
| 20 #include "ash/mus/window_manager_observer.h" | 21 #include "ash/mus/window_manager_observer.h" |
| 21 #include "ash/public/interfaces/container.mojom.h" | 22 #include "ash/public/interfaces/container.mojom.h" |
| 22 #include "services/ui/common/event_matcher_util.h" | 23 #include "services/ui/common/event_matcher_util.h" |
| 23 #include "services/ui/common/types.h" | 24 #include "services/ui/common/types.h" |
| 24 #include "services/ui/public/cpp/property_type_converters.h" | 25 #include "services/ui/public/cpp/property_type_converters.h" |
| 25 #include "services/ui/public/cpp/window.h" | 26 #include "services/ui/public/cpp/window.h" |
| 26 #include "services/ui/public/cpp/window_property.h" | 27 #include "services/ui/public/cpp/window_property.h" |
| 27 #include "services/ui/public/cpp/window_tree_client.h" | 28 #include "services/ui/public/cpp/window_tree_client.h" |
| 28 #include "services/ui/public/interfaces/mus_constants.mojom.h" | 29 #include "services/ui/public/interfaces/mus_constants.mojom.h" |
| 29 #include "services/ui/public/interfaces/window_manager.mojom.h" | 30 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 31 #include "ui/app_list/presenter/app_list_presenter.h" |
| 30 #include "ui/base/hit_test.h" | 32 #include "ui/base/hit_test.h" |
| 31 #include "ui/events/mojo/event.mojom.h" | 33 #include "ui/events/mojo/event.mojom.h" |
| 32 #include "ui/views/mus/screen_mus.h" | 34 #include "ui/views/mus/screen_mus.h" |
| 33 | 35 |
| 34 namespace ash { | 36 namespace ash { |
| 35 namespace mus { | 37 namespace mus { |
| 36 | 38 |
| 37 const uint32_t kWindowSwitchAccelerator = 1; | 39 const uint32_t kWindowSwitchAccelerator = 1; |
| 38 | 40 |
| 39 void AssertTrue(bool success) { | 41 void AssertTrue(bool success) { |
| 40 DCHECK(success); | 42 DCHECK(success); |
| 41 } | 43 } |
| 42 | 44 |
| 45 // TODO(jamescook): Port ash::sysui::AppListPresenterMus and eliminate this. |
| 46 class AppListPresenterStub : public app_list::AppListPresenter { |
| 47 public: |
| 48 AppListPresenterStub() {} |
| 49 ~AppListPresenterStub() override {} |
| 50 |
| 51 // app_list::AppListPresenter: |
| 52 void Show(int64_t display_id) override { NOTIMPLEMENTED(); } |
| 53 void Dismiss() override { NOTIMPLEMENTED(); } |
| 54 void ToggleAppList(int64_t display_id) override { NOTIMPLEMENTED(); } |
| 55 bool IsVisible() const override { |
| 56 NOTIMPLEMENTED(); |
| 57 return false; |
| 58 } |
| 59 bool GetTargetVisibility() const override { |
| 60 NOTIMPLEMENTED(); |
| 61 return false; |
| 62 } |
| 63 |
| 64 private: |
| 65 DISALLOW_COPY_AND_ASSIGN(AppListPresenterStub); |
| 66 }; |
| 67 |
| 43 WindowManager::WindowManager(shell::Connector* connector) | 68 WindowManager::WindowManager(shell::Connector* connector) |
| 44 : connector_(connector) {} | 69 : connector_(connector) {} |
| 45 | 70 |
| 46 WindowManager::~WindowManager() { | 71 WindowManager::~WindowManager() { |
| 47 // NOTE: |window_tree_client_| may already be null. | 72 // NOTE: |window_tree_client_| may already be null. |
| 48 delete window_tree_client_; | 73 delete window_tree_client_; |
| 49 } | 74 } |
| 50 | 75 |
| 51 void WindowManager::Init(::ui::WindowTreeClient* window_tree_client) { | 76 void WindowManager::Init(::ui::WindowTreeClient* window_tree_client) { |
| 52 DCHECK(!window_tree_client_); | 77 DCHECK(!window_tree_client_); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 63 ::ui::mojom::FrameDecorationValues::New(); | 88 ::ui::mojom::FrameDecorationValues::New(); |
| 64 const gfx::Insets client_area_insets = | 89 const gfx::Insets client_area_insets = |
| 65 NonClientFrameController::GetPreferredClientAreaInsets(); | 90 NonClientFrameController::GetPreferredClientAreaInsets(); |
| 66 frame_decoration_values->normal_client_area_insets = client_area_insets; | 91 frame_decoration_values->normal_client_area_insets = client_area_insets; |
| 67 frame_decoration_values->maximized_client_area_insets = client_area_insets; | 92 frame_decoration_values->maximized_client_area_insets = client_area_insets; |
| 68 frame_decoration_values->max_title_bar_button_width = | 93 frame_decoration_values->max_title_bar_button_width = |
| 69 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 94 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
| 70 window_manager_client_->SetFrameDecorationValues( | 95 window_manager_client_->SetFrameDecorationValues( |
| 71 std::move(frame_decoration_values)); | 96 std::move(frame_decoration_values)); |
| 72 | 97 |
| 73 // TODO(msw): Provide a valid ShellDelegate here; maybe port ShellDelegateMus? | 98 std::unique_ptr<ShellDelegate> shell_delegate( |
| 74 shell_.reset(new WmShellMus(nullptr, window_tree_client_, connector_)); | 99 new ShellDelegateMus(base::MakeUnique<AppListPresenterStub>())); |
| 100 shell_.reset(new WmShellMus(std::move(shell_delegate), window_tree_client_, |
| 101 connector_)); |
| 75 lookup_.reset(new WmLookupMus); | 102 lookup_.reset(new WmLookupMus); |
| 76 } | 103 } |
| 77 | 104 |
| 78 void WindowManager::SetScreenLocked(bool is_locked) { | 105 void WindowManager::SetScreenLocked(bool is_locked) { |
| 79 // TODO: screen locked state needs to be persisted for newly added displays. | 106 // TODO: screen locked state needs to be persisted for newly added displays. |
| 80 for (auto& root_window_controller : root_window_controllers_) { | 107 for (auto& root_window_controller : root_window_controllers_) { |
| 81 WmWindowMus* non_lock_screen_containers_container = | 108 WmWindowMus* non_lock_screen_containers_container = |
| 82 root_window_controller->GetWindowByShellWindowId( | 109 root_window_controller->GetWindowByShellWindowId( |
| 83 kShellWindowId_NonLockScreenContainersContainer); | 110 kShellWindowId_NonLockScreenContainersContainer); |
| 84 non_lock_screen_containers_container->mus_window()->SetVisible(!is_locked); | 111 non_lock_screen_containers_container->mus_window()->SetVisible(!is_locked); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, | 296 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
| 270 OnAccelerator(id, event)); | 297 OnAccelerator(id, event)); |
| 271 break; | 298 break; |
| 272 } | 299 } |
| 273 | 300 |
| 274 return ui::mojom::EventResult::HANDLED; | 301 return ui::mojom::EventResult::HANDLED; |
| 275 } | 302 } |
| 276 | 303 |
| 277 } // namespace mus | 304 } // namespace mus |
| 278 } // namespace ash | 305 } // namespace ash |
| OLD | NEW |