OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ |
6 #define CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ | 6 #define CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "mojo/public/cpp/bindings/binding.h" | 9 #include "mojo/public/cpp/bindings/binding.h" |
10 #include "services/ui/common/types.h" | 10 #include "services/ui/common/types.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Destroys the client instance, if one exists. Otherwise, does nothing. | 38 // Destroys the client instance, if one exists. Otherwise, does nothing. |
39 static void Destroy(int routing_id); | 39 static void Destroy(int routing_id); |
40 | 40 |
41 // Returns the RendererWindowTreeClient associated with |routing_id|. Returns | 41 // Returns the RendererWindowTreeClient associated with |routing_id|. Returns |
42 // nullptr if none exists. | 42 // nullptr if none exists. |
43 static RendererWindowTreeClient* Get(int routing_id); | 43 static RendererWindowTreeClient* Get(int routing_id); |
44 | 44 |
45 void Bind(ui::mojom::WindowTreeClientRequest request); | 45 void Bind(ui::mojom::WindowTreeClientRequest request); |
46 | 46 |
47 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink( | 47 using CompositorFrameSinkCallback = |
48 const cc::FrameSinkId& frame_sink_id, | 48 base::Callback<void(std::unique_ptr<cc::CompositorFrameSink>)>; |
| 49 void RequestCompositorFrameSink( |
49 scoped_refptr<cc::ContextProvider> context_provider, | 50 scoped_refptr<cc::ContextProvider> context_provider, |
50 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 51 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 52 const CompositorFrameSinkCallback& callback); |
51 | 53 |
52 private: | 54 private: |
53 explicit RendererWindowTreeClient(int routing_id); | 55 explicit RendererWindowTreeClient(int routing_id); |
54 ~RendererWindowTreeClient() override; | 56 ~RendererWindowTreeClient() override; |
55 | 57 |
| 58 void RequestCompositorFrameSinkInternal( |
| 59 scoped_refptr<cc::ContextProvider> context_provider, |
| 60 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 61 const CompositorFrameSinkCallback& callback); |
| 62 |
56 void DestroySelf(); | 63 void DestroySelf(); |
57 | 64 |
58 // ui::mojom::WindowTreeClient: | 65 // ui::mojom::WindowTreeClient: |
59 // Note: A number of the following are currently not-implemented. Some of | 66 // Note: A number of the following are currently not-implemented. Some of |
60 // these will remain unimplemented in the long-term. Some of the | 67 // these will remain unimplemented in the long-term. Some of the |
61 // implementations would require some amount of refactoring out of | 68 // implementations would require some amount of refactoring out of |
62 // RenderWidget and related classes (e.g. resize, input, ime etc.). | 69 // RenderWidget and related classes (e.g. resize, input, ime etc.). |
63 void OnEmbed(ui::ClientSpecificId client_id, | 70 void OnEmbed(ui::ClientSpecificId client_id, |
64 ui::mojom::WindowDataPtr root, | 71 ui::mojom::WindowDataPtr root, |
65 ui::mojom::WindowTreePtr tree, | 72 ui::mojom::WindowTreePtr tree, |
66 int64_t display_id, | 73 int64_t display_id, |
67 ui::Id focused_window_id, | 74 ui::Id focused_window_id, |
68 bool drawn) override; | 75 bool drawn, |
| 76 const cc::FrameSinkId& frame_sink_id) override; |
69 void OnEmbeddedAppDisconnected(ui::Id window_id) override; | 77 void OnEmbeddedAppDisconnected(ui::Id window_id) override; |
70 void OnUnembed(ui::Id window_id) override; | 78 void OnUnembed(ui::Id window_id) override; |
71 void OnCaptureChanged(ui::Id new_capture_window_id, | 79 void OnCaptureChanged(ui::Id new_capture_window_id, |
72 ui::Id old_capture_window_id) override; | 80 ui::Id old_capture_window_id) override; |
73 void OnTopLevelCreated(uint32_t change_id, | 81 void OnTopLevelCreated(uint32_t change_id, |
74 ui::mojom::WindowDataPtr data, | 82 ui::mojom::WindowDataPtr data, |
75 int64_t display_id, | 83 int64_t display_id, |
76 bool drawn) override; | 84 bool drawn, |
| 85 const cc::FrameSinkId& frame_sink_id) override; |
77 void OnWindowBoundsChanged( | 86 void OnWindowBoundsChanged( |
78 ui::Id window_id, | 87 ui::Id window_id, |
79 const gfx::Rect& old_bounds, | 88 const gfx::Rect& old_bounds, |
80 const gfx::Rect& new_bounds, | 89 const gfx::Rect& new_bounds, |
81 const base::Optional<cc::LocalSurfaceId>& local_frame_id) override; | 90 const base::Optional<cc::LocalSurfaceId>& local_frame_id) override; |
82 void OnClientAreaChanged( | 91 void OnClientAreaChanged( |
83 uint32_t window_id, | 92 uint32_t window_id, |
84 const gfx::Insets& new_client_area, | 93 const gfx::Insets& new_client_area, |
85 const std::vector<gfx::Rect>& new_additional_client_areas) override; | 94 const std::vector<gfx::Rect>& new_additional_client_areas) override; |
86 void OnTransientWindowAdded(uint32_t window_id, | 95 void OnTransientWindowAdded(uint32_t window_id, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 uint32_t action_taken) override; | 151 uint32_t action_taken) override; |
143 void OnDragDropDone() override; | 152 void OnDragDropDone() override; |
144 void OnChangeCompleted(uint32_t change_id, bool success) override; | 153 void OnChangeCompleted(uint32_t change_id, bool success) override; |
145 void RequestClose(uint32_t window_id) override; | 154 void RequestClose(uint32_t window_id) override; |
146 void GetWindowManager( | 155 void GetWindowManager( |
147 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManager> internal) | 156 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManager> internal) |
148 override; | 157 override; |
149 | 158 |
150 const int routing_id_; | 159 const int routing_id_; |
151 ui::Id root_window_id_; | 160 ui::Id root_window_id_; |
| 161 cc::FrameSinkId frame_sink_id_; |
| 162 base::Closure pending_compositor_frame_sink_request_; |
152 ui::mojom::WindowTreePtr tree_; | 163 ui::mojom::WindowTreePtr tree_; |
153 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> pending_frame_sink_; | 164 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> pending_frame_sink_; |
154 mojo::Binding<ui::mojom::WindowTreeClient> binding_; | 165 mojo::Binding<ui::mojom::WindowTreeClient> binding_; |
155 | 166 |
156 DISALLOW_COPY_AND_ASSIGN(RendererWindowTreeClient); | 167 DISALLOW_COPY_AND_ASSIGN(RendererWindowTreeClient); |
157 }; | 168 }; |
158 | 169 |
159 } // namespace content | 170 } // namespace content |
160 | 171 |
161 #endif // CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ | 172 #endif // CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ |
OLD | NEW |