Bug 1527719 [wpt PR 15359] - KV storage: make backingStore return the same frozen...
[gecko.git] / widget / PluginWidgetProxy.h
blob3502d24a152ae4199b975e5d1c7b77ca3d815364
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_widget_RemotePlugin_h__
6 #define mozilla_widget_RemotePlugin_h__
8 #ifndef XP_WIN
9 # error "Plugin widgets are Windows-only."
10 #endif
12 #include "PuppetWidget.h"
13 #include "mozilla/dom/TabChild.h"
16 * PluginWidgetProxy is a nsIWidget wrapper we hand around in plugin and layout
17 * code. It wraps a native widget it creates in the chrome process. Since this
18 * is for plugins, only a limited set of the widget apis need to be overridden,
19 * the rest of the implementation is in PuppetWidget or nsBaseWidget.
22 namespace mozilla {
23 namespace plugins {
24 class PluginWidgetChild;
25 } // namespace plugins
26 namespace widget {
28 class PluginWidgetProxy final : public PuppetWidget {
29 public:
30 explicit PluginWidgetProxy(dom::TabChild* aTabChild,
31 mozilla::plugins::PluginWidgetChild* aChannel);
33 protected:
34 virtual ~PluginWidgetProxy();
36 public:
37 NS_DECL_ISUPPORTS_INHERITED
39 // nsIWidget
40 using PuppetWidget::Create; // for Create signature not overridden here
41 virtual MOZ_MUST_USE nsresult
42 Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
43 const LayoutDeviceIntRect& aRect,
44 nsWidgetInitData* aInitData = nullptr) override;
45 virtual void Destroy() override;
46 virtual nsresult SetFocus(bool aRaise = false) override;
47 virtual void SetParent(nsIWidget* aNewParent) override;
49 virtual nsIWidget* GetParent(void) override;
50 virtual void* GetNativeData(uint32_t aDataType) override;
51 void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
52 virtual nsTransparencyMode GetTransparencyMode() override {
53 return eTransparencyOpaque;
55 virtual void GetWindowClipRegion(
56 nsTArray<LayoutDeviceIntRect>* aRects) override;
58 public:
59 /**
60 * When tabs are closed PPluginWidget can terminate before plugin code is
61 * finished tearing us down. When this happens plugin calls over mActor
62 * fail triggering an abort in the content process. To protect against this
63 * the connection tells us when it is torn down here so we can avoid making
64 * calls while content finishes tearing us down.
66 void ChannelDestroyed() { mActor = nullptr; }
68 private:
69 // Our connection with the chrome widget, created on PBrowser.
70 mozilla::plugins::PluginWidgetChild* mActor;
71 // PuppetWidget does not implement parent apis, but we need
72 // them for plugin widgets.
73 nsCOMPtr<nsIWidget> mParent;
74 uintptr_t mCachedPluginPort;
77 } // namespace widget
78 } // namespace mozilla
80 #endif