summaryrefslogtreecommitdiffstats
path: root/widget/PluginWidgetProxy.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /widget/PluginWidgetProxy.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'widget/PluginWidgetProxy.h')
-rw-r--r--widget/PluginWidgetProxy.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/widget/PluginWidgetProxy.h b/widget/PluginWidgetProxy.h
new file mode 100644
index 000000000..3fb86a516
--- /dev/null
+++ b/widget/PluginWidgetProxy.h
@@ -0,0 +1,78 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_widget_RemotePlugin_h__
+#define mozilla_widget_RemotePlugin_h__
+
+#include "PuppetWidget.h"
+#include "mozilla/dom/TabChild.h"
+
+/*
+ * PluginWidgetProxy is a nsIWidget wrapper we hand around in plugin and layout
+ * code. It wraps a native widget it creates in the chrome process. Since this
+ * is for plugins, only a limited set of the widget apis need to be overridden,
+ * the rest of the implementation is in PuppetWidget or nsBaseWidget.
+ */
+
+namespace mozilla {
+namespace plugins {
+class PluginWidgetChild;
+} // namespace plugins
+namespace widget {
+
+class PluginWidgetProxy final : public PuppetWidget
+{
+public:
+ explicit PluginWidgetProxy(dom::TabChild* aTabChild,
+ mozilla::plugins::PluginWidgetChild* aChannel);
+
+protected:
+ virtual ~PluginWidgetProxy();
+
+public:
+ NS_DECL_ISUPPORTS_INHERITED
+
+ // nsIWidget
+ using PuppetWidget::Create; // for Create signature not overridden here
+ virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
+ nsNativeWidget aNativeParent,
+ const LayoutDeviceIntRect& aRect,
+ nsWidgetInitData* aInitData = nullptr)
+ override;
+ virtual void Destroy() override;
+ NS_IMETHOD SetFocus(bool aRaise = false) override;
+ NS_IMETHOD SetParent(nsIWidget* aNewParent) override;
+
+ virtual nsIWidget* GetParent(void) override;
+ virtual void* GetNativeData(uint32_t aDataType) override;
+#if defined(XP_WIN)
+ void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
+#endif
+ virtual nsTransparencyMode GetTransparencyMode() override
+ { return eTransparencyOpaque; }
+ virtual void GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) override;
+
+public:
+ /**
+ * When tabs are closed PPluginWidget can terminate before plugin code is
+ * finished tearing us down. When this happens plugin calls over mActor
+ * fail triggering an abort in the content process. To protect against this
+ * the connection tells us when it is torn down here so we can avoid making
+ * calls while content finishes tearing us down.
+ */
+ void ChannelDestroyed() { mActor = nullptr; }
+
+private:
+ // Our connection with the chrome widget, created on PBrowser.
+ mozilla::plugins::PluginWidgetChild* mActor;
+ // PuppetWidget does not implement parent apis, but we need
+ // them for plugin widgets.
+ nsCOMPtr<nsIWidget> mParent;
+ uintptr_t mCachedPluginPort;
+};
+
+} // namespace widget
+} // namespace mozilla
+
+#endif