OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_ANDROID_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "cc/resources/returned_resource.h" |
| 11 #include "cc/surfaces/surface_factory.h" |
| 12 #include "cc/surfaces/surface_factory_client.h" |
| 13 #include "ui/gfx/selection_bound.h" |
| 14 |
| 15 namespace cc { |
| 16 |
| 17 class CompositorFrame; |
| 18 class SurfaceId; |
| 19 class SurfaceManager; |
| 20 class SurfaceLayer; |
| 21 class SurfaceIdAllocator; |
| 22 enum class SurfaceDrawStatus; |
| 23 |
| 24 } // namespace cc |
| 25 |
| 26 namespace content { |
| 27 |
| 28 class DelegatedFrameHostAndroidClient { |
| 29 public: |
| 30 virtual ~DelegatedFrameHostAndroidClient() {} |
| 31 |
| 32 virtual void AttachSurfaceLayer(scoped_refptr<cc::SurfaceLayer> layer) = 0; |
| 33 |
| 34 virtual void DetachSurfaceLayer() = 0; |
| 35 |
| 36 virtual void ReturnCompositorFrameResources( |
| 37 const cc::ReturnedResourceArray& resources) = 0; |
| 38 }; |
| 39 |
| 40 class DelegatedFrameHostAndroid : public cc::SurfaceFactoryClient { |
| 41 public: |
| 42 DelegatedFrameHostAndroid( |
| 43 cc::SurfaceManager* surface_manager, |
| 44 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator, |
| 45 DelegatedFrameHostAndroidClient* client); |
| 46 |
| 47 ~DelegatedFrameHostAndroid(); |
| 48 |
| 49 void SubmitCompositorFrame(cc::CompositorFrame frame, |
| 50 cc::SurfaceFactory::DrawCallback draw_callback); |
| 51 |
| 52 bool HasDelegatedContent() const; |
| 53 |
| 54 void DestroyDelegatedContent(); |
| 55 |
| 56 uint32_t GetSurfaceIdNamespace(); |
| 57 |
| 58 private: |
| 59 // cc::SurfaceFactoryClient implementation. |
| 60 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 61 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 62 |
| 63 scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer(); |
| 64 |
| 65 cc::SurfaceManager* surface_manager_; |
| 66 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 67 std::unique_ptr<cc::SurfaceFactory> surface_factory_; |
| 68 cc::SurfaceId surface_id_; |
| 69 gfx::Size current_surface_size_; |
| 70 |
| 71 gfx::Vector2dF location_bar_content_translation_; |
| 72 cc::Selection<gfx::SelectionBound> current_viewport_selection_; |
| 73 |
| 74 DelegatedFrameHostAndroidClient* client_; |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid); |
| 77 }; |
| 78 |
| 79 } // namespace content |
| 80 |
| 81 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_ANDROID_H_ |
OLD | NEW |