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

Side by Side Diff: components/mus/mus_app.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 | « components/mus/manifest.json ('k') | components/mus/mus_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_MUS_MUS_APP_H_
6 #define COMPONENTS_MUS_MUS_APP_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <memory>
12 #include <string>
13 #include <vector>
14
15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h"
17 #include "components/mus/input_devices/input_device_server.h"
18 #include "components/mus/public/interfaces/clipboard.mojom.h"
19 #include "components/mus/public/interfaces/display.mojom.h"
20 #include "components/mus/public/interfaces/gpu.mojom.h"
21 #include "components/mus/public/interfaces/gpu_service.mojom.h"
22 #include "components/mus/public/interfaces/user_access_manager.mojom.h"
23 #include "components/mus/public/interfaces/user_activity_monitor.mojom.h"
24 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo jom.h"
25 #include "components/mus/public/interfaces/window_server_test.mojom.h"
26 #include "components/mus/public/interfaces/window_tree.mojom.h"
27 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
28 #include "components/mus/ws/platform_display_init_params.h"
29 #include "components/mus/ws/touch_controller.h"
30 #include "components/mus/ws/user_id.h"
31 #include "components/mus/ws/window_server_delegate.h"
32 #include "services/shell/public/cpp/application_runner.h"
33 #include "services/shell/public/cpp/interface_factory.h"
34 #include "services/shell/public/cpp/shell_client.h"
35 #include "services/tracing/public/cpp/tracing_impl.h"
36
37 #if defined(USE_OZONE)
38 #include "ui/ozone/public/client_native_pixmap_factory.h"
39 #endif
40
41 namespace gfx {
42 class Rect;
43 }
44
45 namespace shell {
46 class Connector;
47 }
48
49 namespace ui {
50 class PlatformEventSource;
51 }
52
53 namespace mus {
54 namespace ws {
55 class ForwardingWindowManager;
56 class PlatformScreen;
57 class WindowServer;
58 }
59
60 class MusApp
61 : public shell::ShellClient,
62 public ws::WindowServerDelegate,
63 public shell::InterfaceFactory<mojom::Clipboard>,
64 public shell::InterfaceFactory<mojom::DisplayManager>,
65 public shell::InterfaceFactory<mojom::Gpu>,
66 public shell::InterfaceFactory<mojom::GpuService>,
67 public shell::InterfaceFactory<mojom::UserAccessManager>,
68 public shell::InterfaceFactory<mojom::UserActivityMonitor>,
69 public shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>,
70 public shell::InterfaceFactory<mojom::WindowTreeFactory>,
71 public shell::InterfaceFactory<mojom::WindowTreeHostFactory>,
72 public shell::InterfaceFactory<mojom::WindowServerTest> {
73 public:
74 MusApp();
75 ~MusApp() override;
76
77 private:
78 // Holds InterfaceRequests received before the first WindowTreeHost Display
79 // has been established.
80 struct PendingRequest;
81 struct UserState;
82
83 using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>;
84
85 void InitializeResources(shell::Connector* connector);
86
87 // Returns the user specific state for the user id of |connection|. MusApp
88 // owns the return value.
89 // TODO(sky): if we allow removal of user ids then we need to close anything
90 // associated with the user (all incoming pipes...) on removal.
91 UserState* GetUserState(shell::Connection* connection);
92
93 void AddUserIfNecessary(shell::Connection* connection);
94
95 // shell::ShellClient:
96 void Initialize(shell::Connector* connector,
97 const shell::Identity& identity,
98 uint32_t id) override;
99 bool AcceptConnection(shell::Connection* connection) override;
100
101 // WindowServerDelegate:
102 void OnFirstDisplayReady() override;
103 void OnNoMoreDisplays() override;
104 bool IsTestConfig() const override;
105 void CreateDefaultDisplays() override;
106
107 // shell::InterfaceFactory<mojom::Clipboard> implementation.
108 void Create(shell::Connection* connection,
109 mojom::ClipboardRequest request) override;
110
111 // shell::InterfaceFactory<mojom::DisplayManager> implementation.
112 void Create(shell::Connection* connection,
113 mojom::DisplayManagerRequest request) override;
114
115 // shell::InterfaceFactory<mojom::Gpu> implementation.
116 void Create(shell::Connection* connection,
117 mojom::GpuRequest request) override;
118
119 // shell::InterfaceFactory<mojom::GpuService> implementation.
120 void Create(shell::Connection* connection,
121 mojom::GpuServiceRequest request) override;
122
123 // shell::InterfaceFactory<mojom::UserAccessManager> implementation.
124 void Create(shell::Connection* connection,
125 mojom::UserAccessManagerRequest request) override;
126
127 // shell::InterfaceFactory<mojom::UserActivityMonitor> implementation.
128 void Create(shell::Connection* connection,
129 mojom::UserActivityMonitorRequest request) override;
130
131 // shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>
132 // implementation.
133 void Create(shell::Connection* connection,
134 mojom::WindowManagerWindowTreeFactoryRequest request) override;
135
136 // shell::InterfaceFactory<mojom::WindowTreeFactory>:
137 void Create(shell::Connection* connection,
138 mojom::WindowTreeFactoryRequest request) override;
139
140 // shell::InterfaceFactory<mojom::WindowTreeHostFactory>:
141 void Create(shell::Connection* connection,
142 mojom::WindowTreeHostFactoryRequest request) override;
143
144 // shell::InterfaceFactory<mojom::WindowServerTest> implementation.
145 void Create(shell::Connection* connection,
146 mojom::WindowServerTestRequest request) override;
147
148 // Callback for display configuration. |id| is the identifying token for the
149 // configured display that will identify a specific physical display across
150 // configuration changes. |bounds| is the bounds of the display in screen
151 // coordinates.
152 void OnCreatedPhysicalDisplay(int64_t id, const gfx::Rect& bounds);
153
154 ws::PlatformDisplayInitParams platform_display_init_params_;
155 std::unique_ptr<ws::WindowServer> window_server_;
156 std::unique_ptr<ui::PlatformEventSource> event_source_;
157 mojo::TracingImpl tracing_;
158 using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>;
159 PendingRequests pending_requests_;
160
161 UserIdToUserState user_id_to_user_state_;
162
163 // Provides input-device information via Mojo IPC.
164 InputDeviceServer input_device_server_;
165
166 bool test_config_;
167 bool use_chrome_gpu_command_buffer_;
168 #if defined(USE_OZONE)
169 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_;
170 #endif
171
172 std::unique_ptr<ws::PlatformScreen> platform_screen_;
173 std::unique_ptr<ws::TouchController> touch_controller_;
174
175 base::WeakPtrFactory<MusApp> weak_ptr_factory_;
176
177 DISALLOW_COPY_AND_ASSIGN(MusApp);
178 };
179
180 } // namespace mus
181
182 #endif // COMPONENTS_MUS_MUS_APP_H_
OLDNEW
« no previous file with comments | « components/mus/manifest.json ('k') | components/mus/mus_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698