2014-11-12 23:59:20 +03:00
|
|
|
/* 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__
|
|
|
|
|
2017-02-09 19:53:50 +03:00
|
|
|
#ifndef XP_WIN
|
|
|
|
# error "Plugin widgets are Windows-only."
|
|
|
|
#endif
|
|
|
|
|
2014-11-12 23:59:20 +03:00
|
|
|
#include "PuppetWidget.h"
|
2019-04-10 01:39:01 +03:00
|
|
|
#include "mozilla/dom/BrowserChild.h"
|
2014-11-12 23:59:20 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace plugins
|
2014-11-12 23:59:20 +03:00
|
|
|
namespace widget {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class PluginWidgetProxy final : public PuppetWidget {
|
2014-11-12 23:59:20 +03:00
|
|
|
public:
|
2019-04-10 01:39:01 +03:00
|
|
|
explicit PluginWidgetProxy(dom::BrowserChild* aBrowserChild,
|
2014-11-12 23:59:20 +03:00
|
|
|
mozilla::plugins::PluginWidgetChild* aChannel);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~PluginWidgetProxy();
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIWidget
|
2016-01-13 10:32:55 +03:00
|
|
|
using PuppetWidget::Create; // for Create signature not overridden here
|
2016-08-19 02:03:17 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult
|
|
|
|
Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr) override;
|
2016-08-10 03:04:11 +03:00
|
|
|
virtual void Destroy() override;
|
2020-01-16 17:38:40 +03:00
|
|
|
virtual void SetFocus(Raise, mozilla::dom::CallerType aCallerType) override;
|
2016-12-16 02:54:11 +03:00
|
|
|
virtual void SetParent(nsIWidget* aNewParent) override;
|
2014-11-12 23:59:20 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIWidget* GetParent(void) override;
|
|
|
|
virtual void* GetNativeData(uint32_t aDataType) override;
|
2015-06-15 18:08:51 +03:00
|
|
|
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsTransparencyMode GetTransparencyMode() override {
|
2014-11-12 23:59:20 +03:00
|
|
|
return eTransparencyOpaque;
|
|
|
|
}
|
2015-12-03 01:32:55 +03:00
|
|
|
virtual void GetWindowClipRegion(
|
|
|
|
nsTArray<LayoutDeviceIntRect>* aRects) override;
|
2014-11-12 23:59:20 +03:00
|
|
|
|
|
|
|
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;
|
2016-03-12 07:25:59 +03:00
|
|
|
uintptr_t mCachedPluginPort;
|
2014-11-12 23:59:20 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-11-12 23:59:20 +03:00
|
|
|
#endif
|