Chromium Code Reviews| 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..37dba27dcdf1cde65ab59d165022056c1d3509f0 |
| --- /dev/null |
| +++ b/blimp/client/core/render_widget/blimp_render_widget.h |
| @@ -0,0 +1,93 @@ |
| +// 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 RenderWidget. This is |
|
nyquist
2016/08/16 23:14:57
content::RenderWidget?
Khushal
2016/08/18 02:01:46
Done.
|
| +// 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, |
| + CompositorDepsProvider* compositor_deps_provider, |
| + BlimpRenderWidgetDelegate* delegate); |
| + ~BlimpRenderWidget() override; |
| + |
| + int32_t GetId() const; |
|
nyquist
2016/08/16 23:14:57
What is this ID? How does it relate to the ID in B
Khushal
2016/08/18 02:01:46
Added a comment.
|
| + |
| + 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_; |
| + |
| + CompositorDepsProvider* compositor_deps_provider_; |
| + 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_ |