Index: blimp/client/core/contents/blimp_contents_impl.h |
diff --git a/blimp/client/core/contents/blimp_contents_impl.h b/blimp/client/core/contents/blimp_contents_impl.h |
index 1110ccde6761bcdddd12dd9fc5bad20774843d16..0d9efb7d5c40fb2a38508295b1488405b72246c6 100644 |
--- a/blimp/client/core/contents/blimp_contents_impl.h |
+++ b/blimp/client/core/contents/blimp_contents_impl.h |
@@ -9,7 +9,10 @@ |
#include "base/observer_list.h" |
#include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" |
#include "blimp/client/core/contents/blimp_navigation_controller_impl.h" |
+#include "blimp/client/core/render_widget/blimp_render_widget_delegate.h" |
+#include "blimp/client/core/render_widget/render_widget_feature.h" |
#include "blimp/client/public/contents/blimp_contents.h" |
+#include "ui/gfx/native_widget_types.h" |
#include "url/gurl.h" |
#if defined(OS_ANDROID) |
@@ -25,11 +28,18 @@ class BlimpContentsImplAndroid; |
class BlimpContentsObserver; |
class BlimpNavigationController; |
- |
-class BlimpContentsImpl : public BlimpContents, |
- public BlimpNavigationControllerDelegate { |
+class CompositorDepsProvider; |
+class RenderWidgetFeature; |
+ |
+// BlimpContentsImpl is the implementation of the core class in |
+// //blimp/client/core, the BlimpContents. |
+class BlimpContentsImpl |
+ : public BlimpContents, |
+ public BlimpNavigationControllerDelegate, |
+ public BlimpRenderWidgetDelegate, |
+ public RenderWidgetFeature::RenderWidgetFeatureDelegate { |
public: |
- explicit BlimpContentsImpl(int id); |
+ BlimpContentsImpl(int id, RenderWidgetFeature* render_widget_feature); |
~BlimpContentsImpl() override; |
#if defined(OS_ANDROID) |
@@ -41,6 +51,7 @@ class BlimpContentsImpl : public BlimpContents, |
BlimpNavigationControllerImpl& GetNavigationController() override; |
void AddObserver(BlimpContentsObserver* observer) override; |
void RemoveObserver(BlimpContentsObserver* observer) override; |
+ void SetVisible(bool visible) override; |
// Check if some observer is in the observer list. |
bool HasObserver(BlimpContentsObserver* observer); |
@@ -50,17 +61,72 @@ class BlimpContentsImpl : public BlimpContents, |
int id() { return id_; } |
+ // BlimpRenderWidgetDelegate implementation. |
+ void SendWebGestureEvent( |
+ BlimpRenderWidget* render_widget, |
+ const blink::WebGestureEvent& gesture_event) override; |
+ void SendCompositorMessage( |
+ BlimpRenderWidget* render_widget, |
+ const cc::proto::CompositorMessage& message) override; |
+ void CompositorDidCompleteSwapBuffers() override; |
+ |
+ // RenderWidgetFeatureDelegate implementation. |
+ void OnRenderWidgetCreated(int render_widget_id) override; |
+ void OnRenderWidgetInitialized(int render_widget_id) override; |
+ void OnRenderWidgetDeleted(int render_widget_id) override; |
+ void OnCompositorMessageReceived( |
+ int render_widget_id, |
+ std::unique_ptr<cc::proto::CompositorMessage> message) override; |
+ |
+ void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
+ |
+ void set_did_complete_swap_buffers_callback(base::Closure callback) { |
+ did_complete_swap_buffers_ = callback; |
+ } |
+ |
+ // Returns the currently active widget that holds the content for this |
+ // BlimpContents. Can be null. |
+ BlimpRenderWidget* GetActiveWidget() const; |
+ |
+ // Returns the widget for the |render_widget_id|. Will return nullptr if |
+ // no widget is found. |
+ BlimpRenderWidget* GetWidgetForId(int render_widget_id); |
+ |
+ protected: |
+ // virtual for testing. |
+ virtual std::unique_ptr<BlimpRenderWidget> CreateBlimpRenderWidget( |
+ int32_t render_widget_id, |
+ BlimpRenderWidgetDelegate* delegate); |
+ |
private: |
+ // The id is assigned during contents creation. It is used by |
+ // BlimpContentsManager to control the life time of the its observer. |
+ int id_; |
+ |
+ // The bridge to the network layer that does the proto/RenderWidget id work. |
+ // TODO(mlliu): Should move this to BlimpContentsManager when its ready. |
+ RenderWidgetFeature* render_widget_feature_; |
+ |
+ bool visible_; |
+ gfx::AcceleratedWidget window_; |
+ |
+ base::Closure did_complete_swap_buffers_; |
+ |
+ // A map of render_widget_ids to the BlimpRenderWidget instance. |
+ typedef std::map<int, std::unique_ptr<BlimpRenderWidget>> RenderWidgetMap; |
+ RenderWidgetMap render_widgets_; |
+ |
+ // The |active_widget_| represents the widget from the RenderWidgetMap |
+ // that is currently visible. It corresponds to the render widget currently |
+ // initialized on the engine. |
+ BlimpRenderWidget* active_widget_; |
+ |
// Handles the back/forward list and loading URLs. |
BlimpNavigationControllerImpl navigation_controller_; |
// A list of all the observers of this BlimpContentsImpl. |
base::ObserverList<BlimpContentsObserver> observers_; |
- // The id is assigned during contents creation. It is used by |
- // BlimpContentsManager to control the life time of the its observer. |
- int id_; |
- |
DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); |
}; |