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 COMPONENTS_MUS_EXAMPLE_WM_WINDOW_MANAGER_APPLICATION_H_ | 5 #ifndef COMPONENTS_MUS_EXAMPLE_WM_WINDOW_MANAGER_APPLICATION_H_ |
6 #define COMPONENTS_MUS_EXAMPLE_WM_WINDOW_MANAGER_APPLICATION_H_ | 6 #define COMPONENTS_MUS_EXAMPLE_WM_WINDOW_MANAGER_APPLICATION_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "components/mus/example/wm/public/interfaces/container.mojom.h" | 11 #include "components/mus/example/wm/public/interfaces/container.mojom.h" |
12 #include "components/mus/public/cpp/types.h" | 12 #include "components/mus/public/cpp/types.h" |
13 #include "components/mus/public/cpp/window_observer.h" | 13 #include "components/mus/public/cpp/window_observer.h" |
14 #include "components/mus/public/cpp/window_tree_delegate.h" | 14 #include "components/mus/public/cpp/window_tree_delegate.h" |
15 #include "components/mus/public/interfaces/window_manager.mojom.h" | 15 #include "components/mus/public/interfaces/window_manager.mojom.h" |
16 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 16 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
17 #include "mojo/application/public/cpp/application_delegate.h" | 17 #include "mojo/application/public/cpp/application_delegate.h" |
18 #include "mojo/application/public/cpp/interface_factory_impl.h" | 18 #include "mojo/application/public/cpp/interface_factory_impl.h" |
19 #include "mojo/common/weak_binding_set.h" | 19 #include "mojo/common/weak_binding_set.h" |
20 | 20 |
21 class BackgroundLayout; | 21 class BackgroundLayout; |
22 class ShelfLayout; | 22 class ShelfLayout; |
23 class WindowLayout; | 23 class WindowLayout; |
24 class WindowManagerImpl; | |
24 | 25 |
25 class WindowManagerImpl; | 26 namespace views { |
27 class AuraInit; | |
28 } | |
26 | 29 |
27 class WindowManagerApplication | 30 class WindowManagerApplication |
28 : public mojo::ApplicationDelegate, | 31 : public mojo::ApplicationDelegate, |
29 public mus::WindowObserver, | 32 public mus::WindowObserver, |
30 public mus::WindowTreeDelegate, | 33 public mus::WindowTreeDelegate, |
31 public mojo::InterfaceFactory<mus::mojom::WindowManager> { | 34 public mojo::InterfaceFactory<mus::mojom::WindowManager> { |
32 public: | 35 public: |
33 WindowManagerApplication(); | 36 WindowManagerApplication(); |
34 ~WindowManagerApplication() override; | 37 ~WindowManagerApplication() override; |
35 | 38 |
36 mus::Window* root() { return root_; } | 39 mus::Window* root() { return root_; } |
37 | 40 |
38 int window_count() { return window_count_; } | 41 int window_count() { return window_count_; } |
39 void IncrementWindowCount() { ++window_count_; } | 42 void IncrementWindowCount() { ++window_count_; } |
40 | 43 |
41 mus::Window* GetWindowForContainer(ash::mojom::Container container); | 44 mus::Window* GetWindowForContainer(ash::mojom::Container container); |
42 mus::Window* GetWindowById(mus::Id id); | 45 mus::Window* GetWindowById(mus::Id id); |
43 | 46 |
47 mojo::ApplicationImpl* app() { return app_; } | |
48 | |
44 private: | 49 private: |
45 // ApplicationDelegate: | 50 // ApplicationDelegate: |
46 void Initialize(mojo::ApplicationImpl* app) override; | 51 void Initialize(mojo::ApplicationImpl* app) override; |
47 bool ConfigureIncomingConnection( | 52 bool ConfigureIncomingConnection( |
48 mojo::ApplicationConnection* connection) override; | 53 mojo::ApplicationConnection* connection) override; |
49 | 54 |
50 // WindowTreeDelegate: | 55 // WindowTreeDelegate: |
51 void OnEmbed(mus::Window* root) override; | 56 void OnEmbed(mus::Window* root) override; |
52 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 57 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
53 | 58 |
54 // InterfaceFactory<mus::mojom::WindowManager>: | 59 // InterfaceFactory<mus::mojom::WindowManager>: |
55 void Create( | 60 void Create( |
56 mojo::ApplicationConnection* connection, | 61 mojo::ApplicationConnection* connection, |
57 mojo::InterfaceRequest<mus::mojom::WindowManager> request) override; | 62 mojo::InterfaceRequest<mus::mojom::WindowManager> request) override; |
58 | 63 |
59 // mus::WindowObserver: | 64 // mus::WindowObserver: |
60 void OnWindowDestroyed(mus::Window* window) override; | 65 void OnWindowDestroyed(mus::Window* window) override; |
61 | 66 |
62 // Sets up the window containers used for z-space management. | 67 // Sets up the window containers used for z-space management. |
63 void CreateContainers(); | 68 void CreateContainers(); |
64 | 69 |
65 // nullptr until the Mus connection is established via OnEmbed(). | 70 // nullptr until the Mus connection is established via OnEmbed(). |
66 mus::Window* root_; | 71 mus::Window* root_; |
67 int window_count_; | 72 int window_count_; |
68 | 73 |
74 mojo::ApplicationImpl* app_; | |
75 | |
69 mus::mojom::WindowTreeHostPtr host_; | 76 mus::mojom::WindowTreeHostPtr host_; |
70 | 77 |
78 scoped_ptr<views::AuraInit> aura_init_; | |
Ben Goodger (Google)
2015/11/04 23:03:21
you'll have to merge my other change.
sky
2015/11/05 00:18:02
Done.
| |
79 | |
71 // |window_manager_| is created once OnEmbed() is called. Until that time | 80 // |window_manager_| is created once OnEmbed() is called. Until that time |
72 // |requests_| stores any pending WindowManager interface requests. | 81 // |requests_| stores any pending WindowManager interface requests. |
73 scoped_ptr<WindowManagerImpl> window_manager_; | 82 scoped_ptr<WindowManagerImpl> window_manager_; |
74 mojo::WeakBindingSet<mus::mojom::WindowManager> window_manager_binding_; | 83 mojo::WeakBindingSet<mus::mojom::WindowManager> window_manager_binding_; |
75 ScopedVector<mojo::InterfaceRequest<mus::mojom::WindowManager>> requests_; | 84 ScopedVector<mojo::InterfaceRequest<mus::mojom::WindowManager>> requests_; |
76 | 85 |
77 scoped_ptr<BackgroundLayout> background_layout_; | 86 scoped_ptr<BackgroundLayout> background_layout_; |
78 scoped_ptr<ShelfLayout> shelf_layout_; | 87 scoped_ptr<ShelfLayout> shelf_layout_; |
79 scoped_ptr<WindowLayout> window_layout_; | 88 scoped_ptr<WindowLayout> window_layout_; |
80 | 89 |
81 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 90 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
82 }; | 91 }; |
83 | 92 |
84 #endif // COMPONENTS_MUS_EXAMPLE_WM_WINDOW_MANAGER_APPLICATION_H_ | 93 #endif // COMPONENTS_MUS_EXAMPLE_WM_WINDOW_MANAGER_APPLICATION_H_ |
OLD | NEW |