Index: ui/android/delegated_frame_host_android.h |
diff --git a/ui/android/delegated_frame_host_android.h b/ui/android/delegated_frame_host_android.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..66939666d7afa551605dcf3ecbc96b711305559a |
--- /dev/null |
+++ b/ui/android/delegated_frame_host_android.h |
@@ -0,0 +1,96 @@ |
+// 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 UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ |
+#define UI_ANDROID_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/ui_android_export.h" |
+#include "ui/gfx/selection_bound.h" |
+ |
+namespace cc { |
+ |
+class CompositorFrame; |
+class Layer; |
+class SurfaceId; |
+class SurfaceManager; |
+class SurfaceLayer; |
+class SurfaceIdAllocator; |
+enum class SurfaceDrawStatus; |
+ |
+} // namespace cc |
+ |
+namespace ui { |
+class ViewAndroid; |
+ |
+class UI_ANDROID_EXPORT DelegatedFrameHostAndroid |
+ : public cc::SurfaceFactoryClient { |
+ public: |
+ using ReturnResourcesCallback = |
+ base::Callback<void(const cc::ReturnedResourceArray&)>; |
+ |
+ DelegatedFrameHostAndroid(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; |
+ |
+ // Should only be called when the host has a content layer. |
+ void RequestCopyOfSurface( |
+ std::unique_ptr<cc::CopyOutputRequest> copy_output_request); |
+ |
+ void OutputSurfaceChanged(); |
+ |
+ void UpdateBackgroundColor(SkColor color); |
+ |
+ void UpdateSize(const gfx::Size& desired_content_size); |
no sievers
2016/08/12 19:33:04
nit: can you call this 'UpdateContainerSize()'?
Khushal
2016/08/16 01:34:23
Done.
|
+ |
+ // Returns the layer holding the content from the renderer. Can be null. |
+ cc::Layer* GetContentLayer() const; |
+ |
+ private: |
+ // cc::SurfaceFactoryClient implementation. |
+ void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
+ void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
+ |
+ void CreateContentLayer(); |
+ void DestroyContentLayer(); |
+ |
+ void UpdateBackgroundLayer(); |
+ |
+ 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::SurfaceLayer> content_layer_; |
+ |
+ scoped_refptr<cc::Layer> background_layer_; |
+ |
+ gfx::Size desired_content_size_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DelegatedFrameHostAndroid); |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_ANDROID_DELEGATED_FRAME_HOST_ANDROID_H_ |