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/android/view_android.h" |
| 14 #include "ui/gfx/selection_bound.h" |
| 15 |
| 16 namespace cc { |
| 17 |
| 18 class CompositorFrame; |
| 19 class SurfaceId; |
| 20 class SurfaceManager; |
| 21 class SurfaceLayer; |
| 22 class SurfaceIdAllocator; |
| 23 enum class SurfaceDrawStatus; |
| 24 |
| 25 } // namespace cc |
| 26 |
| 27 namespace content { |
| 28 |
| 29 class DelegatedFrameHostAndroid : public cc::SurfaceFactoryClient { |
| 30 public: |
| 31 using ReturnResourcesCallback = |
| 32 base::Callback<void(const cc::ReturnedResourceArray&)>; |
| 33 |
| 34 DelegatedFrameHostAndroid(ui::ViewAndroid* view, |
| 35 SkColor background_color, |
| 36 ReturnResourcesCallback return_resources_callback); |
| 37 |
| 38 ~DelegatedFrameHostAndroid(); |
| 39 |
| 40 void SubmitCompositorFrame(cc::CompositorFrame frame, |
| 41 cc::SurfaceFactory::DrawCallback draw_callback); |
| 42 |
| 43 void DestroyDelegatedContent(); |
| 44 |
| 45 uint32_t GetSurfaceClientId() const; |
| 46 |
| 47 void OutputSurfaceChanged(); |
| 48 |
| 49 void UpdateBackgroundColor(SkColor color); |
| 50 |
| 51 void UpdateSize(const gfx::Size& desired_content_size); |
| 52 |
| 53 cc::Layer* GetContentLayer() const; |
| 54 |
| 55 private: |
| 56 // cc::SurfaceFactoryClient implementation. |
| 57 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 58 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 59 |
| 60 scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer(); |
| 61 |
| 62 void UpdateContentLayer(scoped_refptr<cc::Layer> content_layer); |
| 63 |
| 64 ui::ViewAndroid* view_; |
| 65 |
| 66 cc::SurfaceManager* surface_manager_; |
| 67 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 68 ReturnResourcesCallback return_resources_callback_; |
| 69 |
| 70 std::unique_ptr<cc::SurfaceFactory> surface_factory_; |
| 71 cc::SurfaceId surface_id_; |
| 72 gfx::Size current_surface_size_; |
| 73 gfx::Vector2dF location_bar_content_translation_; |
| 74 cc::Selection<gfx::SelectionBound> current_viewport_selection_; |
| 75 |
| 76 scoped_refptr<cc::Layer> content_layer_; |
| 77 |
| 78 // The layer used to draw the background when we have no content from the |
| 79 // renderer. |
| 80 scoped_refptr<cc::Layer> background_layer_; |
| 81 |
| 82 gfx::Size desired_content_size_; |
| 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid); |
| 85 }; |
| 86 |
| 87 } // namespace content |
| 88 |
| 89 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_ANDROID_H_ |
OLD | NEW |