Rename plugin protocols and fix up usage

--HG--
rename : dom/plugins/NPP.ipdl => dom/plugins/PPluginInstance.ipdl
rename : dom/plugins/NPAPI.ipdl => dom/plugins/PPluginModule.ipdl
rename : dom/plugins/NPObject.ipdl => dom/plugins/PPluginScriptableObject.ipdl
rename : dom/plugins/NPBrowserStream.ipdl => dom/plugins/PPluginStream.ipdl
rename : dom/plugins/NPPInstanceChild.cpp => dom/plugins/PluginInstanceChild.cpp
rename : dom/plugins/NPPInstanceChild.h => dom/plugins/PluginInstanceChild.h
rename : dom/plugins/NPPInstanceParent.cpp => dom/plugins/PluginInstanceParent.cpp
rename : dom/plugins/NPPInstanceParent.h => dom/plugins/PluginInstanceParent.h
rename : dom/plugins/NPAPIPluginChild.cpp => dom/plugins/PluginModuleChild.cpp
rename : dom/plugins/NPAPIPluginChild.h => dom/plugins/PluginModuleChild.h
rename : dom/plugins/NPAPIPluginParent.cpp => dom/plugins/PluginModuleParent.cpp
rename : dom/plugins/NPAPIPluginParent.h => dom/plugins/PluginModuleParent.h
rename : dom/plugins/NPObjectChild.cpp => dom/plugins/PluginScriptableObjectChild.cpp
rename : dom/plugins/NPObjectChild.h => dom/plugins/PluginScriptableObjectChild.h
rename : dom/plugins/NPObjectParent.cpp => dom/plugins/PluginScriptableObjectParent.cpp
rename : dom/plugins/NPObjectParent.h => dom/plugins/PluginScriptableObjectParent.h
rename : dom/plugins/NPBrowserStreamChild.cpp => dom/plugins/PluginStreamChild.cpp
rename : dom/plugins/NPBrowserStreamChild.h => dom/plugins/PluginStreamChild.h
rename : dom/plugins/NPBrowserStreamParent.cpp => dom/plugins/PluginStreamParent.cpp
rename : dom/plugins/NPBrowserStreamParent.h => dom/plugins/PluginStreamParent.h
This commit is contained in:
Ben Turner 2009-09-08 23:31:35 -07:00
Родитель 175d63409f
Коммит 06029219b0
31 изменённых файлов: 1137 добавлений и 800 удалений

Просмотреть файл

@ -11,15 +11,15 @@
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Plugin App.
# The Original Code is Mozilla Plugins.
#
# The Initial Developer of the Original Code is
# Ben Turner <bent.mozilla@gmail.com>.
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
# Chris Jones <jones.chris.g@gmail.com>
#
# Contributor(s):
# Chris Jones <jones.chris.g@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -58,14 +58,14 @@ ifdef MOZ_IPC
EXPORTS_NAMESPACES = mozilla mozilla/plugins
EXPORTS_mozilla/plugins = \
NPAPIPluginChild.h \
NPAPIPluginParent.h \
NPObjectChild.h \
NPObjectParent.h \
NPPInstanceChild.h \
NPPInstanceParent.h \
NPBrowserStreamChild.h \
NPBrowserStreamParent.h \
PluginModuleChild.h \
PluginModuleParent.h \
PluginScriptableObjectChild.h \
PluginScriptableObjectParent.h \
PluginInstanceChild.h \
PluginInstanceParent.h \
PluginStreamChild.h \
PluginStreamParent.h \
PluginMessageUtils.h \
PluginProcessParent.h \
PluginThreadChild.h \
@ -79,15 +79,15 @@ EXPORT_LIBRARY = 1
ENABLE_CXX_EXCEPTIONS = 1
CPPSRCS = \
NPAPIPluginChild.cpp \
NPAPIPluginParent.cpp \
NPObjectChild.cpp \
NPObjectParent.cpp \
NPPInstanceChild.cpp \
NPPInstanceParent.cpp \
NPBrowserStreamParent.cpp \
NPBrowserStreamChild.cpp \
PluginInstanceChild.cpp \
PluginInstanceParent.cpp \
PluginModuleChild.cpp \
PluginModuleParent.cpp \
PluginProcessParent.cpp \
PluginScriptableObjectChild.cpp \
PluginScriptableObjectParent.cpp \
PluginStreamChild.cpp \
PluginStreamParent.cpp \
PluginThreadChild.cpp \
$(NULL)

Просмотреть файл

@ -1,43 +0,0 @@
include protocol "NPP.ipdl";
include "npapi.h";
include "nsTArray.h";
include "mozilla/plugins/PluginMessageUtils.h";
using NPError;
using nsTArray<nsCString>;
using nsTArray<intptr_t>;
using mozilla::ipc::NPRemoteIdentifier;
using nsTArray<NPRemoteIdentifier>;
namespace mozilla {
namespace plugins {
rpc protocol NPAPI
{
manages NPP;
child:
rpc NP_Initialize() returns (NPError rv);
rpc NPP(nsCString aMimeType,
uint16_t aMode,
nsTArray<nsCString> aNames,
nsTArray<nsCString> aValues) returns (NPError rv);
rpc ~NPP() returns (NPError rv);
parent:
sync NPN_GetStringIdentifier(nsCString aString) returns (NPRemoteIdentifier aId);
sync NPN_GetIntIdentifier(int32_t aInt) returns (NPRemoteIdentifier aId);
sync NPN_UTF8FromIdentifier(NPRemoteIdentifier aId) returns (nsCString aString);
sync NPN_IntFromIdentifier(NPRemoteIdentifier aId) returns (int32_t aInt);
sync NPN_IdentifierIsString(NPRemoteIdentifier aId) returns (bool aIsString);
sync NPN_GetStringIdentifiers() returns (nsTArray<nsCString> aNames,
nsTArray<NPRemoteIdentifier> aIds);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -1,33 +0,0 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
include protocol "NPP.ipdl";
using mozilla::plugins::Buffer;
using mozilla::plugins::IPCByteRanges;
using NPError;
namespace mozilla {
namespace plugins {
/**
* NPBrowserStream represents a NPStream sent from the browser to the plugin.
*/
rpc protocol NPBrowserStream
{
manager NPP;
child:
rpc NPP_WriteReady(int32_t newlength) returns (int32_t size);
rpc NPP_Write(int32_t offset, Buffer data)
returns (int32_t consumed);
rpc NPP_StreamAsFile(nsCString fname);
parent:
rpc NPN_RequestRead(IPCByteRanges ranges) returns (NPError result);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -1,84 +0,0 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
#include "NPBrowserStreamChild.h"
#include "NPPInstanceChild.h"
namespace mozilla {
namespace plugins {
NPBrowserStreamChild::NPBrowserStreamChild(NPPInstanceChild* instance,
const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType,
const bool& seekable,
NPError* rv,
uint16_t* stype)
: mInstance(instance)
, mClosed(false)
, mURL(url)
, mHeaders(headers)
{
memset(&mStream, 0, sizeof(mStream));
mStream.ndata = this;
if (!mURL.IsEmpty())
mStream.url = mURL.get();
mStream.end = length;
mStream.lastmodified = lastmodified;
if (!mHeaders.IsEmpty())
mStream.headers = mHeaders.get();
*rv = mInstance->mPluginIface->newstream(&mInstance->mData,
const_cast<char*>(mimeType.get()),
&mStream, seekable, stype);
if (*rv != NPERR_NO_ERROR)
mClosed = true;
}
nsresult
NPBrowserStreamChild::AnswerNPP_WriteReady(const int32_t& newlength,
int32_t *size)
{
if (mClosed) {
*size = 0;
return NS_OK;
}
mStream.end = newlength;
*size = mInstance->mPluginIface->writeready(&mInstance->mData, &mStream);
return NS_OK;
}
nsresult
NPBrowserStreamChild::AnswerNPP_Write(const int32_t& offset, const Buffer& data,
int32_t* consumed)
{
if (mClosed) {
*consumed = -1;
return NS_OK;
}
*consumed = mInstance->mPluginIface->write(&mInstance->mData, &mStream,
offset, data.Length(),
const_cast<char*>(data.get()));
if (*consumed < 0)
mClosed = true;
return NS_OK;
}
nsresult
NPBrowserStreamChild::AnswerNPP_StreamAsFile(const nsCString& fname)
{
if (mClosed)
return NS_OK;
mInstance->mPluginIface->asfile(&mInstance->mData, &mStream,
fname.get());
return NS_OK;
}
}
}

Просмотреть файл

@ -1,44 +0,0 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
#ifndef mozilla_plugins_NPBrowserStreamChild_h
#define mozilla_plugins_NPBrowserStreamChild_h
#include "mozilla/plugins/NPBrowserStreamProtocolChild.h"
namespace mozilla {
namespace plugins {
class NPPInstanceChild;
class NPBrowserStreamChild : public NPBrowserStreamProtocolChild
{
public:
NPBrowserStreamChild(NPPInstanceChild* instance,
const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType,
const bool& seekable,
NPError* rv,
uint16_t* stype);
virtual ~NPBrowserStreamChild() { }
virtual nsresult AnswerNPP_WriteReady(const int32_t& newlength, int32_t *size);
virtual nsresult AnswerNPP_Write(const int32_t& offset, const Buffer& data,
int32_t* consumed);
virtual nsresult AnswerNPP_StreamAsFile(const nsCString& fname);
private:
NPPInstanceChild* mInstance;
NPStream mStream;
bool mClosed;
nsCString mURL;
nsCString mHeaders;
};
} // namespace plugins
} // namespace mozilla
#endif

Просмотреть файл

@ -1,36 +0,0 @@
include protocol "NPP.ipdl";
include "npapi.h";
include "npruntime.h";
include "nsTArray.h";
include "mozilla/plugins/PluginMessageUtils.h";
using mozilla::ipc::NPRemoteIdentifier;
using nsTArray<NPRemoteIdentifier>;
using NPVariant;
using nsTArray<NPVariant>;
namespace mozilla {
namespace plugins {
rpc protocol NPObject
{
manager NPP;
child:
// NPClass methods
rpc Invalidate();
rpc HasMethod(NPRemoteIdentifier aId) returns (bool aHasMethod);
rpc Invoke(NPRemoteIdentifier aId, nsTArray<NPVariant> aArgs) returns (NPVariant aResult, bool aSuccess);
rpc InvokeDefault(NPRemoteIdentifier aId, nsTArray<NPVariant> aArgs) returns (NPVariant aResult, bool aSuccess);
rpc HasProperty(NPRemoteIdentifier aId) returns (bool aHasProperty);
rpc GetProperty(NPRemoteIdentifier aId) returns (NPVariant aResult, bool aSuccess);
rpc SetProperty(NPRemoteIdentifier aId, NPVariant aValue) returns (bool aSuccess);
rpc RemoveProperty(NPRemoteIdentifier aId) returns (bool aSuccess);
rpc Enumerate() returns (nsTArray<NPRemoteIdentifier> aProperties, bool aSuccess);
rpc Construct(nsTArray<NPVariant> aArgs) returns (NPVariant aResult, bool aSuccess);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -1,127 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugin App.
*
* The Initial Developer of the Original Code is
* Ben Turner <bent.mozilla@gmail.com>
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/plugins/NPObjectChild.h"
using mozilla::plugins::NPObjectChild;
NPObjectChild::NPObjectChild()
{
}
NPObjectChild::~NPObjectChild()
{
}
nsresult
NPObjectChild::AnswerInvalidate()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerHasMethod(const NPRemoteIdentifier& aId,
bool* aHasMethod)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerInvoke(const NPRemoteIdentifier& aId,
const nsTArray<NPVariant>& aArgs,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerInvokeDefault(const NPRemoteIdentifier& aId,
const nsTArray<NPVariant>& aArgs,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerHasProperty(const NPRemoteIdentifier& aId,
bool* aHasProperty)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerGetProperty(const NPRemoteIdentifier& aId,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerSetProperty(const NPRemoteIdentifier& aId,
const NPVariant& aValue,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerRemoveProperty(const NPRemoteIdentifier& aId,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerEnumerate(nsTArray<NPRemoteIdentifier>* aProperties,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPObjectChild::AnswerConstruct(const nsTArray<NPVariant>& aArgs,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -1,45 +0,0 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
include protocol "NPAPI.ipdl";
include protocol "NPObject.ipdl";
include protocol "NPBrowserStream.ipdl";
include "mozilla/plugins/PluginMessageUtils.h";
using NPError;
using NPWindow;
namespace mozilla {
namespace plugins {
rpc protocol NPP
{
manager NPAPI;
manages NPObject;
manages NPBrowserStream;
child:
/* NPP_NewStream */
rpc NPBrowserStream(nsCString url, uint32_t length, uint32_t lastmodified,
nsCString headers, nsCString mimeType, bool seekable)
returns (NPError rv, uint16_t stype);
rpc NPP_SetWindow(NPWindow window) returns (NPError rv);
rpc NPP_GetValue(nsString key) returns (nsString value);
parent:
rpc NPObject() returns (NPError rv);
rpc ~NPObject() returns (NPError rv);
both:
/**
* ~NPBrowserStream is for both NPN_DestroyStream and NPP_DestroyStream.
* @param artificial True when the stream is closed as a by-product of
* some other call (such as a failure in NPP_Write).
*/
rpc ~NPBrowserStream(NPError reason, bool artificial);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,92 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugins.
*
* The Initial Developer of the Original Code is
* Chris Jones <jones.chris.g@gmail.com>.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benjamin Smedberg <benjamin@smedbergs.us>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
include protocol "PPluginModule.ipdl";
include protocol "PPluginScriptableObject.ipdl";
include protocol "PPluginStream.ipdl";
include "mozilla/plugins/PluginMessageUtils.h";
using NPError;
using NPWindow;
namespace mozilla {
namespace plugins {
rpc protocol PPluginInstance
{
manager PPluginModule;
manages PPluginScriptableObject;
manages PPluginStream;
child:
/* NPP_NewStream */
rpc PPluginStream(nsCString url,
uint32_t length,
uint32_t lastmodified,
nsCString headers,
nsCString mimeType,
bool seekable)
returns (NPError rv,
uint16_t stype);
rpc NPP_SetWindow(NPWindow window)
returns (NPError rv);
rpc NPP_GetValue(nsString key)
returns (nsString value);
parent:
rpc PPluginScriptableObject()
returns (NPError rv);
rpc ~PPluginScriptableObject()
returns (NPError rv);
both:
/**
* ~PluginStream is for both NPN_DestroyStream and NPP_DestroyStream.
* @param artificial True when the stream is closed as a by-product of
* some other call (such as a failure in NPP_Write).
*/
rpc ~PPluginStream(NPError reason,
bool artificial);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,92 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugins.
*
* The Initial Developer of the Original Code is
* Chris Jones <jones.chris.g@gmail.com>.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benjamin Smedberg <benjamin@smedbergs.us>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
include protocol "PPluginInstance.ipdl";
include "npapi.h";
include "nsTArray.h";
include "mozilla/plugins/PluginMessageUtils.h";
using NPError;
using nsTArray<nsCString>;
using nsTArray<intptr_t>;
using mozilla::ipc::NPRemoteIdentifier;
using nsTArray<NPRemoteIdentifier>;
namespace mozilla {
namespace plugins {
rpc protocol PPluginModule
{
manages PPluginInstance;
child:
rpc NP_Initialize()
returns (NPError rv);
rpc PPluginInstance(nsCString aMimeType,
uint16_t aMode,
nsTArray<nsCString> aNames,
nsTArray<nsCString> aValues)
returns (NPError rv);
rpc ~PPluginInstance()
returns (NPError rv);
parent:
sync NPN_GetStringIdentifier(nsCString aString)
returns (NPRemoteIdentifier aId);
sync NPN_GetIntIdentifier(int32_t aInt)
returns (NPRemoteIdentifier aId);
sync NPN_UTF8FromIdentifier(NPRemoteIdentifier aId)
returns (nsCString aString);
sync NPN_IntFromIdentifier(NPRemoteIdentifier aId)
returns (int32_t aInt);
sync NPN_IdentifierIsString(NPRemoteIdentifier aId)
returns (bool aIsString);
sync NPN_GetStringIdentifiers()
returns (nsTArray<nsCString> aNames,
nsTArray<NPRemoteIdentifier> aIds);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,101 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugins.
*
* The Initial Developer of the Original Code is
* Chris Jones <jones.chris.g@gmail.com>.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benjamin Smedberg <benjamin@smedbergs.us>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
include protocol "PPluginInstance.ipdl";
include "npapi.h";
include "npruntime.h";
include "nsTArray.h";
include "mozilla/plugins/PluginMessageUtils.h";
using mozilla::ipc::NPRemoteIdentifier;
using nsTArray<NPRemoteIdentifier>;
using NPVariant;
using nsTArray<NPVariant>;
namespace mozilla {
namespace plugins {
rpc protocol PPluginScriptableObject
{
manager PPluginInstance;
child:
// NPClass methods
rpc Invalidate();
rpc HasMethod(NPRemoteIdentifier aId)
returns (bool aHasMethod);
rpc Invoke(NPRemoteIdentifier aId,
nsTArray<NPVariant> aArgs)
returns (NPVariant aResult,
bool aSuccess);
rpc InvokeDefault(NPRemoteIdentifier aId,
nsTArray<NPVariant> aArgs)
returns (NPVariant aResult,
bool aSuccess);
rpc HasProperty(NPRemoteIdentifier aId)
returns (bool aHasProperty);
rpc GetProperty(NPRemoteIdentifier aId)
returns (NPVariant aResult,
bool aSuccess);
rpc SetProperty(NPRemoteIdentifier aId,
NPVariant aValue)
returns (bool aSuccess);
rpc RemoveProperty(NPRemoteIdentifier aId)
returns (bool aSuccess);
rpc Enumerate()
returns (nsTArray<NPRemoteIdentifier> aProperties,
bool aSuccess);
rpc Construct(nsTArray<NPVariant> aArgs)
returns (NPVariant aResult,
bool aSuccess);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,72 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugins.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <benjamin@smedbergs.us>
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
include protocol "PPluginInstance.ipdl";
using mozilla::plugins::Buffer;
using mozilla::plugins::IPCByteRanges;
using NPError;
namespace mozilla {
namespace plugins {
/**
* NPBrowserStream represents a NPStream sent from the browser to the plugin.
*/
rpc protocol PPluginStream
{
manager PPluginInstance;
child:
rpc NPP_WriteReady(int32_t newlength)
returns (int32_t size);
rpc NPP_Write(int32_t offset,
Buffer data)
returns (int32_t consumed);
rpc NPP_StreamAsFile(nsCString fname);
parent:
rpc NPN_RequestRead(IPCByteRanges ranges)
returns (NPError result);
};
} // namespace plugins
} // namespace mozilla

Просмотреть файл

@ -36,8 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "NPPInstanceChild.h"
#include "NPBrowserStreamChild.h"
#include "PluginInstanceChild.h"
#include "PluginStreamChild.h"
#if defined(OS_LINUX)
@ -91,7 +91,7 @@ NPNVariableToString(NPNVariable aVar)
namespace mozilla {
namespace plugins {
NPPInstanceChild::~NPPInstanceChild()
PluginInstanceChild::~PluginInstanceChild()
{
#if defined(OS_WIN)
DestroyPluginWindow();
@ -99,9 +99,10 @@ NPPInstanceChild::~NPPInstanceChild()
}
NPError
NPPInstanceChild::NPN_GetValue(NPNVariable aVar, void* aValue)
PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
void* aValue)
{
printf ("[NPPInstanceChild] NPN_GetValue(%s)\n",
printf ("[PluginInstanceChild] NPN_GetValue(%s)\n",
NPNVariableToString(aVar));
switch(aVar) {
@ -133,15 +134,17 @@ NPPInstanceChild::NPN_GetValue(NPNVariable aVar, void* aValue)
}
nsresult
NPPInstanceChild::AnswerNPP_GetValue(const nsString& key, nsString* value)
PluginInstanceChild::AnswerNPP_GetValue(const nsString& key,
nsString* value)
{
return NPERR_GENERIC_ERROR;
}
nsresult
NPPInstanceChild::AnswerNPP_SetWindow(const NPWindow& aWindow, NPError* rv)
PluginInstanceChild::AnswerNPP_SetWindow(const NPWindow& aWindow,
NPError* rv)
{
printf("[NPPInstanceChild] NPP_SetWindow(%lx, %d, %d)\n",
printf("[PluginInstanceChild] NPP_SetWindow(%lx, %d, %d)\n",
reinterpret_cast<unsigned long>(aWindow.window),
aWindow.width, aWindow.height);
@ -206,7 +209,7 @@ NPPInstanceChild::AnswerNPP_SetWindow(const NPWindow& aWindow, NPError* rv)
}
bool
NPPInstanceChild::Initialize()
PluginInstanceChild::Initialize()
{
#if defined(OS_WIN)
if (!CreatePluginWindow())
@ -219,11 +222,11 @@ NPPInstanceChild::Initialize()
#if defined(OS_WIN)
static const TCHAR kWindowClassName[] = TEXT("GeckoPluginWindow");
static const TCHAR kNPPInstanceChildProperty[] = TEXT("NPPInstanceChildProperty");
static const TCHAR kPluginInstanceChildProperty[] = TEXT("PluginInstanceChildProperty");
// static
bool
NPPInstanceChild::RegisterWindowClass()
PluginInstanceChild::RegisterWindowClass()
{
static bool alreadyRegistered = false;
if (alreadyRegistered)
@ -249,7 +252,7 @@ NPPInstanceChild::RegisterWindowClass()
}
bool
NPPInstanceChild::CreatePluginWindow()
PluginInstanceChild::CreatePluginWindow()
{
if (!RegisterWindowClass())
return false;
@ -264,7 +267,7 @@ NPPInstanceChild::CreatePluginWindow()
0, 0, NULL, 0, GetModuleHandle(NULL), 0);
if (!mPluginWindowHWND)
return false;
if (!SetProp(mPluginWindowHWND, kNPPInstanceChildProperty, this))
if (!SetProp(mPluginWindowHWND, kPluginInstanceChildProperty, this))
return false;
// Apparently some plugins require an ASCII WndProc.
@ -276,7 +279,7 @@ NPPInstanceChild::CreatePluginWindow()
}
void
NPPInstanceChild::DestroyPluginWindow()
PluginInstanceChild::DestroyPluginWindow()
{
if (mPluginWindowHWND) {
// Unsubclass the window.
@ -289,14 +292,14 @@ NPPInstanceChild::DestroyPluginWindow()
mPluginWndProc = 0;
}
RemoveProp(mPluginWindowHWND, kNPPInstanceChildProperty);
RemoveProp(mPluginWindowHWND, kPluginInstanceChildProperty);
DestroyWindow(mPluginWindowHWND);
mPluginWindowHWND = 0;
}
}
void
NPPInstanceChild::ReparentPluginWindow(HWND hWndParent)
PluginInstanceChild::ReparentPluginWindow(HWND hWndParent)
{
if (hWndParent != mPluginParentHWND && IsWindow(hWndParent)) {
LONG style = GetWindowLongPtr(mPluginWindowHWND, GWL_STYLE);
@ -309,7 +312,7 @@ NPPInstanceChild::ReparentPluginWindow(HWND hWndParent)
}
void
NPPInstanceChild::SizePluginWindow(int width,
PluginInstanceChild::SizePluginWindow(int width,
int height)
{
if (mPluginWindowHWND) {
@ -321,7 +324,7 @@ NPPInstanceChild::SizePluginWindow(int width,
// See chromium's webplugin_delegate_impl.cc for explanation of this function.
// static
LRESULT CALLBACK
NPPInstanceChild::DummyWindowProc(HWND hWnd,
PluginInstanceChild::DummyWindowProc(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
@ -331,13 +334,13 @@ NPPInstanceChild::DummyWindowProc(HWND hWnd,
// static
LRESULT CALLBACK
NPPInstanceChild::PluginWindowProc(HWND hWnd,
PluginInstanceChild::PluginWindowProc(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
NPPInstanceChild* self = reinterpret_cast<NPPInstanceChild*>(
GetProp(hWnd, kNPPInstanceChildProperty));
PluginInstanceChild* self = reinterpret_cast<PluginInstanceChild*>(
GetProp(hWnd, kPluginInstanceChildProperty));
if (!self) {
NS_NOTREACHED("Badness!");
return 0;
@ -352,42 +355,44 @@ NPPInstanceChild::PluginWindowProc(HWND hWnd,
self->DestroyPluginWindow();
if (message == WM_NCDESTROY)
RemoveProp(hWnd, kNPPInstanceChildProperty);
RemoveProp(hWnd, kPluginInstanceChildProperty);
return res;
}
#endif // OS_WIN
NPObjectProtocolChild*
NPPInstanceChild::NPObjectConstructor(NPError* _retval)
PPluginScriptableObjectProtocolChild*
PluginInstanceChild::PPluginScriptableObjectConstructor(NPError* _retval)
{
NS_NOTYETIMPLEMENTED("NPPInstanceChild::NPObjectConstructor");
NS_NOTYETIMPLEMENTED("PluginInstanceChild::NPObjectConstructor");
return nsnull;
}
nsresult
NPPInstanceChild::NPObjectDestructor(NPObjectProtocolChild* aObject,
PluginInstanceChild::PPluginScriptableObjectDestructor(PPluginScriptableObjectProtocolChild* aObject,
NPError* _retval)
{
NS_NOTYETIMPLEMENTED("NPPInstanceChild::NPObjectDestructor");
NS_NOTYETIMPLEMENTED("PluginInstanceChild::NPObjectDestructor");
return NS_ERROR_NOT_IMPLEMENTED;
}
NPBrowserStreamProtocolChild*
NPPInstanceChild::NPBrowserStreamConstructor(const nsCString& url, const uint32_t& length,
PPluginStreamProtocolChild*
PluginInstanceChild::PPluginStreamConstructor(const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType,
const bool& seekable,
NPError* rv, uint16_t *stype)
NPError* rv,
uint16_t *stype)
{
return new NPBrowserStreamChild(this, url, length, lastmodified, headers,
return new PluginStreamChild(this, url, length, lastmodified, headers,
mimeType, seekable, rv, stype);
}
nsresult
NPPInstanceChild::NPBrowserStreamDestructor(NPBrowserStreamProtocolChild* stream,
PluginInstanceChild::PPluginStreamDestructor(PPluginStreamProtocolChild* stream,
const NPError& reason,
const bool& artificial)
{

Просмотреть файл

@ -36,21 +36,21 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef dom_plugins_NPPInstanceChild_h
#define dom_plugins_NPPInstanceChild_h 1
#ifndef dom_plugins_PluginInstanceChild_h
#define dom_plugins_PluginInstanceChild_h 1
#include "mozilla/plugins/NPPProtocolChild.h"
#include "mozilla/plugins/NPObjectChild.h"
#include "mozilla/plugins/PPluginInstanceProtocolChild.h"
#include "mozilla/plugins/PluginScriptableObjectChild.h"
#include "npfunctions.h"
#undef _MOZ_LOG
#define _MOZ_LOG(s) printf("[NPPInstanceChild] %s\n", s)
#define _MOZ_LOG(s) printf("[PluginInstanceChild] %s\n", s)
namespace mozilla {
namespace plugins {
class NPPInstanceChild : public NPPProtocolChild
class PluginInstanceChild : public PPluginInstanceProtocolChild
{
#ifdef OS_WIN
friend LRESULT CALLBACK PluginWindowProc(HWND hWnd,
@ -60,33 +60,37 @@ class NPPInstanceChild : public NPPProtocolChild
#endif
protected:
friend class NPBrowserStreamChild;
friend class PluginStreamChild;
virtual nsresult AnswerNPP_SetWindow(const NPWindow& window, NPError* rv);
virtual nsresult AnswerNPP_GetValue(const nsString& key, nsString* value);
virtual NPObjectProtocolChild*
NPObjectConstructor(NPError* _retval);
virtual PPluginScriptableObjectProtocolChild*
PPluginScriptableObjectConstructor(NPError* _retval);
virtual nsresult
NPObjectDestructor(NPObjectProtocolChild* aObject,
PPluginScriptableObjectDestructor(PPluginScriptableObjectProtocolChild* aObject,
NPError* _retval);
virtual NPBrowserStreamProtocolChild*
NPBrowserStreamConstructor(const nsCString& url, const uint32_t& length,
virtual PPluginStreamProtocolChild*
PPluginStreamConstructor(const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType, const bool& seekable,
NPError* rv, uint16_t *stype);
const nsCString& mimeType,
const bool& seekable,
NPError* rv,
uint16_t *stype);
virtual nsresult
NPBrowserStreamDestructor(NPBrowserStreamProtocolChild* stream,
const NPError& reason, const bool& artificial);
PPluginStreamDestructor(PPluginStreamProtocolChild* stream,
const NPError& reason,
const bool& artificial);
public:
NPPInstanceChild(const NPPluginFuncs* aPluginIface) :
PluginInstanceChild(const NPPluginFuncs* aPluginIface) :
mPluginIface(aPluginIface)
#if defined(OS_LINUX)
, mPlug(0)
@ -103,7 +107,7 @@ public:
#endif
}
virtual ~NPPInstanceChild();
virtual ~PluginInstanceChild();
bool Initialize();
@ -112,7 +116,9 @@ public:
return &mData;
}
NPError NPN_GetValue(NPNVariable aVariable, void* aValue);
NPError
NPN_GetValue(NPNVariable aVariable,
void* aValue);
private:
@ -150,4 +156,4 @@ private:
} // namespace plugins
} // namespace mozilla
#endif // ifndef dom_plugins_NPPInstanceChild_h
#endif // ifndef dom_plugins_PluginInstanceChild_h

Просмотреть файл

@ -36,37 +36,39 @@
*
* ***** END LICENSE BLOCK ***** */
#include "NPPInstanceParent.h"
#include "NPBrowserStreamParent.h"
#include "PluginInstanceParent.h"
#include "PluginStreamParent.h"
namespace mozilla {
namespace plugins {
NPBrowserStreamProtocolParent*
NPPInstanceParent::NPBrowserStreamConstructor(const nsCString& url, const uint32_t& length,
PPluginStreamProtocolParent*
PluginInstanceParent::PPluginStreamConstructor(const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType,
const bool& seekable,
NPError* rv, uint16_t *stype)
NPError* rv,
uint16_t *stype)
{
NS_RUNTIMEABORT("Not reachable");
return NULL;
}
nsresult
NPPInstanceParent::AnswerNPBrowserStreamDestructor(NPBrowserStreamProtocolParent* stream,
PluginInstanceParent::AnswerPPluginStreamDestructor(PPluginStreamProtocolParent* stream,
const NPError& reason,
const bool& artificial)
{
if (!artificial) {
static_cast<NPBrowserStreamParent*>(stream)->NPN_DestroyStream(reason);
static_cast<PluginStreamParent*>(stream)->NPN_DestroyStream(reason);
}
return NS_OK;
}
nsresult
NPPInstanceParent::NPBrowserStreamDestructor(NPBrowserStreamProtocolParent* stream,
PluginInstanceParent::PPluginStreamDestructor(PPluginStreamProtocolParent* stream,
const NPError& reason,
const bool& artificial)
{
@ -75,7 +77,7 @@ NPPInstanceParent::NPBrowserStreamDestructor(NPBrowserStreamProtocolParent* stre
}
NPError
NPPInstanceParent::NPP_SetWindow(NPWindow* aWindow)
PluginInstanceParent::NPP_SetWindow(NPWindow* aWindow)
{
_MOZ_LOG(__FUNCTION__);
NS_ENSURE_TRUE(aWindow, NPERR_GENERIC_ERROR);
@ -88,7 +90,7 @@ NPPInstanceParent::NPP_SetWindow(NPWindow* aWindow)
}
NPError
NPPInstanceParent::NPP_GetValue(NPPVariable variable, void *ret_value)
PluginInstanceParent::NPP_GetValue(NPPVariable variable, void *ret_value)
{
_MOZ_LOG(__FUNCTION__);
@ -108,13 +110,13 @@ NPPInstanceParent::NPP_GetValue(NPPVariable variable, void *ret_value)
}
NPError
NPPInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
PluginInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
NPBool seekable, uint16_t* stype)
{
_MOZ_LOG(__FUNCTION__);
NPError err;
CallNPBrowserStreamConstructor(new NPBrowserStreamParent(this, stream),
CallPPluginStreamConstructor(new PluginStreamParent(this, stream),
nsCString(stream->url),
stream->end,
stream->lastmodified,
@ -124,28 +126,28 @@ NPPInstanceParent::NPP_NewStream(NPMIMEType type, NPStream* stream,
}
NPError
NPPInstanceParent::NPP_DestroyStream(NPStream* stream, NPReason reason)
PluginInstanceParent::NPP_DestroyStream(NPStream* stream, NPReason reason)
{
NPBrowserStreamParent* sp =
static_cast<NPBrowserStreamParent*>(stream->pdata);
PluginStreamParent* sp =
static_cast<PluginStreamParent*>(stream->pdata);
if (sp->mNPP != this)
NS_RUNTIMEABORT("Mismatched plugin data");
return CallNPBrowserStreamDestructor(sp, reason, false);
return CallPPluginStreamDestructor(sp, reason, false);
}
NPObjectProtocolParent*
NPPInstanceParent::NPObjectConstructor(NPError* _retval)
PPluginScriptableObjectProtocolParent*
PluginInstanceParent::PPluginScriptableObjectConstructor(NPError* _retval)
{
NS_NOTYETIMPLEMENTED("NPPInstanceParent::NPObjectConstructor");
NS_NOTYETIMPLEMENTED("PluginInstanceParent::PPluginScriptableObjectConstructor");
return nsnull;
}
nsresult
NPPInstanceParent::NPObjectDestructor(NPObjectProtocolParent* aObject,
PluginInstanceParent::PPluginScriptableObjectDestructor(PPluginScriptableObjectProtocolParent* aObject,
NPError* _retval)
{
NS_NOTYETIMPLEMENTED("NPPInstanceParent::NPObjectDestructor");
NS_NOTYETIMPLEMENTED("PluginInstanceParent::PPluginScriptableObjectDestructor");
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -36,36 +36,35 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef dom_plugins_NPPInstanceParent_h
#define dom_plugins_NPPInstanceParent_h 1
#ifndef dom_plugins_PluginInstanceParent_h
#define dom_plugins_PluginInstanceParent_h 1
#include "mozilla/plugins/NPPProtocolParent.h"
#include "mozilla/plugins/NPObjectParent.h"
#include "mozilla/plugins/PPluginInstanceProtocolParent.h"
#include "mozilla/plugins/PluginScriptableObjectParent.h"
#include "npfunctions.h"
#undef _MOZ_LOG
#define _MOZ_LOG(s) printf("[NPPInstanceParent] %s\n", s)
#define _MOZ_LOG(s) printf("[PluginInstanceParent] %s\n", s)
namespace mozilla {
namespace plugins {
class NPBrowserStreamParent;
class PluginStreamParent;
class NPPInstanceParent :
public NPPProtocolParent
class PluginInstanceParent : public PPluginInstanceProtocolParent
{
friend class NPAPIPluginParent;
friend class mozilla::plugins::NPBrowserStreamParent;
friend class PluginModuleParent;
friend class PluginStreamParent;
public:
NPPInstanceParent(NPP npp, const NPNetscapeFuncs* npniface)
PluginInstanceParent(NPP npp, const NPNetscapeFuncs* npniface)
: mNPP(npp)
, mNPNIface(npniface)
{
}
virtual ~NPPInstanceParent()
virtual ~PluginInstanceParent()
{
}
@ -74,27 +73,32 @@ public:
return NS_OK;
}
virtual NPObjectProtocolParent*
NPObjectConstructor(NPError* _retval);
virtual PPluginScriptableObjectProtocolParent*
PPluginScriptableObjectConstructor(NPError* _retval);
virtual nsresult
NPObjectDestructor(NPObjectProtocolParent* aObject,
PPluginScriptableObjectDestructor(PPluginScriptableObjectProtocolParent* aObject,
NPError* _retval);
virtual NPBrowserStreamProtocolParent*
NPBrowserStreamConstructor(const nsCString& url, const uint32_t& length,
virtual PPluginStreamProtocolParent*
PPluginStreamConstructor(const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType, const bool& seekable,
NPError* rv, uint16_t *stype);
const nsCString& mimeType,
const bool& seekable,
NPError* rv,
uint16_t *stype);
virtual nsresult
AnswerNPBrowserStreamDestructor(NPBrowserStreamProtocolParent* stream,
const NPError& reason, const bool& artificial);
AnswerPPluginStreamDestructor(PPluginStreamProtocolParent* stream,
const NPError& reason,
const bool& artificial);
virtual nsresult
NPBrowserStreamDestructor(NPBrowserStreamProtocolParent* stream,
const NPError& reason, const bool& artificial);
PPluginStreamDestructor(PPluginStreamProtocolParent* stream,
const NPError& reason,
const bool& artificial);
NPError NPP_SetWindow(NPWindow* aWindow);
NPError NPP_GetValue(NPPVariable variable, void *ret_value);
@ -135,4 +139,4 @@ private:
} // namespace plugins
} // namespace mozilla
#endif // ifndef dom_plugins_NPPInstanceParent_h
#endif // ifndef dom_plugins_PluginInstanceParent_h

Просмотреть файл

@ -37,7 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/plugins/NPAPIPluginChild.h"
#include "mozilla/plugins/PluginModuleChild.h"
#ifdef OS_LINUX
#include <gtk/gtk.h>
@ -50,13 +50,13 @@
#include "nsCOMPtr.h"
#include "nsPluginsDir.h"
#include "mozilla/plugins/NPPInstanceChild.h"
#include "mozilla/plugins/PluginInstanceChild.h"
namespace mozilla {
namespace plugins {
NPAPIPluginChild::NPAPIPluginChild() :
PluginModuleChild::PluginModuleChild() :
mLibrary(0),
mInitializeFunc(0),
mShutdownFunc(0)
@ -69,7 +69,7 @@ NPAPIPluginChild::NPAPIPluginChild() :
memset(&mSavedData, 0, sizeof(mSavedData));
}
NPAPIPluginChild::~NPAPIPluginChild()
PluginModuleChild::~PluginModuleChild()
{
if (mLibrary) {
PR_UnloadLibrary(mLibrary);
@ -77,7 +77,7 @@ NPAPIPluginChild::~NPAPIPluginChild()
}
bool
NPAPIPluginChild::Init(const std::string& aPluginFilename,
PluginModuleChild::Init(const std::string& aPluginFilename,
MessageLoop* aIOLoop,
IPC::Channel* aChannel)
{
@ -145,7 +145,7 @@ NPAPIPluginChild::Init(const std::string& aPluginFilename,
}
bool
NPAPIPluginChild::InitGraphics()
PluginModuleChild::InitGraphics()
{
// FIXME/cjones: is this the place for this?
#if defined(OS_LINUX)
@ -158,7 +158,7 @@ NPAPIPluginChild::InitGraphics()
}
void
NPAPIPluginChild::CleanUp()
PluginModuleChild::CleanUp()
{
// FIXME/cjones: destroy all instances
}
@ -343,7 +343,7 @@ _getauthenticationinfo(NPP instance, const char *protocol, const char *host,
PR_END_EXTERN_C
const NPNetscapeFuncs NPAPIPluginChild::sBrowserFuncs = {
const NPNetscapeFuncs PluginModuleChild::sBrowserFuncs = {
sizeof(sBrowserFuncs),
(NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR,
_geturl,
@ -395,10 +395,10 @@ const NPNetscapeFuncs NPAPIPluginChild::sBrowserFuncs = {
#endif
};
NPPInstanceChild&
PluginInstanceChild&
InstCast(NPP aNPP)
{
return *static_cast<NPPInstanceChild*>(aNPP->ndata);
return *static_cast<PluginInstanceChild*>(aNPP->ndata);
}
NPError NP_CALLBACK
@ -652,8 +652,8 @@ _createobject(NPP aNPP,
}
int classId = sDelegate->GetClassId(aClass);
NPAPIPluginChild::Instance* instance =
static_cast<NPAPIPluginChild::Instance*>(aNPP);
PluginModuleChild::Instance* instance =
static_cast<PluginModuleChild::Instance*>(aNPP);
int objectId = -1;
sDelegate->Send(new PluginHostMsg_MozCreateObject(
@ -662,7 +662,7 @@ _createobject(NPP aNPP,
return 0;
}
NPAPIPluginChild::ScriptableObjectInfo& info =
PluginModuleChild::ScriptableObjectInfo& info =
sDelegate->GetScriptableObjectInfo(obj);
DCHECK(info.object = obj);
info.id = objectId;
@ -678,7 +678,7 @@ _retainobject(NPObject* aNPObj)
{
_MOZ_LOG(__FUNCTION__);
#if 0
NPAPIPluginChild::ScriptableObjectInfo& info =
PluginModuleChild::ScriptableObjectInfo& info =
sDelegate->GetScriptableObjectInfo(aNPObj);
DCHECK(info.object == aNPObj);
sDelegate->Send(new PluginHostMsg_MozRetainObject(info.instanceId, info.id));
@ -694,7 +694,7 @@ _releaseobject(NPObject* aNPObj)
{
_MOZ_LOG(__FUNCTION__);
#if 0
NPAPIPluginChild::ScriptableObjectInfo& info =
PluginModuleChild::ScriptableObjectInfo& info =
sDelegate->GetScriptableObjectInfo(aNPObj);
DCHECK(info.object == aNPObj);
sDelegate->Send(new PluginHostMsg_MozReleaseObject(info.instanceId, info.id));
@ -890,7 +890,7 @@ _getauthenticationinfo(NPP aNPP,
#endif /* NP_VERSION_MINOR > 19 */
nsresult
NPAPIPluginChild::AnswerNP_Initialize(NPError* _retval)
PluginModuleChild::AnswerNP_Initialize(NPError* _retval)
{
_MOZ_LOG(__FUNCTION__);
@ -912,8 +912,8 @@ NPAPIPluginChild::AnswerNP_Initialize(NPError* _retval)
#endif
}
NPPProtocolChild*
NPAPIPluginChild::NPPConstructor(const nsCString& aMimeType,
PPluginInstanceProtocolChild*
PluginModuleChild::PPluginInstanceConstructor(const nsCString& aMimeType,
const uint16_t& aMode,
const nsTArray<nsCString>& aNames,
const nsTArray<nsCString>& aValues,
@ -922,8 +922,8 @@ NPAPIPluginChild::NPPConstructor(const nsCString& aMimeType,
_MOZ_LOG(__FUNCTION__);
// create our wrapper instance
nsAutoPtr<NPPInstanceChild> childInstance(
new NPPInstanceChild(&mFunctions));
nsAutoPtr<PluginInstanceChild> childInstance(
new PluginInstanceChild(&mFunctions));
if (!childInstance->Initialize()) {
*rv = NPERR_GENERIC_ERROR;
return 0;
@ -961,16 +961,17 @@ NPAPIPluginChild::NPPConstructor(const nsCString& aMimeType,
return nsnull;
}
printf ("[NPAPIPluginChild] %s: returning %hd\n", __FUNCTION__, *rv);
printf ("[PluginModuleChild] %s: returning %hd\n", __FUNCTION__, *rv);
return childInstance.forget();
}
nsresult
NPAPIPluginChild::NPPDestructor(NPPProtocolChild* actor, NPError* rv)
PluginModuleChild::PPluginInstanceDestructor(PPluginInstanceProtocolChild* actor,
NPError* rv)
{
_MOZ_LOG(__FUNCTION__);
NPPInstanceChild* inst = static_cast<NPPInstanceChild*>(actor);
PluginInstanceChild* inst = static_cast<PluginInstanceChild*>(actor);
*rv = mFunctions.destroy(inst->GetNPP(), 0);
delete actor;
inst->GetNPP()->ndata = 0;

Просмотреть файл

@ -1,4 +1,3 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
* ***** BEGIN LICENSE BLOCK *****
@ -38,8 +37,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef dom_plugins_NPAPIPluginChild_h
#define dom_plugins_NPAPIPluginChild_h 1
#ifndef dom_plugins_PluginModuleChild_h
#define dom_plugins_PluginModuleChild_h 1
#include <string>
#include <vector>
@ -54,8 +53,8 @@
#include "nsAutoPtr.h"
#include "mozilla/plugins/NPAPIProtocolChild.h"
#include "mozilla/plugins/NPPInstanceChild.h"
#include "mozilla/plugins/PPluginModuleProtocolChild.h"
#include "mozilla/plugins/PluginInstanceChild.h"
// NOTE: stolen from nsNPAPIPlugin.h
@ -94,26 +93,26 @@ namespace mozilla {
namespace plugins {
//-----------------------------------------------------------------------------
class NPAPIPluginChild : public NPAPIProtocolChild
class PluginModuleChild : public PPluginModuleProtocolChild
{
protected:
// Implement the NPAPIProtocolChild interface
// Implement the PPluginModuleProtocolChild interface
virtual nsresult AnswerNP_Initialize(NPError* rv);
virtual NPPProtocolChild* NPPConstructor(
const nsCString& aMimeType,
virtual PPluginInstanceProtocolChild*
PPluginInstanceConstructor(const nsCString& aMimeType,
const uint16_t& aMode,
const nsTArray<nsCString>& aNames,
const nsTArray<nsCString>& aValues,
NPError* rv);
virtual nsresult NPPDestructor(
NPPProtocolChild* actor,
virtual nsresult
PPluginInstanceDestructor(PPluginInstanceProtocolChild* actor,
NPError* rv);
public:
NPAPIPluginChild();
virtual ~NPAPIPluginChild();
PluginModuleChild();
virtual ~PluginModuleChild();
bool Init(const std::string& aPluginFilename,
MessageLoop* aIOLoop,
@ -144,4 +143,4 @@ private:
} /* namespace plugins */
} /* namespace mozilla */
#endif // ifndef dom_plugins_NPAPIPluginChild_h
#endif // ifndef dom_plugins_PluginModuleChild_h

Просмотреть файл

@ -36,8 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/plugins/NPAPIPluginParent.h"
#include "mozilla/plugins/NPBrowserStreamParent.h"
#include "mozilla/plugins/PluginModuleParent.h"
#include "mozilla/plugins/PluginStreamParent.h"
using mozilla::SharedLibrary;
@ -45,38 +45,38 @@ namespace mozilla {
namespace plugins {
// HACKS
NPAPIPluginParent* NPAPIPluginParent::Shim::HACK_target;
PluginModuleParent* PluginModuleParent::Shim::HACK_target;
SharedLibrary*
NPAPIPluginParent::LoadModule(const char* aFilePath, PRLibrary* aLibrary)
PluginModuleParent::LoadModule(const char* aFilePath, PRLibrary* aLibrary)
{
_MOZ_LOG(__FUNCTION__);
// Block on the child process being launched and initialized.
NPAPIPluginParent* parent = new NPAPIPluginParent(aFilePath);
PluginModuleParent* parent = new PluginModuleParent(aFilePath);
parent->mSubprocess.Launch();
parent->Open(parent->mSubprocess.GetChannel());
// FIXME/cjones: leaking NPAPIPluginParents ...
// FIXME/cjones: leaking PluginModuleParents ...
return parent->mShim;
}
NPAPIPluginParent::NPAPIPluginParent(const char* aFilePath) :
PluginModuleParent::PluginModuleParent(const char* aFilePath) :
mFilePath(aFilePath),
mSubprocess(aFilePath),
ALLOW_THIS_IN_INITIALIZER_LIST(mShim(new Shim(this)))
{
}
NPAPIPluginParent::~NPAPIPluginParent()
PluginModuleParent::~PluginModuleParent()
{
_MOZ_LOG(" (closing Shim ...)");
delete mShim;
}
NPPProtocolParent*
NPAPIPluginParent::NPPConstructor(const nsCString& aMimeType,
PPluginInstanceProtocolParent*
PluginModuleParent::PPluginInstanceConstructor(const nsCString& aMimeType,
const uint16_t& aMode,
const nsTArray<nsCString>& aNames,
const nsTArray<nsCString>& aValues,
@ -87,16 +87,16 @@ NPAPIPluginParent::NPPConstructor(const nsCString& aMimeType,
}
nsresult
NPAPIPluginParent::NPPDestructor(NPPProtocolParent* __a,
NPError* rv)
PluginModuleParent::PPluginInstanceDestructor(PPluginInstanceProtocolParent* aActor,
NPError* _retval)
{
_MOZ_LOG(__FUNCTION__);
delete __a;
delete aActor;
return NS_OK;
}
void
NPAPIPluginParent::SetPluginFuncs(NPPluginFuncs* aFuncs)
PluginModuleParent::SetPluginFuncs(NPPluginFuncs* aFuncs)
{
aFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
aFuncs->javaClass = nsnull;
@ -107,10 +107,10 @@ NPAPIPluginParent::SetPluginFuncs(NPPluginFuncs* aFuncs)
aFuncs->destroy = Shim::NPP_Destroy;
aFuncs->setwindow = Shim::NPP_SetWindow;
aFuncs->newstream = Shim::NPP_NewStream;
aFuncs->destroystream = NPAPIPluginParent::NPP_DestroyStream;
aFuncs->asfile = NPAPIPluginParent::NPP_StreamAsFile;
aFuncs->writeready = NPAPIPluginParent::NPP_WriteReady;
aFuncs->write = NPAPIPluginParent::NPP_Write;
aFuncs->destroystream = PluginModuleParent::NPP_DestroyStream;
aFuncs->asfile = PluginModuleParent::NPP_StreamAsFile;
aFuncs->writeready = PluginModuleParent::NPP_WriteReady;
aFuncs->write = PluginModuleParent::NPP_Write;
aFuncs->print = Shim::NPP_Print;
aFuncs->event = Shim::NPP_HandleEvent;
aFuncs->urlnotify = Shim::NPP_URLNotify;
@ -120,7 +120,7 @@ NPAPIPluginParent::SetPluginFuncs(NPPluginFuncs* aFuncs)
#ifdef OS_LINUX
NPError
NPAPIPluginParent::NP_Initialize(const NPNetscapeFuncs* npnIface,
PluginModuleParent::NP_Initialize(const NPNetscapeFuncs* npnIface,
NPPluginFuncs* nppIface)
{
_MOZ_LOG(__FUNCTION__);
@ -137,7 +137,7 @@ NPAPIPluginParent::NP_Initialize(const NPNetscapeFuncs* npnIface,
}
#else
NPError
NPAPIPluginParent::NP_Initialize(const NPNetscapeFuncs* npnIface)
PluginModuleParent::NP_Initialize(const NPNetscapeFuncs* npnIface)
{
_MOZ_LOG(__FUNCTION__);
@ -149,7 +149,7 @@ NPAPIPluginParent::NP_Initialize(const NPNetscapeFuncs* npnIface)
}
NPError
NPAPIPluginParent::NP_GetEntryPoints(NPPluginFuncs* nppIface)
PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* nppIface)
{
NS_ASSERTION(nppIface, "Null pointer!");
@ -159,7 +159,7 @@ NPAPIPluginParent::NP_GetEntryPoints(NPPluginFuncs* nppIface)
#endif
NPError
NPAPIPluginParent::NPP_New(NPMIMEType pluginType,
PluginModuleParent::NPP_New(NPMIMEType pluginType,
NPP instance,
uint16_t mode,
int16_t argc,
@ -179,12 +179,13 @@ NPAPIPluginParent::NPP_New(NPMIMEType pluginType,
}
NPError prv = NPERR_GENERIC_ERROR;
nsAutoPtr<NPPInstanceParent> parentInstance(
static_cast<NPPInstanceParent*>(
CallNPPConstructor(new NPPInstanceParent(instance, mNPNIface),
nsDependentCString(pluginType), mode, names,
values, &prv)));
printf ("[NPAPIPluginParent] %s: got return value %hd\n", __FUNCTION__,
nsAutoPtr<PluginInstanceParent> parentInstance(
static_cast<PluginInstanceParent*>(
CallPPluginInstanceConstructor(new PluginInstanceParent(instance,
mNPNIface),
nsDependentCString(pluginType), mode,
names,values, &prv)));
printf ("[PluginModuleParent] %s: got return value %hd\n", __FUNCTION__,
prv);
if (NPERR_NO_ERROR != prv)
@ -197,7 +198,7 @@ NPAPIPluginParent::NPP_New(NPMIMEType pluginType,
}
NPError
NPAPIPluginParent::NPP_Destroy(NPP instance,
PluginModuleParent::NPP_Destroy(NPP instance,
NPSavedData** save)
{
// FIXME/cjones:
@ -208,11 +209,11 @@ NPAPIPluginParent::NPP_Destroy(NPP instance,
_MOZ_LOG(__FUNCTION__);
NPPInstanceParent* parentInstance =
static_cast<NPPInstanceParent*>(instance->pdata);
PluginInstanceParent* parentInstance =
static_cast<PluginInstanceParent*>(instance->pdata);
NPError prv;
if (CallNPPDestructor(parentInstance, &prv)) {
if (CallPPluginInstanceDestructor(parentInstance, &prv)) {
prv = NPERR_GENERIC_ERROR;
}
instance->pdata = nsnull;
@ -221,91 +222,100 @@ NPAPIPluginParent::NPP_Destroy(NPP instance,
}
nsresult
NPAPIPluginParent::RecvNPN_GetStringIdentifier(const nsCString& aString,
PluginModuleParent::RecvNPN_GetStringIdentifier(const nsCString& aString,
NPRemoteIdentifier* aId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPAPIPluginParent::RecvNPN_GetIntIdentifier(const int32_t& aInt,
PluginModuleParent::RecvNPN_GetIntIdentifier(const int32_t& aInt,
NPRemoteIdentifier* aId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPAPIPluginParent::RecvNPN_UTF8FromIdentifier(const NPRemoteIdentifier& aId,
PluginModuleParent::RecvNPN_UTF8FromIdentifier(const NPRemoteIdentifier& aId,
nsCString* aString)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPAPIPluginParent::RecvNPN_IntFromIdentifier(const NPRemoteIdentifier& aId,
PluginModuleParent::RecvNPN_IntFromIdentifier(const NPRemoteIdentifier& aId,
int32_t* aInt)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPAPIPluginParent::RecvNPN_IdentifierIsString(const NPRemoteIdentifier& aId,
PluginModuleParent::RecvNPN_IdentifierIsString(const NPRemoteIdentifier& aId,
bool* aIsString)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NPAPIPluginParent::RecvNPN_GetStringIdentifiers(nsTArray<nsCString>* aNames,
PluginModuleParent::RecvNPN_GetStringIdentifiers(nsTArray<nsCString>* aNames,
nsTArray<NPRemoteIdentifier>* aIds)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NPPInstanceParent*
NPAPIPluginParent::InstCast(NPP instance)
PluginInstanceParent*
PluginModuleParent::InstCast(NPP instance)
{
NPPInstanceParent* ip =
static_cast<NPPInstanceParent*>(instance->pdata);
if (instance != ip->mNPP)
PluginInstanceParent* ip =
static_cast<PluginInstanceParent*>(instance->pdata);
if (instance != ip->mNPP) {
NS_RUNTIMEABORT("Corrupted plugin data.");
}
return ip;
}
NPBrowserStreamParent*
NPAPIPluginParent::StreamCast(NPP instance, NPStream* s)
PluginStreamParent*
PluginModuleParent::StreamCast(NPP instance,
NPStream* s)
{
NPPInstanceParent* ip = InstCast(instance);
NPBrowserStreamParent* sp =
static_cast<NPBrowserStreamParent*>(s->pdata);
if (sp->mNPP != ip || s != sp->mStream)
PluginInstanceParent* ip = InstCast(instance);
PluginStreamParent* sp =
static_cast<PluginStreamParent*>(s->pdata);
if (sp->mNPP != ip || s != sp->mStream) {
NS_RUNTIMEABORT("Corrupted plugin stream data.");
}
return sp;
}
NPError
NPAPIPluginParent::NPP_DestroyStream(NPP instance,
NPStream* stream, NPReason reason)
PluginModuleParent::NPP_DestroyStream(NPP instance,
NPStream* stream,
NPReason reason)
{
return InstCast(instance)->NPP_DestroyStream(stream, reason);
}
int32_t
NPAPIPluginParent::NPP_WriteReady(NPP instance, NPStream* stream)
PluginModuleParent::NPP_WriteReady(NPP instance,
NPStream* stream)
{
return StreamCast(instance, stream)->WriteReady();
}
int32_t
NPAPIPluginParent::NPP_Write(NPP instance, NPStream* stream,
int32_t offset, int32_t len, void* buffer)
PluginModuleParent::NPP_Write(NPP instance,
NPStream* stream,
int32_t offset,
int32_t len,
void* buffer)
{
return StreamCast(instance, stream)->Write(offset, len, buffer);
}
void
NPAPIPluginParent::NPP_StreamAsFile(NPP instance,
NPStream* stream, const char* fname)
PluginModuleParent::NPP_StreamAsFile(NPP instance,
NPStream* stream,
const char* fname)
{
StreamCast(instance, stream)->StreamAsFile(fname);
}

Просмотреть файл

@ -36,8 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef dom_plugins_NPAPIPluginParent_h
#define dom_plugins_NPAPIPluginParent_h
#ifndef dom_plugins_PluginModuleParent_h
#define dom_plugins_PluginModuleParent_h 1
#include <cstring>
@ -52,22 +52,21 @@
#include "base/string_util.h"
#include "mozilla/SharedLibrary.h"
#include "mozilla/plugins/NPAPIProtocol.h"
#include "mozilla/plugins/NPAPIProtocolParent.h"
#include "mozilla/plugins/NPPInstanceParent.h"
#include "mozilla/plugins/PPluginModuleProtocolParent.h"
#include "mozilla/plugins/PluginInstanceParent.h"
#include "mozilla/plugins/PluginProcessParent.h"
#include "nsAutoPtr.h"
#undef _MOZ_LOG
#define _MOZ_LOG(s) printf("[NPAPIPluginParent] %s\n", s)
#define _MOZ_LOG(s) printf("[PluginModuleParent] %s\n", s)
namespace mozilla {
namespace plugins {
//-----------------------------------------------------------------------------
/**
* NPAPIPluginParent
* PluginModuleParent
*
* This class implements the NPP API from the perspective of the rest
* of Gecko, forwarding NPP calls along to the child process that is
@ -77,27 +76,27 @@ namespace plugins {
* child process needs to make these calls back into Gecko proper.
* This class is responsible for "actually" making those function calls.
*/
class NPAPIPluginParent : public NPAPIProtocolParent
class PluginModuleParent : public PPluginModuleProtocolParent
{
private:
typedef mozilla::SharedLibrary SharedLibrary;
protected:
NPPProtocolParent* NPPConstructor(
const nsCString& aMimeType,
PPluginInstanceProtocolParent*
PPluginInstanceConstructor(const nsCString& aMimeType,
const uint16_t& aMode,
const nsTArray<nsCString>& aNames,
const nsTArray<nsCString>& aValues,
NPError* rv);
virtual nsresult NPPDestructor(
NPPProtocolParent* __a,
NPError* rv);
virtual nsresult
PPluginInstanceDestructor(PPluginInstanceProtocolParent* aActor,
NPError* _retval);
public:
NPAPIPluginParent(const char* aFilePath);
PluginModuleParent(const char* aFilePath);
virtual ~NPAPIPluginParent();
virtual ~PluginModuleParent();
/**
* LoadModule
@ -181,17 +180,17 @@ private:
NPError NPP_Destroy(NPP instance, NPSavedData** save);
static inline NPPInstanceParent& InstCast(void* p)
static inline PluginInstanceParent& InstCast(void* p)
{
return *static_cast<NPPInstanceParent*>(p);
return *static_cast<PluginInstanceParent*>(p);
}
static NPPInstanceParent* InstCast(NPP instance);
static NPBrowserStreamParent* StreamCast(NPP instance, NPStream* s);
static PluginInstanceParent* InstCast(NPP instance);
static PluginStreamParent* StreamCast(NPP instance, NPStream* s);
static inline const NPPInstanceParent& InstCast(const void* p)
static inline const PluginInstanceParent& InstCast(const void* p)
{
return *static_cast<const NPPInstanceParent*>(p);
return *static_cast<const PluginInstanceParent*>(p);
}
NPError NPP_SetWindow(NPP instance, NPWindow* window)
@ -449,7 +448,7 @@ private:
class Shim : public SharedLibrary
{
public:
Shim(NPAPIPluginParent* aTarget) :
Shim(PluginModuleParent* aTarget) :
mTarget(aTarget)
{
HACK_target = mTarget;
@ -500,7 +499,7 @@ private:
}
private:
NPAPIPluginParent* mTarget;
PluginModuleParent* mTarget;
// HACKS HACKS HACKS! from here on down
@ -586,8 +585,8 @@ private:
return HACK_target->NPP_SetValue(instance, variable, value);
}
static NPAPIPluginParent* HACK_target;
friend class NPAPIPluginParent;
static PluginModuleParent* HACK_target;
friend class PluginModuleParent;
};
friend class Shim;
@ -597,4 +596,4 @@ private:
} // namespace plugins
} // namespace mozilla
#endif // ifndef dom_plugins_NPAPIPluginParent_h
#endif // ifndef dom_plugins_PluginModuleParent_h

Просмотреть файл

@ -0,0 +1,125 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugin App.
*
* The Initial Developer of the Original Code is
* Ben Turner <bent.mozilla@gmail.com>
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/plugins/PluginScriptableObjectChild.h"
using mozilla::plugins::PluginScriptableObjectChild;
PluginScriptableObjectChild::PluginScriptableObjectChild()
{
}
PluginScriptableObjectChild::~PluginScriptableObjectChild()
{
}
nsresult
PluginScriptableObjectChild::AnswerInvalidate()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerHasMethod(const NPRemoteIdentifier& aId,
bool* aHasMethod)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerInvoke(const NPRemoteIdentifier& aId,
const nsTArray<NPVariant>& aArgs,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerInvokeDefault(const NPRemoteIdentifier& aId,
const nsTArray<NPVariant>& aArgs,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerHasProperty(const NPRemoteIdentifier& aId,
bool* aHasProperty)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerGetProperty(const NPRemoteIdentifier& aId,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerSetProperty(const NPRemoteIdentifier& aId,
const NPVariant& aValue,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerRemoveProperty(const NPRemoteIdentifier& aId,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerEnumerate(nsTArray<NPRemoteIdentifier>* aProperties,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginScriptableObjectChild::AnswerConstruct(const nsTArray<NPVariant>& aArgs,
NPVariant* aResult,
bool* aSuccess)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -36,19 +36,19 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef __DOM_PLUGINS_NPOBJECTCHILD_H__
#define __DOM_PLUGINS_NPOBJECTCHILD_H__
#ifndef dom_plugins_PluginScriptableObjectChild_h
#define dom_plugins_PluginScriptableObjectChild_h 1
#include "mozilla/plugins/NPObjectProtocolChild.h"
#include "mozilla/plugins/PPluginScriptableObjectProtocolChild.h"
namespace mozilla {
namespace plugins {
class NPObjectChild : public NPObjectProtocolChild
class PluginScriptableObjectChild : public PPluginScriptableObjectProtocolChild
{
public:
NPObjectChild();
virtual ~NPObjectChild();
PluginScriptableObjectChild();
virtual ~PluginScriptableObjectChild();
virtual nsresult
AnswerInvalidate();
@ -100,4 +100,4 @@ public:
} /* namespace plugins */
} /* namespace mozilla */
#endif /* __DOM_PLUGINS_NPOBJECTCHILD_H__ */
#endif /* dom_plugins_PluginScriptableObjectChild_h */

Просмотреть файл

@ -36,16 +36,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/plugins/NPObjectParent.h"
#include "mozilla/plugins/PluginScriptableObjectParent.h"
using mozilla::plugins::NPObjectParent;
using mozilla::plugins::PluginScriptableObjectParent;
NPObjectParent::NPObjectParent()
PluginScriptableObjectParent::PluginScriptableObjectParent()
{
}
NPObjectParent::~NPObjectParent()
PluginScriptableObjectParent::~PluginScriptableObjectParent()
{
}

Просмотреть файл

@ -36,22 +36,22 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef __DOM_PLUGINS_NPOBJECTPARENT_H__
#define __DOM_PLUGINS_NPOBJECTPARENT_H__
#ifndef dom_plugins_PluginScriptableObjectParent_h
#define dom_plugins_PluginScriptableObjectParent_h 1
#include "mozilla/plugins/NPObjectProtocolParent.h"
#include "mozilla/plugins/PPluginScriptableObjectProtocolParent.h"
namespace mozilla {
namespace plugins {
class NPObjectParent : public NPObjectProtocolParent
class PluginScriptableObjectParent : public PPluginScriptableObjectProtocolParent
{
public:
NPObjectParent();
virtual ~NPObjectParent();
PluginScriptableObjectParent();
virtual ~PluginScriptableObjectParent();
};
} /* namespace plugins */
} /* namespace mozilla */
#endif /* __DOM_PLUGINS_NPOBJECTPARENT_H__ */
#endif /* dom_plugins_PluginScriptableObjectParent_h */

Просмотреть файл

@ -0,0 +1,122 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugin App.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <benjamin@smedbergs.us>
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "PluginStreamChild.h"
#include "PluginInstanceChild.h"
namespace mozilla {
namespace plugins {
PluginStreamChild::PluginStreamChild(PluginInstanceChild* instance,
const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType,
const bool& seekable,
NPError* rv,
uint16_t* stype)
: mInstance(instance)
, mClosed(false)
, mURL(url)
, mHeaders(headers)
{
memset(&mStream, 0, sizeof(mStream));
mStream.ndata = this;
if (!mURL.IsEmpty())
mStream.url = mURL.get();
mStream.end = length;
mStream.lastmodified = lastmodified;
if (!mHeaders.IsEmpty())
mStream.headers = mHeaders.get();
*rv = mInstance->mPluginIface->newstream(&mInstance->mData,
const_cast<char*>(mimeType.get()),
&mStream, seekable, stype);
if (*rv != NPERR_NO_ERROR)
mClosed = true;
}
nsresult
PluginStreamChild::AnswerNPP_WriteReady(const int32_t& newlength,
int32_t *size)
{
if (mClosed) {
*size = 0;
return NS_OK;
}
mStream.end = newlength;
*size = mInstance->mPluginIface->writeready(&mInstance->mData, &mStream);
return NS_OK;
}
nsresult
PluginStreamChild::AnswerNPP_Write(const int32_t& offset,
const Buffer& data,
int32_t* consumed)
{
if (mClosed) {
*consumed = -1;
return NS_OK;
}
*consumed = mInstance->mPluginIface->write(&mInstance->mData, &mStream,
offset, data.Length(),
const_cast<char*>(data.get()));
if (*consumed < 0)
mClosed = true;
return NS_OK;
}
nsresult
PluginStreamChild::AnswerNPP_StreamAsFile(const nsCString& fname)
{
if (mClosed)
return NS_OK;
mInstance->mPluginIface->asfile(&mInstance->mData, &mStream,
fname.get());
return NS_OK;
}
} /* namespace plugins */
} /* namespace mozilla */

Просмотреть файл

@ -0,0 +1,83 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=4 ts=4 et :
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Plugin App.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <benjamin@smedbergs.us>
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_plugins_PluginStreamChild_h
#define mozilla_plugins_PluginStreamChild_h 1
#include "mozilla/plugins/PPluginStreamProtocolChild.h"
namespace mozilla {
namespace plugins {
class PluginInstanceChild;
class PluginStreamChild : public PPluginStreamProtocolChild
{
public:
PluginStreamChild(PluginInstanceChild* instance,
const nsCString& url,
const uint32_t& length,
const uint32_t& lastmodified,
const nsCString& headers,
const nsCString& mimeType,
const bool& seekable,
NPError* rv,
uint16_t* stype);
virtual ~PluginStreamChild() { }
virtual nsresult AnswerNPP_WriteReady(const int32_t& newlength,
int32_t *size);
virtual nsresult AnswerNPP_Write(const int32_t& offset,
const Buffer& data,
int32_t* consumed);
virtual nsresult AnswerNPP_StreamAsFile(const nsCString& fname);
private:
PluginInstanceChild* mInstance;
NPStream mStream;
bool mClosed;
nsCString mURL;
nsCString mHeaders;
};
} // namespace plugins
} // namespace mozilla
#endif /* mozilla_plugins_PluginStreamChild_h */

Просмотреть файл

@ -1,12 +1,12 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
#include "NPBrowserStreamParent.h"
#include "NPPInstanceParent.h"
#include "PluginStreamParent.h"
#include "PluginInstanceParent.h"
namespace mozilla {
namespace plugins {
NPBrowserStreamParent::NPBrowserStreamParent(NPPInstanceParent* npp,
PluginStreamParent::PluginStreamParent(PluginInstanceParent* npp,
NPStream* stream)
: mNPP(npp)
, mStream(stream)
@ -15,7 +15,7 @@ NPBrowserStreamParent::NPBrowserStreamParent(NPPInstanceParent* npp,
}
nsresult
NPBrowserStreamParent::AnswerNPN_RequestRead(const IPCByteRanges& ranges,
PluginStreamParent::AnswerNPN_RequestRead(const IPCByteRanges& ranges,
NPError* result)
{
if (!mStream)
@ -38,7 +38,7 @@ NPBrowserStreamParent::AnswerNPN_RequestRead(const IPCByteRanges& ranges,
}
int32_t
NPBrowserStreamParent::WriteReady()
PluginStreamParent::WriteReady()
{
int32_t result;
nsresult rv = CallNPP_WriteReady(mStream->end, &result);
@ -49,7 +49,9 @@ NPBrowserStreamParent::WriteReady()
}
int32_t
NPBrowserStreamParent::Write(int32_t offset, int32_t len, void* buffer)
PluginStreamParent::Write(int32_t offset,
int32_t len,
void* buffer)
{
int32_t result;
nsresult rv = CallNPP_Write(offset,
@ -59,18 +61,18 @@ NPBrowserStreamParent::Write(int32_t offset, int32_t len, void* buffer)
return -1;
if (result == -1)
mNPP->CallNPBrowserStreamDestructor(this, NPRES_USER_BREAK, true);
mNPP->CallPPluginStreamDestructor(this, NPRES_USER_BREAK, true);
return result;
}
void
NPBrowserStreamParent::StreamAsFile(const char* fname)
PluginStreamParent::StreamAsFile(const char* fname)
{
CallNPP_StreamAsFile(nsCString(fname));
}
NPError
NPBrowserStreamParent::NPN_DestroyStream(NPReason reason)
PluginStreamParent::NPN_DestroyStream(NPReason reason)
{
return mNPP->mNPNIface->destroystream(mNPP->mNPP, mStream, reason);
}

Просмотреть файл

@ -3,22 +3,22 @@
#ifndef mozilla_plugins_NPBrowserStreamParent_h
#define mozilla_plugins_NPBrowserStreamParent_h
#include "mozilla/plugins/NPBrowserStreamProtocolParent.h"
#include "mozilla/plugins/PPluginStreamProtocolParent.h"
namespace mozilla {
namespace plugins {
class NPPInstanceParent;
class PluginInstanceParent;
class NPBrowserStreamParent : public NPBrowserStreamProtocolParent
class PluginStreamParent : public PPluginStreamProtocolParent
{
friend class NPAPIPluginParent;
friend class NPPInstanceParent;
friend class PluginModuleParent;
friend class PluginInstanceParent;
public:
NPBrowserStreamParent(NPPInstanceParent* npp,
PluginStreamParent(PluginInstanceParent* npp,
NPStream* stream);
virtual ~NPBrowserStreamParent() { }
virtual ~PluginStreamParent() { }
virtual nsresult AnswerNPN_RequestRead(const IPCByteRanges& ranges,
NPError* result);
@ -29,7 +29,7 @@ public:
NPError NPN_DestroyStream(NPError reason);
private:
NPPInstanceParent* mNPP;
PluginInstanceParent* mNPP;
NPStream* mStream;
};

Просмотреть файл

@ -46,7 +46,7 @@
#include "base/file_path.h"
#include "mozilla/ipc/GeckoThread.h"
#include "mozilla/plugins/NPAPIPluginChild.h"
#include "mozilla/plugins/PluginModuleChild.h"
#undef _MOZ_LOG
#define _MOZ_LOG(s) printf("[PluginThreadChild] %s", s)
@ -71,7 +71,7 @@ private:
// not NPAPI-specific, but there's not really another good
// place to store this reference. and there's no need to make
// a generic |Plugin| class yet
NPAPIPluginChild mPlugin;
PluginModuleChild mPlugin;
IPC::Channel* mChannel;
DISALLOW_EVIL_CONSTRUCTORS(PluginThreadChild);

Просмотреть файл

@ -1,6 +1,42 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Plugins.
#
# The Initial Developer of the Original Code is
# Benjamin Smedberg<benjamin@smedbergs.us>.
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
IPDLSRCS = \
NPAPI.ipdl \
NPP.ipdl \
NPObject.ipdl \
NPBrowserStream.ipdl \
PPluginModule.ipdl \
PPluginInstance.ipdl \
PPluginScriptableObject.ipdl \
PPluginStream.ipdl \
$(NULL)

Просмотреть файл

@ -95,8 +95,8 @@ using mozilla::SharedLibrary;
using mozilla::SharedPRLibrary;
#ifdef MOZ_IPC
#include "mozilla/plugins/NPAPIPluginParent.h"
using mozilla::plugins::NPAPIPluginParent;
#include "mozilla/plugins/PluginModuleParent.h"
using mozilla::plugins::PluginModuleParent;
#endif
static PRLock *sPluginThreadAsyncCallLock = nsnull;
@ -397,7 +397,7 @@ GetNewSharedLibrary(const char* aFilePath,
{
#ifdef MOZ_IPC
if (aFilePath && OOPPluginsEnabled()) {
return NPAPIPluginParent::LoadModule(aFilePath, aLibrary);
return PluginModuleParent::LoadModule(aFilePath, aLibrary);
}
#endif
return new SharedPRLibrary(aFilePath, aLibrary);