OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_PORT_MUS_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_PORT_MUS_H_ |
6 #define UI_AURA_MUS_WINDOW_PORT_MUS_H_ | 6 #define UI_AURA_MUS_WINDOW_PORT_MUS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "cc/surfaces/surface_info.h" | 15 #include "cc/surfaces/surface_info.h" |
16 #include "components/viz/client/client_compositor_frame_sink.h" | 16 #include "components/viz/client/client_compositor_frame_sink.h" |
17 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" | 17 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" |
18 #include "services/ui/public/interfaces/window_tree.mojom.h" | 18 #include "services/ui/public/interfaces/window_tree.mojom.h" |
19 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" | 19 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" |
20 #include "ui/aura/aura_export.h" | 20 #include "ui/aura/aura_export.h" |
21 #include "ui/aura/mus/mus_types.h" | 21 #include "ui/aura/mus/mus_types.h" |
22 #include "ui/aura/mus/window_mus.h" | 22 #include "ui/aura/mus/window_mus.h" |
23 #include "ui/aura/window_port.h" | 23 #include "ui/aura/window_port.h" |
24 #include "ui/gfx/geometry/rect.h" | 24 #include "ui/gfx/geometry/rect.h" |
25 #include "ui/platform_window/mojo/text_input_state.mojom.h" | 25 #include "ui/platform_window/mojo/text_input_state.mojom.h" |
26 | 26 |
| 27 namespace viz { |
| 28 class ClientCompositorFrameSink; |
| 29 } |
| 30 |
27 namespace aura { | 31 namespace aura { |
28 | 32 |
29 class ClientSurfaceEmbedder; | 33 class ClientSurfaceEmbedder; |
30 class PropertyConverter; | 34 class PropertyConverter; |
31 class Window; | 35 class Window; |
32 class WindowPortMusTestApi; | 36 class WindowPortMusTestApi; |
33 class WindowTreeClient; | 37 class WindowTreeClient; |
34 class WindowTreeClientPrivate; | 38 class WindowTreeClientPrivate; |
35 class WindowTreeHostMus; | 39 class WindowTreeHostMus; |
36 | 40 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 73 |
70 // Sets whether this window can accept drops, defaults to false. | 74 // Sets whether this window can accept drops, defaults to false. |
71 void SetCanAcceptDrops(bool can_accept_drops); | 75 void SetCanAcceptDrops(bool can_accept_drops); |
72 | 76 |
73 // Embeds a new client in this Window. See WindowTreeClient::Embed() for | 77 // Embeds a new client in this Window. See WindowTreeClient::Embed() for |
74 // details on arguments. | 78 // details on arguments. |
75 void Embed(ui::mojom::WindowTreeClientPtr client, | 79 void Embed(ui::mojom::WindowTreeClientPtr client, |
76 uint32_t flags, | 80 uint32_t flags, |
77 const ui::mojom::WindowTree::EmbedCallback& callback); | 81 const ui::mojom::WindowTree::EmbedCallback& callback); |
78 | 82 |
79 std::unique_ptr<cc::CompositorFrameSink> RequestCompositorFrameSink( | 83 std::unique_ptr<viz::ClientCompositorFrameSink> RequestCompositorFrameSink( |
80 scoped_refptr<cc::ContextProvider> context_provider, | 84 scoped_refptr<cc::ContextProvider> context_provider, |
81 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 85 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
82 | 86 |
83 private: | 87 private: |
84 friend class WindowPortMusTestApi; | 88 friend class WindowPortMusTestApi; |
85 friend class WindowTreeClient; | 89 friend class WindowTreeClient; |
86 friend class WindowTreeClientPrivate; | 90 friend class WindowTreeClientPrivate; |
87 friend class WindowTreeHostMus; | 91 friend class WindowTreeHostMus; |
88 | 92 |
89 using ServerChangeIdType = uint8_t; | 93 using ServerChangeIdType = uint8_t; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 void SetTransformFromServer(const gfx::Transform& transform) override; | 220 void SetTransformFromServer(const gfx::Transform& transform) override; |
217 void SetVisibleFromServer(bool visible) override; | 221 void SetVisibleFromServer(bool visible) override; |
218 void SetOpacityFromServer(float opacity) override; | 222 void SetOpacityFromServer(float opacity) override; |
219 void SetCursorFromServer(const ui::CursorData& cursor) override; | 223 void SetCursorFromServer(const ui::CursorData& cursor) override; |
220 void SetPropertyFromServer( | 224 void SetPropertyFromServer( |
221 const std::string& property_name, | 225 const std::string& property_name, |
222 const std::vector<uint8_t>* property_data) override; | 226 const std::vector<uint8_t>* property_data) override; |
223 void SetFrameSinkIdFromServer(const cc::FrameSinkId& frame_sink_id) override; | 227 void SetFrameSinkIdFromServer(const cc::FrameSinkId& frame_sink_id) override; |
224 const cc::LocalSurfaceId& GetOrAllocateLocalSurfaceId( | 228 const cc::LocalSurfaceId& GetOrAllocateLocalSurfaceId( |
225 const gfx::Size& surface_size_in_pixels) override; | 229 const gfx::Size& surface_size_in_pixels) override; |
226 void SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info) override; | |
227 void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info) override; | 230 void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info) override; |
228 void DestroyFromServer() override; | 231 void DestroyFromServer() override; |
229 void AddTransientChildFromServer(WindowMus* child) override; | 232 void AddTransientChildFromServer(WindowMus* child) override; |
230 void RemoveTransientChildFromServer(WindowMus* child) override; | 233 void RemoveTransientChildFromServer(WindowMus* child) override; |
231 ChangeSource OnTransientChildAdded(WindowMus* child) override; | 234 ChangeSource OnTransientChildAdded(WindowMus* child) override; |
232 ChangeSource OnTransientChildRemoved(WindowMus* child) override; | 235 ChangeSource OnTransientChildRemoved(WindowMus* child) override; |
233 const cc::LocalSurfaceId& GetLocalSurfaceId() override; | 236 const cc::LocalSurfaceId& GetLocalSurfaceId() override; |
234 std::unique_ptr<WindowMusChangeData> PrepareForServerBoundsChange( | 237 std::unique_ptr<WindowMusChangeData> PrepareForServerBoundsChange( |
235 const gfx::Rect& bounds) override; | 238 const gfx::Rect& bounds) override; |
236 std::unique_ptr<WindowMusChangeData> PrepareForServerVisibilityChange( | 239 std::unique_ptr<WindowMusChangeData> PrepareForServerVisibilityChange( |
237 bool value) override; | 240 bool value) override; |
238 void PrepareForDestroy() override; | 241 void PrepareForDestroy() override; |
239 void PrepareForTransientRestack(WindowMus* window) override; | 242 void PrepareForTransientRestack(WindowMus* window) override; |
240 void OnTransientRestackDone(WindowMus* window) override; | 243 void OnTransientRestackDone(WindowMus* window) override; |
241 void NotifyEmbeddedAppDisconnected() override; | 244 void NotifyEmbeddedAppDisconnected() override; |
| 245 bool HasLocalCompositorFrameSink() override; |
242 | 246 |
243 // WindowPort: | 247 // WindowPort: |
244 void OnPreInit(Window* window) override; | 248 void OnPreInit(Window* window) override; |
245 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 249 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
246 void OnWillAddChild(Window* child) override; | 250 void OnWillAddChild(Window* child) override; |
247 void OnWillRemoveChild(Window* child) override; | 251 void OnWillRemoveChild(Window* child) override; |
248 void OnWillMoveChild(size_t current_index, size_t dest_index) override; | 252 void OnWillMoveChild(size_t current_index, size_t dest_index) override; |
249 void OnVisibilityChanged(bool visible) override; | 253 void OnVisibilityChanged(bool visible) override; |
250 void OnDidChangeBounds(const gfx::Rect& old_bounds, | 254 void OnDidChangeBounds(const gfx::Rect& old_bounds, |
251 const gfx::Rect& new_bounds) override; | 255 const gfx::Rect& new_bounds) override; |
(...skipping 26 matching lines...) Expand all Loading... |
278 | 282 |
279 cc::SurfaceInfo primary_surface_info_; | 283 cc::SurfaceInfo primary_surface_info_; |
280 cc::SurfaceInfo fallback_surface_info_; | 284 cc::SurfaceInfo fallback_surface_info_; |
281 | 285 |
282 cc::LocalSurfaceId local_surface_id_; | 286 cc::LocalSurfaceId local_surface_id_; |
283 cc::LocalSurfaceIdAllocator local_surface_id_allocator_; | 287 cc::LocalSurfaceIdAllocator local_surface_id_allocator_; |
284 gfx::Size last_surface_size_in_pixels_; | 288 gfx::Size last_surface_size_in_pixels_; |
285 | 289 |
286 ui::CursorData cursor_; | 290 ui::CursorData cursor_; |
287 | 291 |
| 292 // When a frame sink is created |
| 293 // for a local aura::Window, we need keep a weak ptr of it, so we can update |
| 294 // the local surface id when necessary. |
| 295 base::WeakPtr<viz::ClientCompositorFrameSink> local_compositor_frame_sink_; |
| 296 |
288 DISALLOW_COPY_AND_ASSIGN(WindowPortMus); | 297 DISALLOW_COPY_AND_ASSIGN(WindowPortMus); |
289 }; | 298 }; |
290 | 299 |
291 } // namespace aura | 300 } // namespace aura |
292 | 301 |
293 #endif // UI_AURA_MUS_WINDOW_PORT_MUS_H_ | 302 #endif // UI_AURA_MUS_WINDOW_PORT_MUS_H_ |
OLD | NEW |