Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: mash/wm/window_manager_application.h

Issue 1488713002: mus: Introduce AcceleratorRegistrar and AcceleratorHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot.merge Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mash/wm/accelerator_registrar_impl.cc ('k') | mash/wm/window_manager_application.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <set>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
11 #include "components/mus/common/types.h" 13 #include "components/mus/common/types.h"
12 #include "components/mus/public/cpp/window_observer.h" 14 #include "components/mus/public/cpp/window_observer.h"
13 #include "components/mus/public/cpp/window_tree_delegate.h" 15 #include "components/mus/public/cpp/window_tree_delegate.h"
16 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h"
14 #include "components/mus/public/interfaces/window_manager.mojom.h" 17 #include "components/mus/public/interfaces/window_manager.mojom.h"
15 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 18 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
16 #include "mash/wm/public/interfaces/container.mojom.h" 19 #include "mash/wm/public/interfaces/container.mojom.h"
17 #include "mojo/application/public/cpp/application_delegate.h" 20 #include "mojo/application/public/cpp/application_delegate.h"
18 #include "mojo/application/public/cpp/interface_factory_impl.h" 21 #include "mojo/application/public/cpp/interface_factory_impl.h"
19 #include "mojo/common/weak_binding_set.h" 22 #include "mojo/common/weak_binding_set.h"
20 #include "mojo/services/tracing/public/cpp/tracing_impl.h" 23 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
21 24
22 namespace ui { 25 namespace ui {
23 namespace mojo { 26 namespace mojo {
24 class UIInit; 27 class UIInit;
25 } 28 }
26 } 29 }
27 30
28 namespace views { 31 namespace views {
29 class AuraInit; 32 class AuraInit;
30 } 33 }
31 34
32 namespace mash { 35 namespace mash {
33 namespace wm { 36 namespace wm {
34 37
38 class AcceleratorRegistrarImpl;
35 class BackgroundLayout; 39 class BackgroundLayout;
36 class ShelfLayout; 40 class ShelfLayout;
37 class WindowLayout; 41 class WindowLayout;
38 class WindowManagerImpl; 42 class WindowManagerImpl;
39 43
40 class WindowManagerApplication 44 class WindowManagerApplication
41 : public mojo::ApplicationDelegate, 45 : public mojo::ApplicationDelegate,
42 public mus::WindowObserver, 46 public mus::WindowObserver,
43 public mus::mojom::WindowTreeHostClient, 47 public mus::mojom::WindowTreeHostClient,
44 public mus::WindowTreeDelegate, 48 public mus::WindowTreeDelegate,
45 public mojo::InterfaceFactory<mus::mojom::WindowManager> { 49 public mojo::InterfaceFactory<mus::mojom::WindowManager>,
50 public mojo::InterfaceFactory<mus::mojom::AcceleratorRegistrar> {
46 public: 51 public:
47 WindowManagerApplication(); 52 WindowManagerApplication();
48 ~WindowManagerApplication() override; 53 ~WindowManagerApplication() override;
49 54
50 mus::Window* root() { return root_; } 55 mus::Window* root() { return root_; }
51 56
52 int window_count() { return window_count_; } 57 int window_count() { return window_count_; }
53 void IncrementWindowCount() { ++window_count_; } 58 void IncrementWindowCount() { ++window_count_; }
54 59
55 mus::Window* GetWindowForContainer(mojom::Container container); 60 mus::Window* GetWindowForContainer(mojom::Container container);
56 mus::Window* GetWindowById(mus::Id id); 61 mus::Window* GetWindowById(mus::Id id);
57 bool WindowIsContainer(const mus::Window* window) const; 62 bool WindowIsContainer(const mus::Window* window) const;
58 63
59 mojo::ApplicationImpl* app() { return app_; } 64 mojo::ApplicationImpl* app() { return app_; }
60 65
61 mus::mojom::WindowTreeHost* window_tree_host() { 66 mus::mojom::WindowTreeHost* window_tree_host() {
62 return window_tree_host_.get(); 67 return window_tree_host_.get();
63 } 68 }
64 69
65 private: 70 private:
66 void AddAccelerators(); 71 void AddAccelerators();
72 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar);
67 73
68 // ApplicationDelegate: 74 // ApplicationDelegate:
69 void Initialize(mojo::ApplicationImpl* app) override; 75 void Initialize(mojo::ApplicationImpl* app) override;
70 bool ConfigureIncomingConnection( 76 bool ConfigureIncomingConnection(
71 mojo::ApplicationConnection* connection) override; 77 mojo::ApplicationConnection* connection) override;
72 78
73 // WindowTreeHostClient: 79 // WindowTreeHostClient:
74 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event) override; 80 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event) override;
75 81
76 // WindowTreeDelegate: 82 // WindowTreeDelegate:
77 void OnEmbed(mus::Window* root) override; 83 void OnEmbed(mus::Window* root) override;
78 void OnConnectionLost(mus::WindowTreeConnection* connection) override; 84 void OnConnectionLost(mus::WindowTreeConnection* connection) override;
79 85
86 // InterfaceFactory<mus::mojom::AcceleratorRegistrar>:
87 void Create(mojo::ApplicationConnection* connection,
88 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request)
89 override;
90
80 // InterfaceFactory<mus::mojom::WindowManager>: 91 // InterfaceFactory<mus::mojom::WindowManager>:
81 void Create( 92 void Create(
82 mojo::ApplicationConnection* connection, 93 mojo::ApplicationConnection* connection,
83 mojo::InterfaceRequest<mus::mojom::WindowManager> request) override; 94 mojo::InterfaceRequest<mus::mojom::WindowManager> request) override;
84 95
85 // mus::WindowObserver: 96 // mus::WindowObserver:
86 void OnWindowDestroyed(mus::Window* window) override; 97 void OnWindowDestroyed(mus::Window* window) override;
87 98
88 // Sets up the window containers used for z-space management. 99 // Sets up the window containers used for z-space management.
89 void CreateContainers(); 100 void CreateContainers();
(...skipping 15 matching lines...) Expand all
105 // |window_manager_| is created once OnEmbed() is called. Until that time 116 // |window_manager_| is created once OnEmbed() is called. Until that time
106 // |requests_| stores any pending WindowManager interface requests. 117 // |requests_| stores any pending WindowManager interface requests.
107 scoped_ptr<WindowManagerImpl> window_manager_; 118 scoped_ptr<WindowManagerImpl> window_manager_;
108 mojo::WeakBindingSet<mus::mojom::WindowManager> window_manager_binding_; 119 mojo::WeakBindingSet<mus::mojom::WindowManager> window_manager_binding_;
109 ScopedVector<mojo::InterfaceRequest<mus::mojom::WindowManager>> requests_; 120 ScopedVector<mojo::InterfaceRequest<mus::mojom::WindowManager>> requests_;
110 121
111 scoped_ptr<BackgroundLayout> background_layout_; 122 scoped_ptr<BackgroundLayout> background_layout_;
112 scoped_ptr<ShelfLayout> shelf_layout_; 123 scoped_ptr<ShelfLayout> shelf_layout_;
113 scoped_ptr<WindowLayout> window_layout_; 124 scoped_ptr<WindowLayout> window_layout_;
114 125
126 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_;
127
115 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); 128 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication);
116 }; 129 };
117 130
118 } // namespace wm 131 } // namespace wm
119 } // namespace mash 132 } // namespace mash
120 133
121 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_ 134 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_
OLDNEW
« no previous file with comments | « mash/wm/accelerator_registrar_impl.cc ('k') | mash/wm/window_manager_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698