Index: blimp/client/core/render_widget/blimp_render_widget.h |
diff --git a/blimp/client/core/render_widget/blimp_render_widget.h b/blimp/client/core/render_widget/blimp_render_widget.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f3004c6a3dd0beba3d249133ffc9abc0ed69ef85 |
--- /dev/null |
+++ b/blimp/client/core/render_widget/blimp_render_widget.h |
@@ -0,0 +1,94 @@ |
+// 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 BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ |
+#define BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ |
+ |
+#include "base/callback_forward.h" |
+#include "base/macros.h" |
+#include "blimp/client/core/compositor/blimp_compositor.h" |
+#include "ui/gfx/native_widget_types.h" |
+ |
+namespace cc { |
+namespace proto { |
+class CompositorMessage; |
+} // namespace proto |
+} // namespace cc |
+ |
+namespace ui { |
+class MotionEvent; |
+} // namespace ui |
+ |
+namespace blimp { |
+namespace client { |
+class BlimpCompositor; |
+class BlimpRenderWidgetDelegate; |
+class CompositorDepsProvider; |
+ |
+// The BlimpRenderWidget is the blimp counterpart to the content::RenderWidget. |
+// This is the model object that owns all the compositing and input state for a |
+// render widget on the engine, and is our connection to the engine side |
+// renderer. |
+class BlimpRenderWidget : public BlimpCompositorClient { |
+ public: |
+ BlimpRenderWidget(int32_t render_widget_id, |
+ BlimpRenderWidgetDelegate* delegate); |
+ ~BlimpRenderWidget() override; |
+ |
+ // This returns the unique id for this RenderWidget. The id is generated on |
+ // the engine, see EngineRenderWidgetFeature, and is unique across all tabs. |
+ int32_t GetId() const; |
+ |
+ void set_did_swap_buffers_callback(base::Closure callback) { |
+ did_swap_buffers_callback_ = callback; |
+ } |
+ |
+ // The following method is used when the compositor for the renderwidget has |
+ // an on-screen context to draw directly to the native widget. It is legal to |
+ // call this only if use_delegated_rendering is true for the |
+ // CompositorDepsProvider passed when creating the widget. |
+ virtual void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
+ |
+ virtual void SetVisible(bool visible); |
+ |
+ // Move to the BlimpRenderWidgetView. |
+ bool OnTouchEvent(const ui::MotionEvent& motion_event); |
+ |
+ virtual void OnCompositorMessageReceived( |
+ std::unique_ptr<cc::proto::CompositorMessage> message); |
+ |
+ BlimpCompositor* GetCompositorForTesting() const { return compositor_.get(); } |
+ |
+ private: |
+ friend class BlimpRenderWidgetTest; |
+ class DirectRenderingDeps; |
+ |
+ // BlimpCompositorClient implementation. |
+ void DidCompleteSwapBuffers() override; |
+ void DidCommitAndDrawFrame() override; |
+ void SendWebGestureEvent( |
+ const blink::WebGestureEvent& gesture_event) override; |
+ void SendCompositorMessage( |
+ const cc::proto::CompositorMessage& message) override; |
+ void RequestOutputSurface() override; |
+ |
+ const int32_t render_widget_id_; |
+ |
+ BlimpRenderWidgetDelegate* delegate_; |
+ |
+ std::unique_ptr<DirectRenderingDeps> direct_rendering_deps_; |
+ |
+ base::Closure did_swap_buffers_callback_; |
+ |
+ // TODO(khushalsagar): Change this to the remote compositor once it moves to |
+ // cc/blimp. |
+ std::unique_ptr<BlimpCompositor> compositor_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BlimpRenderWidget); |
+}; |
+ |
+} // namespace client |
+} // namespace blimp |
+ |
+#endif // BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ |