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 #include "PuppetWidget.h"
9 #include "mozilla/dom/TabChild.h"
12 * PluginWidgetProxy is a nsIWidget wrapper we hand around in plugin and layout
13 * code. It wraps a native widget it creates in the chrome process. Since this
14 * is for plugins, only a limited set of the widget apis need to be overridden,
15 * the rest of the implementation is in PuppetWidget or nsBaseWidget.
20 class PluginWidgetChild
;
24 class PluginWidgetProxy MOZ_FINAL
: public PuppetWidget
27 explicit PluginWidgetProxy(dom::TabChild
* aTabChild
,
28 mozilla::plugins::PluginWidgetChild
* aChannel
);
31 virtual ~PluginWidgetProxy();
34 NS_DECL_ISUPPORTS_INHERITED
37 NS_IMETHOD
Create(nsIWidget
* aParent
, nsNativeWidget aNativeParent
,
38 const nsIntRect
& aRect
, nsDeviceContext
* aContext
,
39 nsWidgetInitData
* aInitData
= nullptr) MOZ_OVERRIDE
;
40 NS_IMETHOD
Destroy() MOZ_OVERRIDE
;
41 NS_IMETHOD
Show(bool aState
) MOZ_OVERRIDE
;
42 NS_IMETHOD
Invalidate(const nsIntRect
& aRect
) MOZ_OVERRIDE
;
43 NS_IMETHOD
Resize(double aWidth
, double aHeight
, bool aRepaint
) MOZ_OVERRIDE
;
44 NS_IMETHOD
Resize(double aX
, double aY
, double aWidth
,
45 double aHeight
, bool aRepaint
) MOZ_OVERRIDE
;
46 NS_IMETHOD
Move(double aX
, double aY
) MOZ_OVERRIDE
;
47 NS_IMETHOD
SetFocus(bool aRaise
= false) MOZ_OVERRIDE
;
48 NS_IMETHOD
SetParent(nsIWidget
* aNewParent
) MOZ_OVERRIDE
;
50 virtual nsIWidget
* GetParent(void) MOZ_OVERRIDE
;
51 virtual void* GetNativeData(uint32_t aDataType
) MOZ_OVERRIDE
;
52 virtual nsresult
SetWindowClipRegion(const nsTArray
<nsIntRect
>& aRects
,
53 bool aIntersectWithExisting
) MOZ_OVERRIDE
;
56 virtual nsTransparencyMode
GetTransparencyMode() MOZ_OVERRIDE
57 { return eTransparencyOpaque
; }
61 * When tabs are closed PPluginWidget can terminate before plugin code is
62 * finished tearing us down. When this happens plugin calls over mActor
63 * fail triggering an abort in the content process. To protect against this
64 * the connection tells us when it is torn down here so we can avoid making
65 * calls while content finishes tearing us down.
67 void ChannelDestroyed() { mActor
= nullptr; }
70 // Our connection with the chrome widget, created on PBrowser.
71 mozilla::plugins::PluginWidgetChild
* mActor
;
72 // PuppetWidget does not implement parent apis, but we need
73 // them for plugin widgets.
74 nsCOMPtr
<nsIWidget
> mParent
;
78 } // namespace mozilla