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

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

Issue 1560553002: Framelet Prototype 2016 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + Applied Brett's Windows + Fixed security issue 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..f12238e4e04d93042d965d2616b4a8f7b0052c46
--- /dev/null
+++ b/components/framelet/renderer/framelet_container.h
@@ -0,0 +1,120 @@
+// 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/guest_view/common/guest_view_constants.h"
+#include "components/guest_view/renderer/guest_view_container.h"
+#include "ipc/ipc_sender.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:
+ 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 guest_instance_id_ != guest_view::kInstanceIDNone;
+ }
+
+ int guest_instance_id() const { return guest_instance_id_; }
+
+ void Attach(int guest_instance_id);
+ void Detach();
+
+ // GuestViewContainer implementation.
+ bool OnMessage(const IPC::Message& message) override;
+
+ // 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:
+ void CreateFrameletIfReady(ResourceMonitoring resource_monitoring);
+ void UpdateClickToPlayLayerPosition();
+
+ // 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);
+
+ // Message handlers
+ void OnReportMemoryUsage(int element_instance_id,
+ const ResourceUsageLevel& memory_usage);
+ void OnSetChildFrameSurface(int element_instance_id,
+ const cc::SurfaceId& surface_id,
+ const gfx::Size& frame_size,
+ float scale_factor,
+ const 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_;
+
+ 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