| 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 #ifndef ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 5 #ifndef ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
| 6 #define ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 6 #define ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "ash/mus/window_manager_observer.h" | |
| 14 #include "ash/public/interfaces/shelf_layout.mojom.h" | |
| 15 #include "ash/public/interfaces/user_window_controller.mojom.h" | |
| 16 #include "base/macros.h" | 13 #include "base/macros.h" |
| 17 #include "mash/session/public/interfaces/session.mojom.h" | 14 #include "mash/session/public/interfaces/session.mojom.h" |
| 18 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 19 #include "mojo/public/cpp/bindings/binding_set.h" | 16 #include "mojo/public/cpp/bindings/binding_set.h" |
| 20 #include "services/shell/public/cpp/service.h" | 17 #include "services/shell/public/cpp/service.h" |
| 21 #include "services/tracing/public/cpp/provider.h" | 18 #include "services/tracing/public/cpp/provider.h" |
| 22 #include "services/ui/common/types.h" | 19 #include "services/ui/common/types.h" |
| 23 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h" | 20 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h" |
| 24 | 21 |
| 25 namespace views { | 22 namespace views { |
| 26 class AuraInit; | 23 class AuraInit; |
| 27 } | 24 } |
| 28 | 25 |
| 29 namespace ui { | 26 namespace ui { |
| 30 class Event; | 27 class Event; |
| 31 class GpuService; | 28 class GpuService; |
| 32 class WindowTreeClient; | 29 class WindowTreeClient; |
| 33 } | 30 } |
| 34 | 31 |
| 35 namespace ash { | 32 namespace ash { |
| 36 namespace mus { | 33 namespace mus { |
| 37 | 34 |
| 38 class AcceleratorRegistrarImpl; | 35 class AcceleratorRegistrarImpl; |
| 39 class RootWindowController; | |
| 40 class ShelfLayoutImpl; | |
| 41 class UserWindowControllerImpl; | |
| 42 class WindowManager; | 36 class WindowManager; |
| 43 | 37 |
| 38 // Hosts the window manager and the ash system user interface for mash. |
| 39 // TODO(mash): Port ash_sysui's ShelfController and WallpaperController here. |
| 44 class WindowManagerApplication | 40 class WindowManagerApplication |
| 45 : public shell::Service, | 41 : public shell::Service, |
| 46 public shell::InterfaceFactory<mojom::ShelfLayout>, | |
| 47 public shell::InterfaceFactory<mojom::UserWindowController>, | |
| 48 public shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>, | 42 public shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>, |
| 49 public mash::session::mojom::ScreenlockStateListener, | 43 public mash::session::mojom::ScreenlockStateListener { |
| 50 public WindowManagerObserver { | |
| 51 public: | 44 public: |
| 52 WindowManagerApplication(); | 45 WindowManagerApplication(); |
| 53 ~WindowManagerApplication() override; | 46 ~WindowManagerApplication() override; |
| 54 | 47 |
| 55 WindowManager* window_manager() { return window_manager_.get(); } | 48 WindowManager* window_manager() { return window_manager_.get(); } |
| 56 | 49 |
| 57 mash::session::mojom::Session* session() { return session_.get(); } | 50 mash::session::mojom::Session* session() { return session_.get(); } |
| 58 | 51 |
| 59 private: | 52 private: |
| 60 friend class WmTestBase; | 53 friend class WmTestBase; |
| 61 friend class WmTestHelper; | 54 friend class WmTestHelper; |
| 62 | 55 |
| 63 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); | 56 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); |
| 64 | 57 |
| 65 void InitWindowManager(ui::WindowTreeClient* window_tree_client); | 58 void InitWindowManager(ui::WindowTreeClient* window_tree_client); |
| 66 | 59 |
| 67 // shell::Service: | 60 // shell::Service: |
| 68 void OnStart(const shell::Identity& identity) override; | 61 void OnStart(const shell::Identity& identity) override; |
| 69 bool OnConnect(const shell::Identity& remote_identity, | 62 bool OnConnect(const shell::Identity& remote_identity, |
| 70 shell::InterfaceRegistry* registry) override; | 63 shell::InterfaceRegistry* registry) override; |
| 71 | 64 |
| 72 // shell::InterfaceFactory<mojom::ShelfLayout>: | |
| 73 void Create(const shell::Identity& remote_identity, | |
| 74 mojo::InterfaceRequest<mojom::ShelfLayout> request) override; | |
| 75 | |
| 76 // shell::InterfaceFactory<mojom::UserWindowController>: | |
| 77 void Create( | |
| 78 const shell::Identity& remote_identity, | |
| 79 mojo::InterfaceRequest<mojom::UserWindowController> request) override; | |
| 80 | |
| 81 // shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>: | 65 // shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>: |
| 82 void Create( | 66 void Create( |
| 83 const shell::Identity& remote_identity, | 67 const shell::Identity& remote_identity, |
| 84 mojo::InterfaceRequest<ui::mojom::AcceleratorRegistrar> request) override; | 68 mojo::InterfaceRequest<ui::mojom::AcceleratorRegistrar> request) override; |
| 85 | 69 |
| 86 // session::mojom::ScreenlockStateListener: | 70 // session::mojom::ScreenlockStateListener: |
| 87 void ScreenlockStateChanged(bool locked) override; | 71 void ScreenlockStateChanged(bool locked) override; |
| 88 | 72 |
| 89 // WindowManagerObserver: | |
| 90 void OnRootWindowControllerAdded(RootWindowController* controller) override; | |
| 91 void OnWillDestroyRootWindowController( | |
| 92 RootWindowController* controller) override; | |
| 93 | |
| 94 tracing::Provider tracing_; | 73 tracing::Provider tracing_; |
| 95 | 74 |
| 96 std::unique_ptr<views::AuraInit> aura_init_; | 75 std::unique_ptr<views::AuraInit> aura_init_; |
| 97 | 76 |
| 98 // The |shelf_layout_| object is created once OnEmbed() is called. Until that | |
| 99 // time |shelf_layout_requests_| stores pending interface requests. | |
| 100 std::unique_ptr<ShelfLayoutImpl> shelf_layout_; | |
| 101 mojo::BindingSet<mojom::ShelfLayout> shelf_layout_bindings_; | |
| 102 std::vector<mojo::InterfaceRequest<mojom::ShelfLayout>> | |
| 103 shelf_layout_requests_; | |
| 104 | |
| 105 // |user_window_controller_| is created once OnEmbed() is called. Until that | |
| 106 // time |user_window_controller_requests_| stores pending interface requests. | |
| 107 std::unique_ptr<UserWindowControllerImpl> user_window_controller_; | |
| 108 mojo::BindingSet<mojom::UserWindowController> | |
| 109 user_window_controller_bindings_; | |
| 110 std::vector<mojo::InterfaceRequest<mojom::UserWindowController>> | |
| 111 user_window_controller_requests_; | |
| 112 | |
| 113 std::unique_ptr<ui::GpuService> gpu_service_; | 77 std::unique_ptr<ui::GpuService> gpu_service_; |
| 114 std::unique_ptr<WindowManager> window_manager_; | 78 std::unique_ptr<WindowManager> window_manager_; |
| 115 | 79 |
| 116 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; | 80 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; |
| 117 | 81 |
| 118 mash::session::mojom::SessionPtr session_; | 82 mash::session::mojom::SessionPtr session_; |
| 119 | 83 |
| 120 mojo::Binding<mash::session::mojom::ScreenlockStateListener> | 84 mojo::Binding<mash::session::mojom::ScreenlockStateListener> |
| 121 screenlock_state_listener_binding_; | 85 screenlock_state_listener_binding_; |
| 122 | 86 |
| 123 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 87 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
| 124 }; | 88 }; |
| 125 | 89 |
| 126 } // namespace mus | 90 } // namespace mus |
| 127 } // namespace ash | 91 } // namespace ash |
| 128 | 92 |
| 129 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ | 93 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
| OLD | NEW |