OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ |
6 #define UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ | 6 #define UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/atomicops.h" | 16 #include "base/atomicops.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "cc/surfaces/local_surface_id_allocator.h" |
21 #include "mojo/public/cpp/bindings/associated_binding.h" | 22 #include "mojo/public/cpp/bindings/associated_binding.h" |
22 #include "mojo/public/cpp/bindings/strong_binding.h" | 23 #include "mojo/public/cpp/bindings/strong_binding.h" |
23 #include "services/ui/public/interfaces/window_tree.mojom.h" | 24 #include "services/ui/public/interfaces/window_tree.mojom.h" |
24 #include "ui/aura/aura_export.h" | 25 #include "ui/aura/aura_export.h" |
25 #include "ui/aura/client/transient_window_client_observer.h" | 26 #include "ui/aura/client/transient_window_client_observer.h" |
26 #include "ui/aura/mus/capture_synchronizer_delegate.h" | 27 #include "ui/aura/mus/capture_synchronizer_delegate.h" |
27 #include "ui/aura/mus/drag_drop_controller_host.h" | 28 #include "ui/aura/mus/drag_drop_controller_host.h" |
28 #include "ui/aura/mus/focus_synchronizer_delegate.h" | 29 #include "ui/aura/mus/focus_synchronizer_delegate.h" |
29 #include "ui/aura/mus/mus_types.h" | 30 #include "ui/aura/mus/mus_types.h" |
30 #include "ui/aura/mus/window_manager_delegate.h" | 31 #include "ui/aura/mus/window_manager_delegate.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // Sets local properties on the associated Window from the server properties. | 226 // Sets local properties on the associated Window from the server properties. |
226 void SetLocalPropertiesFromServerProperties( | 227 void SetLocalPropertiesFromServerProperties( |
227 WindowMus* window, | 228 WindowMus* window, |
228 const ui::mojom::WindowData& window_data); | 229 const ui::mojom::WindowData& window_data); |
229 | 230 |
230 // Creates a new WindowTreeHostMus. | 231 // Creates a new WindowTreeHostMus. |
231 std::unique_ptr<WindowTreeHostMus> CreateWindowTreeHost( | 232 std::unique_ptr<WindowTreeHostMus> CreateWindowTreeHost( |
232 WindowMusType window_mus_type, | 233 WindowMusType window_mus_type, |
233 const ui::mojom::WindowData& window_data, | 234 const ui::mojom::WindowData& window_data, |
234 int64_t display_id, | 235 int64_t display_id, |
235 const cc::FrameSinkId& frame_sink_id = cc::FrameSinkId()); | 236 const cc::FrameSinkId& frame_sink_id = cc::FrameSinkId(), |
| 237 const base::Optional<cc::LocalSurfaceId>& local_surface_id = |
| 238 base::nullopt); |
236 | 239 |
237 WindowMus* NewWindowFromWindowData(WindowMus* parent, | 240 WindowMus* NewWindowFromWindowData(WindowMus* parent, |
238 const ui::mojom::WindowData& window_data); | 241 const ui::mojom::WindowData& window_data); |
239 | 242 |
240 // Sets the ui::mojom::WindowTree implementation. | 243 // Sets the ui::mojom::WindowTree implementation. |
241 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr); | 244 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr); |
242 | 245 |
243 // Called when the connection to the server is established. | 246 // Called when the connection to the server is established. |
244 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree); | 247 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree); |
245 | 248 |
246 // Called when the ui::mojom::WindowTree connection is lost, deletes this. | 249 // Called when the ui::mojom::WindowTree connection is lost, deletes this. |
247 void OnConnectionLost(); | 250 void OnConnectionLost(); |
248 | 251 |
249 // Called when a Window property changes. If |key| is handled internally | 252 // Called when a Window property changes. If |key| is handled internally |
250 // (maps to a function on WindowTree) returns true. | 253 // (maps to a function on WindowTree) returns true. |
251 bool HandleInternalPropertyChanged(WindowMus* window, | 254 bool HandleInternalPropertyChanged(WindowMus* window, |
252 const void* key, | 255 const void* key, |
253 int64_t old_value); | 256 int64_t old_value); |
254 | 257 |
255 // OnEmbed() calls into this. Exposed as a separate function for testing. | 258 // OnEmbed() calls into this. Exposed as a separate function for testing. |
256 void OnEmbedImpl(ui::mojom::WindowTree* window_tree, | 259 void OnEmbedImpl(ui::mojom::WindowTree* window_tree, |
257 ClientSpecificId client_id, | 260 ClientSpecificId client_id, |
258 ui::mojom::WindowDataPtr root_data, | 261 ui::mojom::WindowDataPtr root_data, |
259 int64_t display_id, | 262 int64_t display_id, |
260 Id focused_window_id, | 263 Id focused_window_id, |
261 bool drawn, | 264 bool drawn, |
262 const cc::FrameSinkId& frame_sink_id); | 265 const cc::FrameSinkId& frame_sink_id, |
| 266 const base::Optional<cc::LocalSurfaceId>& local_surface_id); |
263 | 267 |
264 // Called by WmNewDisplayAdded(). | 268 // Called by WmNewDisplayAdded(). |
265 WindowTreeHostMus* WmNewDisplayAddedImpl( | 269 WindowTreeHostMus* WmNewDisplayAddedImpl( |
266 const display::Display& display, | 270 const display::Display& display, |
267 ui::mojom::WindowDataPtr root_data, | 271 ui::mojom::WindowDataPtr root_data, |
268 bool parent_drawn, | 272 bool parent_drawn, |
269 const cc::FrameSinkId& frame_sink_id); | 273 const cc::FrameSinkId& frame_sink_id, |
| 274 const base::Optional<cc::LocalSurfaceId>& local_surface_id); |
270 | 275 |
271 std::unique_ptr<EventResultCallback> CreateEventResultCallback( | 276 std::unique_ptr<EventResultCallback> CreateEventResultCallback( |
272 int32_t event_id); | 277 int32_t event_id); |
273 | 278 |
274 void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle); | 279 void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle); |
275 | 280 |
276 // Called when a property needs to change as the result of a change in the | 281 // Called when a property needs to change as the result of a change in the |
277 // server, or the server failing to accept a change. | 282 // server, or the server failing to accept a change. |
278 void SetWindowBoundsFromServer( | 283 void SetWindowBoundsFromServer( |
279 WindowMus* window, | 284 WindowMus* window, |
(...skipping 23 matching lines...) Expand all Loading... |
303 const void* key); | 308 const void* key); |
304 void OnWindowMusPropertyChanged(WindowMus* window, | 309 void OnWindowMusPropertyChanged(WindowMus* window, |
305 const void* key, | 310 const void* key, |
306 int64_t old_value, | 311 int64_t old_value, |
307 std::unique_ptr<ui::PropertyData> data); | 312 std::unique_ptr<ui::PropertyData> data); |
308 | 313 |
309 // Callback passed from WmPerformMoveLoop(). | 314 // Callback passed from WmPerformMoveLoop(). |
310 void OnWmMoveLoopCompleted(uint32_t change_id, bool completed); | 315 void OnWmMoveLoopCompleted(uint32_t change_id, bool completed); |
311 | 316 |
312 // Overridden from WindowTreeClient: | 317 // Overridden from WindowTreeClient: |
313 void OnEmbed(ClientSpecificId client_id, | 318 void OnEmbed( |
314 ui::mojom::WindowDataPtr root, | 319 ClientSpecificId client_id, |
315 ui::mojom::WindowTreePtr tree, | 320 ui::mojom::WindowDataPtr root, |
316 int64_t display_id, | 321 ui::mojom::WindowTreePtr tree, |
317 Id focused_window_id, | 322 int64_t display_id, |
318 bool drawn, | 323 Id focused_window_id, |
319 const cc::FrameSinkId& frame_sink_Id) override; | 324 bool drawn, |
| 325 const cc::FrameSinkId& frame_sink_Id, |
| 326 const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; |
320 void OnEmbeddedAppDisconnected(Id window_id) override; | 327 void OnEmbeddedAppDisconnected(Id window_id) override; |
321 void OnUnembed(Id window_id) override; | 328 void OnUnembed(Id window_id) override; |
322 void OnCaptureChanged(Id new_capture_window_id, | 329 void OnCaptureChanged(Id new_capture_window_id, |
323 Id old_capture_window_id) override; | 330 Id old_capture_window_id) override; |
324 void OnFrameSinkIdAllocated(Id window_id, | 331 void OnFrameSinkIdAllocated(Id window_id, |
325 const cc::FrameSinkId& frame_sink_id) override; | 332 const cc::FrameSinkId& frame_sink_id) override; |
326 void OnTopLevelCreated(uint32_t change_id, | 333 void OnTopLevelCreated( |
327 ui::mojom::WindowDataPtr data, | 334 uint32_t change_id, |
328 int64_t display_id, | 335 ui::mojom::WindowDataPtr data, |
329 bool drawn, | 336 int64_t display_id, |
330 const cc::FrameSinkId& frame_sink_id) override; | 337 bool drawn, |
| 338 const cc::FrameSinkId& frame_sink_id, |
| 339 const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; |
331 void OnWindowBoundsChanged( | 340 void OnWindowBoundsChanged( |
332 Id window_id, | 341 Id window_id, |
333 const gfx::Rect& old_bounds, | 342 const gfx::Rect& old_bounds, |
334 const gfx::Rect& new_bounds, | 343 const gfx::Rect& new_bounds, |
335 const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; | 344 const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; |
336 void OnClientAreaChanged( | 345 void OnClientAreaChanged( |
337 uint32_t window_id, | 346 uint32_t window_id, |
338 const gfx::Insets& new_client_area, | 347 const gfx::Insets& new_client_area, |
339 const std::vector<gfx::Rect>& new_additional_client_areas) override; | 348 const std::vector<gfx::Rect>& new_additional_client_areas) override; |
340 void OnTransientWindowAdded(uint32_t window_id, | 349 void OnTransientWindowAdded(uint32_t window_id, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 bool success, | 404 bool success, |
396 uint32_t action_taken) override; | 405 uint32_t action_taken) override; |
397 void OnDragDropDone() override; | 406 void OnDragDropDone() override; |
398 void OnChangeCompleted(uint32_t change_id, bool success) override; | 407 void OnChangeCompleted(uint32_t change_id, bool success) override; |
399 void RequestClose(uint32_t window_id) override; | 408 void RequestClose(uint32_t window_id) override; |
400 void GetWindowManager( | 409 void GetWindowManager( |
401 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; | 410 mojo::AssociatedInterfaceRequest<WindowManager> internal) override; |
402 | 411 |
403 // Overridden from WindowManager: | 412 // Overridden from WindowManager: |
404 void OnConnect(ClientSpecificId client_id) override; | 413 void OnConnect(ClientSpecificId client_id) override; |
405 void WmNewDisplayAdded(const display::Display& display, | 414 void WmNewDisplayAdded( |
406 ui::mojom::WindowDataPtr root_data, | 415 const display::Display& display, |
407 bool parent_drawn, | 416 ui::mojom::WindowDataPtr root_data, |
408 const cc::FrameSinkId& frame_sink_id) override; | 417 bool parent_drawn, |
| 418 const cc::FrameSinkId& frame_sink_id, |
| 419 const base::Optional<cc::LocalSurfaceId>& local_surface_id) override; |
409 void WmDisplayRemoved(int64_t display_id) override; | 420 void WmDisplayRemoved(int64_t display_id) override; |
410 void WmDisplayModified(const display::Display& display) override; | 421 void WmDisplayModified(const display::Display& display) override; |
411 void WmSetBounds(uint32_t change_id, | 422 void WmSetBounds(uint32_t change_id, |
412 Id window_id, | 423 Id window_id, |
413 const gfx::Rect& transit_bounds_in_pixels) override; | 424 const gfx::Rect& transit_bounds_in_pixels) override; |
414 void WmSetProperty( | 425 void WmSetProperty( |
415 uint32_t change_id, | 426 uint32_t change_id, |
416 Id window_id, | 427 Id window_id, |
417 const std::string& name, | 428 const std::string& name, |
418 const base::Optional<std::vector<uint8_t>>& transit_data) override; | 429 const base::Optional<std::vector<uint8_t>>& transit_data) override; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 bool got_initial_displays_ = false; | 605 bool got_initial_displays_ = false; |
595 | 606 |
596 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 607 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
597 | 608 |
598 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 609 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
599 }; | 610 }; |
600 | 611 |
601 } // namespace aura | 612 } // namespace aura |
602 | 613 |
603 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ | 614 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ |
OLD | NEW |