Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1824)

Unified Diff: components/framelet/renderer/framelet_container.h

Issue 1602663003: Framelet Prototype 2016 using Mojo IPC Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Disabled oilpan Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/framelet/renderer/DEPS ('k') | components/framelet/renderer/framelet_container.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/framelet/renderer/framelet_container.h
diff --git a/components/framelet/renderer/framelet_container.h b/components/framelet/renderer/framelet_container.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9c9a313291185d8596e3a40d39b1df3b8cd8db0
--- /dev/null
+++ b/components/framelet/renderer/framelet_container.h
@@ -0,0 +1,117 @@
+// Copyright 2015 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 COMPONENTS_FRAMELET_RENDERER_FRAMELET_CONTAINER_H_
+#define COMPONENTS_FRAMELET_RENDERER_FRAMELET_CONTAINER_H_
+
+#include "cc/layers/solid_color_layer.h"
+#include "cc/layers/ui_resource_layer.h"
+#include "cc/surfaces/surface_id.h"
+#include "components/framelet/common/framelet.mojom.h"
+#include "components/guest_view/common/guest_view_constants.h"
+#include "components/guest_view/renderer/guest_view_container.h"
+#include "ipc/ipc_sender.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "third_party/WebKit/public/platform/WebURLLoader.h"
+#include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
+#include "third_party/WebKit/public/web/WebFrameletClient.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace blink {
+class WebLayer;
+}
+
+namespace cc {
+struct SurfaceSequence;
+}
+
+namespace gfx {
+class Image;
+}
+
+namespace framelet {
+
+enum class ResourceUsageLevel : int;
+
+enum class ResourceMonitoring { ENABLED, DISABLED };
+
+class FrameletContainer : public guest_view::GuestViewContainer,
+ public blink::WebFrameletClient,
+ public framelet::mojom::FrameletClient {
+ public:
+ FrameletContainer(content::RenderFrame* render_frame,
+ const GURL& url,
+ IPC::Sender* thread_safe_sender);
+ ~FrameletContainer() override;
+
+ const GURL& url() const { return url_; }
+
+ const gfx::Size& element_size() const { return element_size_; }
+
+ bool focused() const { return focused_; }
+ bool visible() const { return visible_; }
+
+ blink::WebFocusType focus_type() const { return focus_type_; }
+
+ bool has_guest() const { return framelet_guest_.is_bound(); }
+
+ int guest_instance_id() const { return guest_instance_id_; }
+
+ // WebFrameletClient implementation.
+ void didAttach(blink::WebFramelet* framelet) override;
+ void didDetach() override;
+ void forwardInputEvent(const blink::WebInputEvent* input_event) override;
+ void frameRectsChanged(const blink::WebRect& frame_rect) override;
+ void updateFocus(bool focused, blink::WebFocusType focus_type) override;
+ void updateVisibility(bool visible) override;
+
+ private:
+ mojo::Map<mojo::String, mojom::ValuePtr> GetParams(
+ ResourceMonitoring resource_monitoring) const;
+ void CreateFrameletIfReady(ResourceMonitoring resource_monitoring);
+ void UpdateClickToPlayLayerPosition();
+
+ // FrameletClient:
+ void ReportMemoryUsage(mojom::ResourceUsageLevel usage_level) override;
+ void SetChildFrameSurface(mus::mojom::SurfaceIdPtr surface_id,
+ mojo::SizePtr frame_size,
+ float scale_factor) override;
+
+ // TODO(fsamuel): This is likely to cause tear down issues.
+ // We should not be holding a raw pointer to |sender|.
+ static void SatisfyCallbackOnCompositorThread(IPC::Sender* sender,
+ int host_routing_id,
+ int element_instance_id,
+ cc::SurfaceSequence sequence);
+ static void RequireCallbackOnCompositorThread(IPC::Sender* sender,
+ int host_routing_id,
+ int element_instance_id,
+ cc::SurfaceId id,
+ cc::SurfaceSequence sequence);
+
+ int guest_instance_id_;
+ bool focused_;
+ blink::WebFocusType focus_type_;
+ bool visible_;
+ bool killed_;
+ gfx::Size element_size_;
+ GURL url_;
+ IPC::Sender* thread_safe_sender_;
+ blink::WebFramelet* framelet_;
+
+ scoped_ptr<blink::WebLayer> web_layer_;
+ scoped_refptr<cc::SolidColorLayer> solid_layer_;
+
+ const gfx::Image& click_to_play_image_;
+ scoped_refptr<cc::UIResourceLayer> click_to_play_layer_;
+
+ mojom::FrameletPtr framelet_guest_;
+ mojo::Binding<mojom::FrameletClient> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(FrameletContainer);
+};
+
+} // namespace framelet
+
+#endif // COMPONENTS_FRAMELET_RENDERER_FRAMELET_CONTAINER_H_
« no previous file with comments | « components/framelet/renderer/DEPS ('k') | components/framelet/renderer/framelet_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698