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__
9 # error "Plugin widgets are Windows-only."
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.
24 class PluginWidgetChild
;
25 } // namespace plugins
28 class PluginWidgetProxy final
: public PuppetWidget
{
30 explicit PluginWidgetProxy(dom::TabChild
* aTabChild
,
31 mozilla::plugins::PluginWidgetChild
* aChannel
);
34 virtual ~PluginWidgetProxy();
37 NS_DECL_ISUPPORTS_INHERITED
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
;
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; }
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
;
78 } // namespace mozilla