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