| 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 MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 5 #ifndef MASH_WM_WINDOW_MANAGER_APPLICATION_H_ |
| 6 #define MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 6 #define MASH_WM_WINDOW_MANAGER_APPLICATION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | |
| 15 #include "components/mus/common/types.h" | 14 #include "components/mus/common/types.h" |
| 16 #include "components/mus/public/cpp/window_observer.h" | 15 #include "components/mus/public/cpp/window_observer.h" |
| 17 #include "components/mus/public/cpp/window_tree_delegate.h" | 16 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 18 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" | 17 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" |
| 19 #include "components/mus/public/interfaces/window_manager.mojom.h" | 18 #include "components/mus/public/interfaces/window_manager.mojom.h" |
| 20 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 19 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 21 #include "mash/wm/public/interfaces/container.mojom.h" | 20 #include "mash/wm/public/interfaces/container.mojom.h" |
| 21 #include "mash/wm/public/interfaces/user_window_controller.mojom.h" |
| 22 #include "mojo/common/weak_binding_set.h" | 22 #include "mojo/common/weak_binding_set.h" |
| 23 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 23 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
| 24 #include "mojo/shell/public/cpp/application_delegate.h" | 24 #include "mojo/shell/public/cpp/application_delegate.h" |
| 25 #include "mojo/shell/public/cpp/interface_factory_impl.h" | 25 #include "mojo/shell/public/cpp/interface_factory_impl.h" |
| 26 | 26 |
| 27 namespace ui { | 27 namespace ui { |
| 28 namespace mojo { | 28 namespace mojo { |
| 29 class UIInit; | 29 class UIInit; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace views { | 33 namespace views { |
| 34 class AuraInit; | 34 class AuraInit; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace mash { | 37 namespace mash { |
| 38 namespace wm { | 38 namespace wm { |
| 39 | 39 |
| 40 class AcceleratorRegistrarImpl; | 40 class AcceleratorRegistrarImpl; |
| 41 class BackgroundLayout; | 41 class BackgroundLayout; |
| 42 class ShadowController; | 42 class ShadowController; |
| 43 class ShelfLayout; | 43 class ShelfLayout; |
| 44 class UserWindowControllerImpl; |
| 44 class WindowLayout; | 45 class WindowLayout; |
| 45 class WindowManagerImpl; | 46 class WindowManagerImpl; |
| 46 | 47 |
| 47 class WindowManagerApplication | 48 class WindowManagerApplication |
| 48 : public mojo::ApplicationDelegate, | 49 : public mojo::ApplicationDelegate, |
| 49 public mus::WindowObserver, | 50 public mus::WindowObserver, |
| 50 public mus::mojom::WindowTreeHostClient, | 51 public mus::mojom::WindowTreeHostClient, |
| 51 public mus::WindowTreeDelegate, | 52 public mus::WindowTreeDelegate, |
| 53 public mojo::InterfaceFactory<mash::wm::mojom::UserWindowController>, |
| 52 public mojo::InterfaceFactory<mus::mojom::WindowManager>, | 54 public mojo::InterfaceFactory<mus::mojom::WindowManager>, |
| 53 public mojo::InterfaceFactory<mus::mojom::AcceleratorRegistrar> { | 55 public mojo::InterfaceFactory<mus::mojom::AcceleratorRegistrar> { |
| 54 public: | 56 public: |
| 55 WindowManagerApplication(); | 57 WindowManagerApplication(); |
| 56 ~WindowManagerApplication() override; | 58 ~WindowManagerApplication() override; |
| 57 | 59 |
| 58 mus::Window* root() { return root_; } | 60 mus::Window* root() { return root_; } |
| 59 | 61 |
| 60 int window_count() { return window_count_; } | 62 int window_count() { return window_count_; } |
| 61 void IncrementWindowCount() { ++window_count_; } | 63 void IncrementWindowCount() { ++window_count_; } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 79 bool ConfigureIncomingConnection( | 81 bool ConfigureIncomingConnection( |
| 80 mojo::ApplicationConnection* connection) override; | 82 mojo::ApplicationConnection* connection) override; |
| 81 | 83 |
| 82 // WindowTreeHostClient: | 84 // WindowTreeHostClient: |
| 83 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event) override; | 85 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event) override; |
| 84 | 86 |
| 85 // WindowTreeDelegate: | 87 // WindowTreeDelegate: |
| 86 void OnEmbed(mus::Window* root) override; | 88 void OnEmbed(mus::Window* root) override; |
| 87 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 89 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
| 88 | 90 |
| 91 // InterfaceFactory<mash::wm::mojom::UserWindowController>: |
| 92 void Create(mojo::ApplicationConnection* connection, |
| 93 mojo::InterfaceRequest<mash::wm::mojom::UserWindowController> |
| 94 request) override; |
| 95 |
| 89 // InterfaceFactory<mus::mojom::AcceleratorRegistrar>: | 96 // InterfaceFactory<mus::mojom::AcceleratorRegistrar>: |
| 90 void Create(mojo::ApplicationConnection* connection, | 97 void Create(mojo::ApplicationConnection* connection, |
| 91 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) | 98 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) |
| 92 override; | 99 override; |
| 93 | 100 |
| 94 // InterfaceFactory<mus::mojom::WindowManager>: | 101 // InterfaceFactory<mus::mojom::WindowManager>: |
| 95 void Create( | 102 void Create( |
| 96 mojo::ApplicationConnection* connection, | 103 mojo::ApplicationConnection* connection, |
| 97 mojo::InterfaceRequest<mus::mojom::WindowManager> request) override; | 104 mojo::InterfaceRequest<mus::mojom::WindowManager> request) override; |
| 98 | 105 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 113 mus::mojom::WindowTreeHostPtr window_tree_host_; | 120 mus::mojom::WindowTreeHostPtr window_tree_host_; |
| 114 mojo::Binding<mus::mojom::WindowTreeHostClient> host_client_binding_; | 121 mojo::Binding<mus::mojom::WindowTreeHostClient> host_client_binding_; |
| 115 | 122 |
| 116 scoped_ptr<ui::mojo::UIInit> ui_init_; | 123 scoped_ptr<ui::mojo::UIInit> ui_init_; |
| 117 scoped_ptr<views::AuraInit> aura_init_; | 124 scoped_ptr<views::AuraInit> aura_init_; |
| 118 | 125 |
| 119 // |window_manager_| is created once OnEmbed() is called. Until that time | 126 // |window_manager_| is created once OnEmbed() is called. Until that time |
| 120 // |requests_| stores any pending WindowManager interface requests. | 127 // |requests_| stores any pending WindowManager interface requests. |
| 121 scoped_ptr<WindowManagerImpl> window_manager_; | 128 scoped_ptr<WindowManagerImpl> window_manager_; |
| 122 mojo::WeakBindingSet<mus::mojom::WindowManager> window_manager_binding_; | 129 mojo::WeakBindingSet<mus::mojom::WindowManager> window_manager_binding_; |
| 123 ScopedVector<mojo::InterfaceRequest<mus::mojom::WindowManager>> requests_; | 130 std::vector<scoped_ptr<mojo::InterfaceRequest<mus::mojom::WindowManager>>> |
| 131 requests_; |
| 132 |
| 133 // |user_window_controller_| is created once OnEmbed() is called. Until that |
| 134 // time |user_window_controller_requests_| stores pending interface requests. |
| 135 scoped_ptr<UserWindowControllerImpl> user_window_controller_; |
| 136 mojo::WeakBindingSet<mash::wm::mojom::UserWindowController> |
| 137 user_window_controller_binding_; |
| 138 std::vector< |
| 139 scoped_ptr<mojo::InterfaceRequest<mash::wm::mojom::UserWindowController>>> |
| 140 user_window_controller_requests_; |
| 124 | 141 |
| 125 scoped_ptr<BackgroundLayout> background_layout_; | 142 scoped_ptr<BackgroundLayout> background_layout_; |
| 126 scoped_ptr<ShelfLayout> shelf_layout_; | 143 scoped_ptr<ShelfLayout> shelf_layout_; |
| 127 scoped_ptr<WindowLayout> window_layout_; | 144 scoped_ptr<WindowLayout> window_layout_; |
| 128 | 145 |
| 129 scoped_ptr<ShadowController> shadow_controller_; | 146 scoped_ptr<ShadowController> shadow_controller_; |
| 130 | 147 |
| 131 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; | 148 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; |
| 132 | 149 |
| 133 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 150 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
| 134 }; | 151 }; |
| 135 | 152 |
| 136 } // namespace wm | 153 } // namespace wm |
| 137 } // namespace mash | 154 } // namespace mash |
| 138 | 155 |
| 139 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 156 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_ |
| OLD | NEW |