OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ |
| 6 #define CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" |
| 10 #include "services/ui/common/types.h" |
| 11 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 12 |
| 13 namespace cc { |
| 14 class CompositorFrameSink; |
| 15 class ContextProvider; |
| 16 } |
| 17 |
| 18 namespace gpu { |
| 19 class GpuMemoryBufferManager; |
| 20 } |
| 21 |
| 22 namespace ui { |
| 23 class WindowCompositorFrameSinkBinding; |
| 24 } |
| 25 |
| 26 namespace content { |
| 27 |
| 28 // ui.mojom.WindowTreeClient implementation for RenderWidget. This lives and |
| 29 // operates on the renderer's main thread. |
| 30 class RendererWindowTreeClient : public ui::mojom::WindowTreeClient { |
| 31 public: |
| 32 // Creates a RendererWindowTreeClient instance for the RenderWidget instance |
| 33 // associated with |routing_id|. The instance self-destructs when the |
| 34 // connection to mus is lost, or when the window is closed. |
| 35 static void Create(int routing_id); |
| 36 |
| 37 // Returns the RendererWindowTreeClient associated with |routing_id|. Returns |
| 38 // nullptr if none exists. |
| 39 static RendererWindowTreeClient* Get(int routing_id); |
| 40 |
| 41 void Bind(ui::mojom::WindowTreeClientRequest request); |
| 42 |
| 43 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink( |
| 44 const cc::FrameSinkId& frame_sink_id, |
| 45 scoped_refptr<cc::ContextProvider> context_provider, |
| 46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
| 47 |
| 48 private: |
| 49 explicit RendererWindowTreeClient(int routing_id); |
| 50 ~RendererWindowTreeClient() override; |
| 51 |
| 52 void DestroySelf(); |
| 53 |
| 54 // ui::mojom::WindowTreeClient: |
| 55 // Note: A number of the following are currently not-implemented. Some of |
| 56 // these will remain unimplemented in the long-term. Some of the |
| 57 // implementations would require some amount of refactoring out of |
| 58 // RenderWidget and related classes (e.g. resize, input, ime etc.). |
| 59 void OnEmbed(ui::ClientSpecificId client_id, |
| 60 ui::mojom::WindowDataPtr root, |
| 61 ui::mojom::WindowTreePtr tree, |
| 62 int64_t display_id, |
| 63 ui::Id focused_window_id, |
| 64 bool drawn) override; |
| 65 void OnEmbeddedAppDisconnected(ui::Id window_id) override; |
| 66 void OnUnembed(ui::Id window_id) override; |
| 67 void OnCaptureChanged(ui::Id new_capture_window_id, |
| 68 ui::Id old_capture_window_id) override; |
| 69 void OnTopLevelCreated(uint32_t change_id, |
| 70 ui::mojom::WindowDataPtr data, |
| 71 int64_t display_id, |
| 72 bool drawn) override; |
| 73 void OnWindowBoundsChanged(ui::Id window_id, |
| 74 const gfx::Rect& old_bounds, |
| 75 const gfx::Rect& new_bounds) override; |
| 76 void OnClientAreaChanged( |
| 77 uint32_t window_id, |
| 78 const gfx::Insets& new_client_area, |
| 79 const std::vector<gfx::Rect>& new_additional_client_areas) override; |
| 80 void OnTransientWindowAdded(uint32_t window_id, |
| 81 uint32_t transient_window_id) override; |
| 82 void OnTransientWindowRemoved(uint32_t window_id, |
| 83 uint32_t transient_window_id) override; |
| 84 void OnWindowHierarchyChanged( |
| 85 ui::Id window_id, |
| 86 ui::Id old_parent_id, |
| 87 ui::Id new_parent_id, |
| 88 std::vector<ui::mojom::WindowDataPtr> windows) override; |
| 89 void OnWindowReordered(ui::Id window_id, |
| 90 ui::Id relative_window_id, |
| 91 ui::mojom::OrderDirection direction) override; |
| 92 void OnWindowDeleted(ui::Id window_id) override; |
| 93 void OnWindowVisibilityChanged(ui::Id window_id, bool visible) override; |
| 94 void OnWindowOpacityChanged(ui::Id window_id, |
| 95 float old_opacity, |
| 96 float new_opacity) override; |
| 97 void OnWindowParentDrawnStateChanged(ui::Id window_id, bool drawn) override; |
| 98 void OnWindowSharedPropertyChanged( |
| 99 ui::Id window_id, |
| 100 const std::string& name, |
| 101 const base::Optional<std::vector<uint8_t>>& new_data) override; |
| 102 void OnWindowInputEvent(uint32_t event_id, |
| 103 ui::Id window_id, |
| 104 std::unique_ptr<ui::Event> event, |
| 105 bool matches_pointer_watcher) override; |
| 106 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, |
| 107 uint32_t window_id) override; |
| 108 void OnWindowFocused(ui::Id focused_window_id) override; |
| 109 void OnWindowPredefinedCursorChanged(ui::Id window_id, |
| 110 ui::mojom::Cursor cursor) override; |
| 111 void OnWindowSurfaceChanged(ui::Id window_id, |
| 112 const cc::SurfaceInfo& surface_info) override; |
| 113 void OnDragDropStart( |
| 114 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) |
| 115 override; |
| 116 void OnDragEnter(ui::Id window_id, |
| 117 uint32_t event_flags, |
| 118 const gfx::Point& position, |
| 119 uint32_t effect_bitmask, |
| 120 const OnDragEnterCallback& callback) override; |
| 121 void OnDragOver(ui::Id window_id, |
| 122 uint32_t event_flags, |
| 123 const gfx::Point& position, |
| 124 uint32_t effect_bitmask, |
| 125 const OnDragOverCallback& callback) override; |
| 126 void OnDragLeave(ui::Id window_id) override; |
| 127 void OnCompleteDrop(ui::Id window_id, |
| 128 uint32_t event_flags, |
| 129 const gfx::Point& position, |
| 130 uint32_t effect_bitmask, |
| 131 const OnCompleteDropCallback& callback) override; |
| 132 void OnPerformDragDropCompleted(uint32_t window, |
| 133 bool success, |
| 134 uint32_t action_taken) override; |
| 135 void OnDragDropDone() override; |
| 136 void OnChangeCompleted(uint32_t change_id, bool success) override; |
| 137 void RequestClose(uint32_t window_id) override; |
| 138 void GetWindowManager( |
| 139 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManager> internal) |
| 140 override; |
| 141 |
| 142 const int routing_id_; |
| 143 ui::Id root_window_id_; |
| 144 ui::mojom::WindowTreePtr tree_; |
| 145 std::unique_ptr<ui::WindowCompositorFrameSinkBinding> pending_frame_sink_; |
| 146 mojo::Binding<ui::mojom::WindowTreeClient> binding_; |
| 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(RendererWindowTreeClient); |
| 149 }; |
| 150 |
| 151 } // namespace content |
| 152 |
| 153 #endif // CONTENT_RENDERER_MUS_RENDERER_WINDOW_TREE_CLIENT_H_ |
OLD | NEW |