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

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

Issue 1994763002: Wires up WorkspaceLayoutManager in mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: data deps Created 4 years, 7 months 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/window_manager.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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "components/mus/common/types.h" 15 #include "components/mus/common/types.h"
16 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" 16 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h"
17 #include "components/mus/public/interfaces/window_manager.mojom.h" 17 #include "components/mus/public/interfaces/window_manager.mojom.h"
18 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" 18 #include "components/mus/public/interfaces/window_manager_factory.mojom.h"
19 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 19 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
20 #include "mash/session/public/interfaces/session.mojom.h" 20 #include "mash/session/public/interfaces/session.mojom.h"
21 #include "mash/wm/public/interfaces/shelf_layout.mojom.h" 21 #include "mash/wm/public/interfaces/shelf_layout.mojom.h"
22 #include "mash/wm/public/interfaces/user_window_controller.mojom.h" 22 #include "mash/wm/public/interfaces/user_window_controller.mojom.h"
23 #include "mojo/public/cpp/bindings/binding.h" 23 #include "mojo/public/cpp/bindings/binding.h"
24 #include "mojo/public/cpp/bindings/binding_set.h" 24 #include "mojo/public/cpp/bindings/binding_set.h"
25 #include "services/shell/public/cpp/shell_client.h" 25 #include "services/shell/public/cpp/shell_client.h"
26 #include "services/tracing/public/cpp/tracing_impl.h" 26 #include "services/tracing/public/cpp/tracing_impl.h"
27 27
28 namespace display {
29 class Screen;
30 }
31
28 namespace views { 32 namespace views {
29 class AuraInit; 33 class AuraInit;
30 class ScreenMus;
31 } 34 }
32 35
33 namespace ui { 36 namespace ui {
34 class Event; 37 class Event;
35 } 38 }
36 39
37 namespace mash { 40 namespace mash {
38 namespace wm { 41 namespace wm {
39 42
40 class AcceleratorRegistrarImpl; 43 class AcceleratorRegistrarImpl;
41 class RootWindowController; 44 class RootWindowController;
42 class RootWindowsObserver; 45 class RootWindowsObserver;
43 class ShelfLayoutImpl; 46 class ShelfLayoutImpl;
44 class UserWindowControllerImpl; 47 class UserWindowControllerImpl;
48 class WmGlobalsMus;
49 class WmLookupMus;
50 class WmScreen;
45 51
46 class WindowManagerApplication 52 class WindowManagerApplication
47 : public shell::ShellClient, 53 : public shell::ShellClient,
48 public mus::mojom::WindowManagerFactory, 54 public mus::mojom::WindowManagerFactory,
49 public shell::InterfaceFactory<mojom::ShelfLayout>, 55 public shell::InterfaceFactory<mojom::ShelfLayout>,
50 public shell::InterfaceFactory<mojom::UserWindowController>, 56 public shell::InterfaceFactory<mojom::UserWindowController>,
51 public shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar> { 57 public shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar> {
52 public: 58 public:
53 WindowManagerApplication(); 59 WindowManagerApplication();
54 ~WindowManagerApplication() override; 60 ~WindowManagerApplication() override;
55 61
56 shell::Connector* connector() { return connector_; } 62 shell::Connector* connector() { return connector_; }
57 63
58 // Returns the RootWindowControllers that have valid roots. 64 // Returns the RootWindowControllers that have valid roots.
59 // 65 //
60 // NOTE: this does not return |controllers_| as most clients want a 66 // NOTE: this does not return |controllers_| as most clients want a
61 // RootWindowController that has a valid root window. 67 // RootWindowController that has a valid root window.
62 std::set<RootWindowController*> GetRootControllers(); 68 std::set<RootWindowController*> GetRootControllers();
63 69
70 WmGlobalsMus* globals() { return globals_.get(); }
71
64 // Called when the root window of |root_controller| is obtained. 72 // Called when the root window of |root_controller| is obtained.
65 void OnRootWindowControllerGotRoot(RootWindowController* root_controller); 73 void OnRootWindowControllerGotRoot(RootWindowController* root_controller);
66 74
67 // Called after RootWindowController creates the necessary resources. 75 // Called after RootWindowController creates the necessary resources.
68 void OnRootWindowControllerDoneInit(RootWindowController* root_controller); 76 void OnRootWindowControllerDoneInit(RootWindowController* root_controller);
69 77
70 // Called when the root mus::Window of RootWindowController is destroyed. 78 // Called when the root mus::Window of RootWindowController is destroyed.
71 // |root_controller| is destroyed after this call. 79 // |root_controller| is destroyed after this call.
72 void OnRootWindowDestroyed(RootWindowController* root_controller); 80 void OnRootWindowDestroyed(RootWindowController* root_controller);
73 81
74 // TODO(sky): figure out right place for this code. 82 // TODO(sky): figure out right place for this code.
75 void OnAccelerator(uint32_t id, const ui::Event& event); 83 void OnAccelerator(uint32_t id, const ui::Event& event);
76 84
77 void AddRootWindowsObserver(RootWindowsObserver* observer); 85 void AddRootWindowsObserver(RootWindowsObserver* observer);
78 void RemoveRootWindowsObserver(RootWindowsObserver* observer); 86 void RemoveRootWindowsObserver(RootWindowsObserver* observer);
79 87
80 session::mojom::Session* session() { 88 session::mojom::Session* session() {
81 return session_.get(); 89 return session_.get();
82 } 90 }
83 91
84 private: 92 private:
93 friend class WmTestBase;
94 friend class WmTestHelper;
95
85 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); 96 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar);
86 97
98 // Adds |root_window_controller| to the set of known roots.
99 void AddRootWindowController(RootWindowController* root_window_controller);
100
87 // shell::ShellClient: 101 // shell::ShellClient:
88 void Initialize(shell::Connector* connector, 102 void Initialize(shell::Connector* connector,
89 const shell::Identity& identity, 103 const shell::Identity& identity,
90 uint32_t id) override; 104 uint32_t id) override;
91 bool AcceptConnection(shell::Connection* connection) override; 105 bool AcceptConnection(shell::Connection* connection) override;
92 106
93 // shell::InterfaceFactory<mojom::ShelfLayout>: 107 // shell::InterfaceFactory<mojom::ShelfLayout>:
94 void Create(shell::Connection* connection, 108 void Create(shell::Connection* connection,
95 mojo::InterfaceRequest<mojom::ShelfLayout> request) override; 109 mojo::InterfaceRequest<mojom::ShelfLayout> request) override;
96 110
97 // shell::InterfaceFactory<mojom::UserWindowController>: 111 // shell::InterfaceFactory<mojom::UserWindowController>:
98 void Create( 112 void Create(
99 shell::Connection* connection, 113 shell::Connection* connection,
100 mojo::InterfaceRequest<mojom::UserWindowController> request) override; 114 mojo::InterfaceRequest<mojom::UserWindowController> request) override;
101 115
102 // shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar>: 116 // shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar>:
103 void Create(shell::Connection* connection, 117 void Create(shell::Connection* connection,
104 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) 118 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request)
105 override; 119 override;
106 120
107 // mus::mojom::WindowManagerFactory: 121 // mus::mojom::WindowManagerFactory:
108 void CreateWindowManager(mus::mojom::DisplayPtr display, 122 void CreateWindowManager(mus::mojom::DisplayPtr display,
109 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> 123 mojo::InterfaceRequest<mus::mojom::WindowTreeClient>
110 client_request) override; 124 client_request) override;
111 125
112 shell::Connector* connector_; 126 shell::Connector* connector_;
113 127
114 mojo::TracingImpl tracing_; 128 mojo::TracingImpl tracing_;
115 129
116 std::unique_ptr<views::ScreenMus> screen_; 130 std::unique_ptr<display::Screen> screen_;
117 std::unique_ptr<views::AuraInit> aura_init_; 131 std::unique_ptr<views::AuraInit> aura_init_;
118 132
133 std::unique_ptr<WmGlobalsMus> globals_;
134 std::unique_ptr<WmLookupMus> lookup_;
135
119 // The |shelf_layout_| object is created once OnEmbed() is called. Until that 136 // The |shelf_layout_| object is created once OnEmbed() is called. Until that
120 // time |shelf_layout_requests_| stores pending interface requests. 137 // time |shelf_layout_requests_| stores pending interface requests.
121 std::unique_ptr<ShelfLayoutImpl> shelf_layout_; 138 std::unique_ptr<ShelfLayoutImpl> shelf_layout_;
122 mojo::BindingSet<mojom::ShelfLayout> shelf_layout_bindings_; 139 mojo::BindingSet<mojom::ShelfLayout> shelf_layout_bindings_;
123 std::vector<std::unique_ptr<mojo::InterfaceRequest<mojom::ShelfLayout>>> 140 std::vector<std::unique_ptr<mojo::InterfaceRequest<mojom::ShelfLayout>>>
124 shelf_layout_requests_; 141 shelf_layout_requests_;
125 142
126 // |user_window_controller_| is created once OnEmbed() is called. Until that 143 // |user_window_controller_| is created once OnEmbed() is called. Until that
127 // time |user_window_controller_requests_| stores pending interface requests. 144 // time |user_window_controller_requests_| stores pending interface requests.
128 std::unique_ptr<UserWindowControllerImpl> user_window_controller_; 145 std::unique_ptr<UserWindowControllerImpl> user_window_controller_;
(...skipping 13 matching lines...) Expand all
142 159
143 base::ObserverList<RootWindowsObserver> root_windows_observers_; 160 base::ObserverList<RootWindowsObserver> root_windows_observers_;
144 161
145 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); 162 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication);
146 }; 163 };
147 164
148 } // namespace wm 165 } // namespace wm
149 } // namespace mash 166 } // namespace mash
150 167
151 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_ 168 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_
OLDNEW
« no previous file with comments | « mash/wm/window_manager.cc ('k') | mash/wm/window_manager_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698