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

Side by Side Diff: components/framelet/browser/framelet_guest.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, 10 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
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_BROWSER_FRAMELET_GUEST_H_
6 #define COMPONENTS_FRAMELET_BROWSER_FRAMELET_GUEST_H_
7
8 #include "components/framelet/browser/framelet_memory_tracker_client.h"
9 #include "components/framelet/browser/resource_usage_reporter.h"
10 #include "components/framelet/browser/resource_usage_reporter_client.h"
11 #include "components/framelet/common/framelet.mojom.h"
12 #include "components/guest_view/browser/guest_view.h"
13 #include "mojo/public/cpp/bindings/binding.h"
14
15 namespace blink {
16 class WebInputEvent;
17 }
18
19 namespace cc {
20 struct SurfaceId;
21 struct SurfaceSequence;
22 }
23
24 namespace framelet {
25
26 class FrameletGuest : public guest_view::GuestView<FrameletGuest>,
27 public FrameletMemoryTrackerClient,
28 public ResourceUsageReporterClient<int>,
29 public mojom::Framelet {
30 public:
31 static const char Type[];
32
33 static guest_view::GuestViewBase* Create(
34 content::WebContents* owner_web_contents);
35
36 void Bind(mojo::InterfaceRequest<mojom::Framelet> request);
37
38 private:
39 explicit FrameletGuest(content::WebContents* owner_web_contents);
40 ~FrameletGuest() override;
41
42 // mojom::Framelet implementation.
43 void Attach(mojom::FrameletClientPtr client,
44 mojo::Map<mojo::String, mojom::ValuePtr> params) override;
45 void Destroy() override;
46 void ForwardInput(mojo::Array<uint8_t> event) override;
47 void Resize(mojo::SizePtr new_size) override;
48 void SetFocus(bool focused, mojom::FocusType focus_type) override;
49 void SetVisible(bool visible) override;
50
51 // FrameletMemoryTrackerClient implementation.
52 void ReportHeapSize(int heap_size) override;
53
54 // ResourceUsageReporterClient implementation.
55 void OnResourceUsageLevelChanged(
56 const ResourceUsageLevel& usage_level) override;
57 scoped_ptr<ResourceUsageRange<int>> GetRangeForUsageLevel(
58 const ResourceUsageLevel& usage_level) const override;
59
60 // BrowserPluginGuestDelegate implementation.
61 bool SetChildFrameSurface(const cc::SurfaceId& surface_id,
62 const gfx::Size& frame_size,
63 float scale_factor,
64 const cc::SurfaceSequence& sequence) override;
65
66 // content::WebContentsDelegate implementation.
67 bool HandleContextMenu(const content::ContextMenuParams& params) override;
68
69 // GuestViewBase implementation.
70 bool CanRunInDetachedState() const final;
71 void CreateWebContents(
72 const base::DictionaryValue& create_params,
73 const guest_view::GuestViewBase::WebContentsCreatedCallback& callback)
74 final;
75 void DidAttachToEmbedder() final;
76 void DidInitialize(const base::DictionaryValue& create_params) final;
77 const char* GetAPINamespace() const final;
78 int GetTaskPrefix() const final;
79 void WillDestroy() final;
80
81 bool monitor_resources_;
82 scoped_ptr<ResourceUsageReporter<int>> resource_usage_reporter_;
83
84 mojom::FrameletClientPtr client_;
85 mojo::Binding<mojom::Framelet> binding_;
86
87 DISALLOW_COPY_AND_ASSIGN(FrameletGuest);
88 };
89
90 } // namespace framelet
91
92 #endif // COMPONENTS_FRAMELET_BROWSER_FRAMELET_GUEST_H_
OLDNEW
« no previous file with comments | « components/framelet/browser/framelet_factory_impl.cc ('k') | components/framelet/browser/framelet_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698