Index: content/browser/renderer_host/delegated_frame_host_android.h |
diff --git a/content/browser/renderer_host/delegated_frame_host_android.h b/content/browser/renderer_host/delegated_frame_host_android.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..78bfbc532c6f020aff795f0596dfa10ce61f188d |
--- /dev/null |
+++ b/content/browser/renderer_host/delegated_frame_host_android.h |
@@ -0,0 +1,89 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_ANDROID_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_ANDROID_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "cc/resources/returned_resource.h" |
+#include "cc/surfaces/surface_factory.h" |
+#include "cc/surfaces/surface_factory_client.h" |
+#include "ui/android/view_android.h" |
+#include "ui/gfx/selection_bound.h" |
+ |
+namespace cc { |
+ |
+class CompositorFrame; |
+class SurfaceId; |
+class SurfaceManager; |
+class SurfaceLayer; |
+class SurfaceIdAllocator; |
+enum class SurfaceDrawStatus; |
+ |
+} // namespace cc |
+ |
+namespace content { |
+ |
+class DelegatedFrameHostAndroid : public cc::SurfaceFactoryClient { |
+ public: |
+ using ReturnResourcesCallback = |
+ base::Callback<void(const cc::ReturnedResourceArray&)>; |
+ |
+ DelegatedFrameHostAndroid(ui::ViewAndroid* view, |
+ SkColor background_color, |
+ ReturnResourcesCallback return_resources_callback); |
+ |
+ ~DelegatedFrameHostAndroid(); |
+ |
+ void SubmitCompositorFrame(cc::CompositorFrame frame, |
+ cc::SurfaceFactory::DrawCallback draw_callback); |
+ |
+ void DestroyDelegatedContent(); |
+ |
+ uint32_t GetSurfaceClientId() const; |
+ |
+ void OutputSurfaceChanged(); |
+ |
+ void UpdateBackgroundColor(SkColor color); |
+ |
+ void UpdateSize(const gfx::Size& desired_content_size); |
+ |
+ cc::Layer* GetContentLayer() const; |
+ |
+ private: |
+ // cc::SurfaceFactoryClient implementation. |
+ void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
+ void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
+ |
+ scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer(); |
+ |
+ void UpdateContentLayer(scoped_refptr<cc::Layer> content_layer); |
+ |
+ ui::ViewAndroid* view_; |
+ |
+ cc::SurfaceManager* surface_manager_; |
+ std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
+ ReturnResourcesCallback return_resources_callback_; |
+ |
+ std::unique_ptr<cc::SurfaceFactory> surface_factory_; |
+ cc::SurfaceId surface_id_; |
+ gfx::Size current_surface_size_; |
+ gfx::Vector2dF location_bar_content_translation_; |
+ cc::Selection<gfx::SelectionBound> current_viewport_selection_; |
+ |
+ scoped_refptr<cc::Layer> content_layer_; |
+ |
+ // The layer used to draw the background when we have no content from the |
+ // renderer. |
+ scoped_refptr<cc::Layer> background_layer_; |
+ |
+ gfx::Size desired_content_size_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_ANDROID_H_ |