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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « components/framelet/renderer/DEPS ('k') | components/framelet/renderer/framelet_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 COMPONENTS_FRAMELET_RENDERER_FRAMELET_CONTAINER_H_
6 #define COMPONENTS_FRAMELET_RENDERER_FRAMELET_CONTAINER_H_
7
8 #include "cc/layers/solid_color_layer.h"
9 #include "cc/layers/ui_resource_layer.h"
10 #include "cc/surfaces/surface_id.h"
11 #include "components/framelet/common/framelet.mojom.h"
12 #include "components/guest_view/common/guest_view_constants.h"
13 #include "components/guest_view/renderer/guest_view_container.h"
14 #include "ipc/ipc_sender.h"
15 #include "mojo/public/cpp/bindings/binding.h"
16 #include "third_party/WebKit/public/platform/WebURLLoader.h"
17 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
18 #include "third_party/WebKit/public/web/WebFrameletClient.h"
19 #include "ui/gfx/geometry/size.h"
20
21 namespace blink {
22 class WebLayer;
23 }
24
25 namespace cc {
26 struct SurfaceSequence;
27 }
28
29 namespace gfx {
30 class Image;
31 }
32
33 namespace framelet {
34
35 enum class ResourceUsageLevel : int;
36
37 enum class ResourceMonitoring { ENABLED, DISABLED };
38
39 class FrameletContainer : public guest_view::GuestViewContainer,
40 public blink::WebFrameletClient,
41 public framelet::mojom::FrameletClient {
42 public:
43 FrameletContainer(content::RenderFrame* render_frame,
44 const GURL& url,
45 IPC::Sender* thread_safe_sender);
46 ~FrameletContainer() override;
47
48 const GURL& url() const { return url_; }
49
50 const gfx::Size& element_size() const { return element_size_; }
51
52 bool focused() const { return focused_; }
53 bool visible() const { return visible_; }
54
55 blink::WebFocusType focus_type() const { return focus_type_; }
56
57 bool has_guest() const { return framelet_guest_.is_bound(); }
58
59 int guest_instance_id() const { return guest_instance_id_; }
60
61 // WebFrameletClient implementation.
62 void didAttach(blink::WebFramelet* framelet) override;
63 void didDetach() override;
64 void forwardInputEvent(const blink::WebInputEvent* input_event) override;
65 void frameRectsChanged(const blink::WebRect& frame_rect) override;
66 void updateFocus(bool focused, blink::WebFocusType focus_type) override;
67 void updateVisibility(bool visible) override;
68
69 private:
70 mojo::Map<mojo::String, mojom::ValuePtr> GetParams(
71 ResourceMonitoring resource_monitoring) const;
72 void CreateFrameletIfReady(ResourceMonitoring resource_monitoring);
73 void UpdateClickToPlayLayerPosition();
74
75 // FrameletClient:
76 void ReportMemoryUsage(mojom::ResourceUsageLevel usage_level) override;
77 void SetChildFrameSurface(mus::mojom::SurfaceIdPtr surface_id,
78 mojo::SizePtr frame_size,
79 float scale_factor) override;
80
81 // TODO(fsamuel): This is likely to cause tear down issues.
82 // We should not be holding a raw pointer to |sender|.
83 static void SatisfyCallbackOnCompositorThread(IPC::Sender* sender,
84 int host_routing_id,
85 int element_instance_id,
86 cc::SurfaceSequence sequence);
87 static void RequireCallbackOnCompositorThread(IPC::Sender* sender,
88 int host_routing_id,
89 int element_instance_id,
90 cc::SurfaceId id,
91 cc::SurfaceSequence sequence);
92
93 int guest_instance_id_;
94 bool focused_;
95 blink::WebFocusType focus_type_;
96 bool visible_;
97 bool killed_;
98 gfx::Size element_size_;
99 GURL url_;
100 IPC::Sender* thread_safe_sender_;
101 blink::WebFramelet* framelet_;
102
103 scoped_ptr<blink::WebLayer> web_layer_;
104 scoped_refptr<cc::SolidColorLayer> solid_layer_;
105
106 const gfx::Image& click_to_play_image_;
107 scoped_refptr<cc::UIResourceLayer> click_to_play_layer_;
108
109 mojom::FrameletPtr framelet_guest_;
110 mojo::Binding<mojom::FrameletClient> binding_;
111
112 DISALLOW_COPY_AND_ASSIGN(FrameletContainer);
113 };
114
115 } // namespace framelet
116
117 #endif // COMPONENTS_FRAMELET_RENDERER_FRAMELET_CONTAINER_H_
OLDNEW
« 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