2009-12-16 23:08:45 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2009-06-30 22:51:05 +04:00
|
|
|
* vim: sw=4 ts=4 et :
|
2012-05-21 15:12:37 +04: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/. */
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2009-10-27 22:51:12 +03:00
|
|
|
#ifndef mozilla_PluginLibrary_h
|
|
|
|
#define mozilla_PluginLibrary_h 1
|
2009-06-30 22:51:05 +04:00
|
|
|
|
|
|
|
#include "prlink.h"
|
2009-10-27 22:51:12 +03:00
|
|
|
#include "npapi.h"
|
2010-04-13 20:10:00 +04:00
|
|
|
#include "npfunctions.h"
|
2009-10-27 22:51:12 +03:00
|
|
|
#include "nscore.h"
|
2017-08-17 02:48:52 +03:00
|
|
|
#include "nsStringFwd.h"
|
2011-02-09 01:16:07 +03:00
|
|
|
#include "nsTArray.h"
|
2012-07-27 18:03:27 +04:00
|
|
|
#include "nsError.h"
|
2013-09-24 14:04:14 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2015-03-29 17:59:08 +03:00
|
|
|
#include "nsSize.h"
|
2015-04-21 18:04:57 +03:00
|
|
|
#include "nsRect.h"
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2011-02-17 01:43:31 +03:00
|
|
|
class nsNPAPIPlugin;
|
2009-12-16 23:08:45 +03:00
|
|
|
|
2011-02-12 19:07:10 +03:00
|
|
|
namespace mozilla {
|
2015-12-18 06:39:10 +03:00
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
|
|
|
}
|
2011-02-12 19:07:10 +03:00
|
|
|
namespace layers {
|
|
|
|
class Image;
|
|
|
|
class ImageContainer;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2011-02-12 19:07:10 +03:00
|
|
|
|
2015-07-01 01:08:19 +03:00
|
|
|
class nsIClearSiteDataCallback;
|
|
|
|
|
|
|
|
#define nsIGetSitesWithDataCallback_CID {0xd0028b83, 0xfdf9, 0x4c53, {0xb7, 0xbb, 0x47, 0x46, 0x0f, 0x6b, 0x83, 0x6c}}
|
|
|
|
class nsIGetSitesWithDataCallback : public nsISupports {
|
|
|
|
public:
|
|
|
|
NS_IMETHOD SitesWithData(InfallibleTArray<nsCString>& result) = 0;
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(nsIGetSitesWithDataCallback_CID)
|
|
|
|
};
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIGetSitesWithDataCallback, nsIGetSitesWithDataCallback_CID)
|
2011-02-12 19:07:10 +03:00
|
|
|
|
2009-06-30 22:51:05 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2009-10-27 22:51:12 +03:00
|
|
|
class PluginLibrary
|
2009-06-30 22:51:05 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-12-18 06:39:10 +03:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
2009-10-27 22:51:12 +03:00
|
|
|
virtual ~PluginLibrary() { }
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2009-12-16 23:08:45 +03:00
|
|
|
/**
|
|
|
|
* Inform this library about the nsNPAPIPlugin which owns it. This
|
|
|
|
* object will hold a weak pointer to the plugin.
|
|
|
|
*/
|
|
|
|
virtual void SetPlugin(nsNPAPIPlugin* plugin) = 0;
|
|
|
|
|
2009-10-27 22:51:12 +03:00
|
|
|
virtual bool HasRequiredFunctions() = 0;
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2017-07-21 03:52:30 +03:00
|
|
|
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
2009-10-27 22:51:12 +03:00
|
|
|
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0;
|
|
|
|
#else
|
|
|
|
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0;
|
|
|
|
#endif
|
|
|
|
virtual nsresult NP_Shutdown(NPError* error) = 0;
|
2010-01-29 23:18:50 +03:00
|
|
|
virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0;
|
2009-10-27 22:51:12 +03:00
|
|
|
virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
|
|
|
|
void *aValue, NPError* error) = 0;
|
2014-02-11 02:57:01 +04:00
|
|
|
#if defined(XP_WIN) || defined(XP_MACOSX)
|
2009-10-27 22:51:12 +03:00
|
|
|
virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0;
|
|
|
|
#endif
|
|
|
|
virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
|
2017-02-23 20:37:42 +03:00
|
|
|
int16_t argc, char* argn[],
|
2009-10-27 22:51:12 +03:00
|
|
|
char* argv[], NPSavedData* saved,
|
|
|
|
NPError* error) = 0;
|
2010-09-10 22:28:52 +04:00
|
|
|
|
2011-02-09 01:16:07 +03:00
|
|
|
virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
|
2015-07-01 01:08:19 +03:00
|
|
|
uint64_t maxAge, nsCOMPtr<nsIClearSiteDataCallback> callback) = 0;
|
|
|
|
virtual nsresult NPP_GetSitesWithData(nsCOMPtr<nsIGetSitesWithDataCallback> callback) = 0;
|
2011-02-09 01:16:07 +03:00
|
|
|
|
2010-09-10 22:28:52 +04:00
|
|
|
virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
|
2012-11-10 19:45:52 +04:00
|
|
|
virtual nsresult GetImageContainer(NPP instance, mozilla::layers::ImageContainer** aContainer) = 0;
|
2011-02-23 08:38:09 +03:00
|
|
|
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
|
2015-12-02 22:31:16 +03:00
|
|
|
virtual void DidComposite(NPP instance) = 0;
|
2012-08-02 00:34:08 +04:00
|
|
|
virtual bool IsOOP() = 0;
|
2011-06-30 20:46:26 +04:00
|
|
|
#if defined(XP_MACOSX)
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0;
|
2015-09-17 23:31:34 +03:00
|
|
|
#endif
|
|
|
|
#if defined(XP_MACOSX) || defined(XP_WIN)
|
2012-10-16 23:41:21 +04:00
|
|
|
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) = 0;
|
2011-06-30 20:46:26 +04:00
|
|
|
#endif
|
2016-03-01 21:48:25 +03:00
|
|
|
#if defined(XP_WIN)
|
|
|
|
virtual nsresult GetScrollCaptureContainer(NPP aInstance, mozilla::layers::ImageContainer** aContainer) = 0;
|
|
|
|
#endif
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
virtual nsresult HandledWindowedPluginKeyEvent(
|
|
|
|
NPP aInstance,
|
|
|
|
const mozilla::NativeEventData& aNativeKeyData,
|
|
|
|
bool aIsCOnsumed) = 0;
|
2011-06-30 20:46:26 +04:00
|
|
|
|
2011-02-17 01:43:31 +03:00
|
|
|
/**
|
|
|
|
* The next three methods are the third leg in the trip to
|
|
|
|
* PluginInstanceParent. They approximately follow the ReadbackSink
|
|
|
|
* API.
|
|
|
|
*/
|
|
|
|
virtual nsresult SetBackgroundUnknown(NPP instance) = 0;
|
|
|
|
virtual nsresult BeginUpdateBackground(NPP instance,
|
2015-12-18 06:39:10 +03:00
|
|
|
const nsIntRect&, DrawTarget**) = 0;
|
2015-12-18 06:39:09 +03:00
|
|
|
virtual nsresult EndUpdateBackground(NPP instance, const nsIntRect&) = 0;
|
2015-03-17 20:28:32 +03:00
|
|
|
virtual nsresult GetRunID(uint32_t* aRunID) = 0;
|
2015-06-18 01:08:12 +03:00
|
|
|
virtual void SetHasLocalInstance() = 0;
|
2009-06-30 22:51:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2009-10-27 22:51:12 +03:00
|
|
|
#endif // ifndef mozilla_PluginLibrary_h
|