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 BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ |
| 6 #define BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ |
| 7 |
| 8 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" |
| 10 #include "blimp/client/core/compositor/blimp_compositor.h" |
| 11 #include "ui/gfx/native_widget_types.h" |
| 12 |
| 13 namespace cc { |
| 14 namespace proto { |
| 15 class CompositorMessage; |
| 16 } // namespace proto |
| 17 } // namespace cc |
| 18 |
| 19 namespace ui { |
| 20 class MotionEvent; |
| 21 } // namespace ui |
| 22 |
| 23 namespace blimp { |
| 24 namespace client { |
| 25 class BlimpCompositor; |
| 26 class BlimpRenderWidgetDelegate; |
| 27 class CompositorDepsProvider; |
| 28 |
| 29 // The BlimpRenderWidget is the blimp counterpart to the content::RenderWidget. |
| 30 // This is the model object that owns all the compositing and input state for a |
| 31 // render widget on the engine, and is our connection to the engine side |
| 32 // renderer. |
| 33 class BlimpRenderWidget : public BlimpCompositorClient { |
| 34 public: |
| 35 BlimpRenderWidget(int32_t render_widget_id, |
| 36 BlimpRenderWidgetDelegate* delegate); |
| 37 ~BlimpRenderWidget() override; |
| 38 |
| 39 // This returns the unique id for this RenderWidget. The id is generated on |
| 40 // the engine, see EngineRenderWidgetFeature, and is unique across all tabs. |
| 41 int32_t GetId() const; |
| 42 |
| 43 void set_did_swap_buffers_callback(base::Closure callback) { |
| 44 did_swap_buffers_callback_ = callback; |
| 45 } |
| 46 |
| 47 // The following method is used when the compositor for the renderwidget has |
| 48 // an on-screen context to draw directly to the native widget. It is legal to |
| 49 // call this only if use_delegated_rendering is true for the |
| 50 // CompositorDepsProvider passed when creating the widget. |
| 51 virtual void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
| 52 |
| 53 virtual void SetVisible(bool visible); |
| 54 |
| 55 // Move to the BlimpRenderWidgetView. |
| 56 bool OnTouchEvent(const ui::MotionEvent& motion_event); |
| 57 |
| 58 virtual void OnCompositorMessageReceived( |
| 59 std::unique_ptr<cc::proto::CompositorMessage> message); |
| 60 |
| 61 BlimpCompositor* GetCompositorForTesting() const { return compositor_.get(); } |
| 62 |
| 63 private: |
| 64 friend class BlimpRenderWidgetTest; |
| 65 class DirectRenderingDeps; |
| 66 |
| 67 // BlimpCompositorClient implementation. |
| 68 void DidCompleteSwapBuffers() override; |
| 69 void DidCommitAndDrawFrame() override; |
| 70 void SendWebGestureEvent( |
| 71 const blink::WebGestureEvent& gesture_event) override; |
| 72 void SendCompositorMessage( |
| 73 const cc::proto::CompositorMessage& message) override; |
| 74 void RequestOutputSurface() override; |
| 75 |
| 76 const int32_t render_widget_id_; |
| 77 |
| 78 BlimpRenderWidgetDelegate* delegate_; |
| 79 |
| 80 std::unique_ptr<DirectRenderingDeps> direct_rendering_deps_; |
| 81 |
| 82 base::Closure did_swap_buffers_callback_; |
| 83 |
| 84 // TODO(khushalsagar): Change this to the remote compositor once it moves to |
| 85 // cc/blimp. |
| 86 std::unique_ptr<BlimpCompositor> compositor_; |
| 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(BlimpRenderWidget); |
| 89 }; |
| 90 |
| 91 } // namespace client |
| 92 } // namespace blimp |
| 93 |
| 94 #endif // BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_RENDER_WIDGET_H_ |
OLD | NEW |