webaccounts-browser-extension-0.5/ 0000755 0001750 0001750 00000000000 12165544707 016755 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/AUTHORS 0000644 0001750 0001750 00000000000 12165544500 020002 0 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/firefox-extension/ 0000755 0001750 0001750 00000000000 12165544707 022431 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/firefox-extension/content/ 0000755 0001750 0001750 00000000000 12165544707 024103 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/firefox-extension/content/browser.xul 0000644 0001750 0001750 00000000405 12165544500 026306 0 ustar ken ken 0000000 0000000
webaccounts-browser-extension-0.5/firefox-extension/content/browser.js.in 0000644 0001750 0001750 00000004112 12165544500 026516 0 ustar ken ken 0000000 0000000 (function() {
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const kObserverTopic = "webapps-login";
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
function collectCookies(msg) {
var cookies = Services.cookies.getCookiesFromHost(msg.domain);
dump("Collecting cookies\n");
var cookieDict = {}
while (cookies.hasMoreElements()){
var cookie = cookies.getNext().QueryInterface(Ci.nsICookie);
var hostCookies = ""
if (cookie.host in cookieDict) {
hostCookies = cookieDict[cookie.host];
hostCookies += ";" + cookie.name + "=" + cookie.value;
} else {
hostCookies = cookie.name + "=" + cookie.value;
}
cookieDict[cookie.host] = hostCookies;
}
if (typeof this.libWebAccounts == "undefined") {
this.libWebAccounts = ctypes.open("@PKGLIBDIR@/libwebaccounts.so");
}
var setLoginInfo = this.libWebAccounts.declare("webaccounts_login_handler_set_json",
ctypes.default_abi,
ctypes.void_t,
ctypes.char.ptr);
setLoginInfo(JSON.stringify({
login: msg.login,
domain: msg.domain,
cookies: cookieDict
}));
}
window.addEventListener("load", function() {
window.removeEventListener("load", arguments.callee, false);
var WebAccountsObserver = {
observe: function(subject, topic, login) {
if (topic != 'webapps-login' || login == "") return;
dump("Login: " + login + "\n");
var loginObj = JSON.parse(login);
if (loginObj.login) {
collectCookies(loginObj);
}
}
};
Services.obs.addObserver(WebAccountsObserver, kObserverTopic, false);
window.addEventListener("unload", function() {
window.removeEventListener("unload", arguments.callee, false);
Services.obs.removeObserver(WebAccountsObserver, kObserverTopic);
dump("Webaccounts extension unloaded\n");
}, false);
dump("Webaccounts extension loaded\n");
}, false);
})();
webaccounts-browser-extension-0.5/firefox-extension/chrome.manifest 0000644 0001750 0001750 00000000213 12165544500 025421 0 ustar ken ken 0000000 0000000 resource webaccounts content/
content webaccounts content/
overlay chrome://browser/content/browser.xul resource://webaccounts/browser.xul
webaccounts-browser-extension-0.5/firefox-extension/Makefile.am 0000644 0001750 0001750 00000001160 12165544500 024452 0 ustar ken ken 0000000 0000000 CLEANFILES =
EXTRA_DIST =
extensiondir = $(libdir)/webaccounts-firefox
extension_DATA = \
webaccounts-firefox-extension.xpi
CLEANFILES += \
$(extension_DATA)
extension_files = \
chrome.manifest \
content/browser.js \
content/browser.xul \
install.rdf
noinst_DATA = $(extension_files)
content/browser.js: content/browser.js.in
$(MKDIR_P) content
$(SED) -e "s|\@PKGLIBDIR\@|$(pkglibdir)|" $< > $@
webaccounts-firefox-extension.xpi: $(extension_files)
zip $@ $(extension_files)
CLEANFILES += \
content/browser.js \
install.rdf
EXTRA_DIST += \
chrome.manifest \
content/browser.js.in \
content/browser.xul
webaccounts-browser-extension-0.5/firefox-extension/install.rdf.in 0000644 0001750 0001750 00000001614 12165544500 025172 0 ustar ken ken 0000000 0000000
online-accounts@lists.launchpad.net
Ubuntu Online Accounts
@PACKAGE_VERSION@
Ubuntu Online Accounts
Online Accounts team at Canonical
https://launchpad.net/online-accounts
2
true
{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
9.0
15.*
webaccounts-browser-extension-0.5/npapi-plugin/ 0000755 0001750 0001750 00000000000 12165544707 021360 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/npapi-plugin/Makefile.am 0000644 0001750 0001750 00000000017 12165544500 023401 0 ustar ken ken 0000000 0000000 SUBDIRS = src
webaccounts-browser-extension-0.5/npapi-plugin/src/ 0000755 0001750 0001750 00000000000 12165544707 022147 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/npapi-plugin/src/npapi-headers/ 0000755 0001750 0001750 00000000000 12165544707 024667 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/npapi-plugin/src/npapi-headers/headers/ 0000755 0001750 0001750 00000000000 12165544707 026302 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/npapi-plugin/src/npapi-headers/headers/npruntime.h 0000644 0001750 0001750 00000037776 12165544500 030507 0 ustar ken ken 0000000 0000000 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
* Foundation ("Mozilla") nor the names of their contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
* THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _NP_RUNTIME_H_
#define _NP_RUNTIME_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "nptypes.h"
/*
This API is used to facilitate binding code written in C to script
objects. The API in this header does not assume the presence of a
user agent. That is, it can be used to bind C code to scripting
environments outside of the context of a user agent.
However, the normal use of the this API is in the context of a
scripting environment running in a browser or other user agent.
In particular it is used to support the extended Netscape
script-ability API for plugins (NP-SAP). NP-SAP is an extension
of the Netscape plugin API. As such we have adopted the use of
the "NP" prefix for this API.
The following NP{N|P}Variables were added to the Netscape plugin
API (in npapi.h):
NPNVWindowNPObject
NPNVPluginElementNPObject
NPPVpluginScriptableNPObject
These variables are exposed through NPN_GetValue() and
NPP_GetValue() (respectively) and are used to establish the
initial binding between the user agent and native code. The DOM
objects in the user agent can be examined and manipulated using
the NPN_ functions that operate on NPObjects described in this
header.
To the extent possible the assumptions about the scripting
language used by the scripting environment have been minimized.
*/
#define NP_BEGIN_MACRO do {
#define NP_END_MACRO } while (0)
/*
Objects (non-primitive data) passed between 'C' and script is
always wrapped in an NPObject. The 'interface' of an NPObject is
described by an NPClass.
*/
typedef struct NPObject NPObject;
typedef struct NPClass NPClass;
typedef char NPUTF8;
typedef struct _NPString {
const NPUTF8 *UTF8Characters;
uint32_t UTF8Length;
} NPString;
typedef enum {
NPVariantType_Void,
NPVariantType_Null,
NPVariantType_Bool,
NPVariantType_Int32,
NPVariantType_Double,
NPVariantType_String,
NPVariantType_Object
} NPVariantType;
typedef struct _NPVariant {
NPVariantType type;
union {
bool boolValue;
int32_t intValue;
double doubleValue;
NPString stringValue;
NPObject *objectValue;
} value;
} NPVariant;
/*
NPN_ReleaseVariantValue is called on all 'out' parameters
references. Specifically it is to be called on variants that own
their value, as is the case with all non-const NPVariant*
arguments after a successful call to any methods (except this one)
in this API.
After calling NPN_ReleaseVariantValue, the type of the variant
will be NPVariantType_Void.
*/
void NPN_ReleaseVariantValue(NPVariant *variant);
#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void)
#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null)
#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
#define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32)
#define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double)
#define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String)
#define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object)
#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
#define NPVARIANT_TO_INT32(_v) ((_v).value.intValue)
#define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue)
#define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue)
#define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue)
#define VOID_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Void; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define NULL_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Null; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define BOOLEAN_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Bool; \
(_v).value.boolValue = !!(_val); \
NP_END_MACRO
#define INT32_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Int32; \
(_v).value.intValue = _val; \
NP_END_MACRO
#define DOUBLE_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Double; \
(_v).value.doubleValue = _val; \
NP_END_MACRO
#define STRINGZ_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, (uint32_t)(strlen(_val)) }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define STRINGN_TO_NPVARIANT(_val, _len, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, (uint32_t)(_len) }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define OBJECT_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Object; \
(_v).value.objectValue = _val; \
NP_END_MACRO
/*
Type mappings (JavaScript types have been used for illustration
purposes):
JavaScript to C (NPVariant with type:)
undefined NPVariantType_Void
null NPVariantType_Null
Boolean NPVariantType_Bool
Number NPVariantType_Double or NPVariantType_Int32
String NPVariantType_String
Object NPVariantType_Object
C (NPVariant with type:) to JavaScript
NPVariantType_Void undefined
NPVariantType_Null null
NPVariantType_Bool Boolean
NPVariantType_Int32 Number
NPVariantType_Double Number
NPVariantType_String String
NPVariantType_Object Object
*/
typedef void *NPIdentifier;
/*
NPObjects have methods and properties. Methods and properties are
identified with NPIdentifiers. These identifiers may be reflected
in script. NPIdentifiers can be either strings or integers, IOW,
methods and properties can be identified by either strings or
integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
compared using ==. In case of any errors, the requested
NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled
by the browser. Plugins do not need to worry about memory management
with regards to NPIdentifiers.
*/
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
bool NPN_IdentifierIsString(NPIdentifier identifier);
/*
The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
*/
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
/*
Get the integer represented by identifier. If identifier is not an
integer identifier, the behaviour is undefined.
*/
int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
/*
NPObject behavior is implemented using the following set of
callback functions.
The NPVariant *result argument of these functions (where
applicable) should be released using NPN_ReleaseVariantValue().
*/
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *args, uint32_t argCount,
NPVariant *result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
const NPVariant *args,
uint32_t argCount,
NPVariant *result);
typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
NPVariant *result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj,
NPIdentifier name);
typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value,
uint32_t *count);
typedef bool (*NPConstructFunctionPtr)(NPObject *npobj,
const NPVariant *args,
uint32_t argCount,
NPVariant *result);
/*
NPObjects returned by create, retain, invoke, and getProperty pass
a reference count to the caller. That is, the callee adds a
reference count which passes to the caller. It is the caller's
responsibility to release the returned object.
NPInvokeFunctionPtr function may return 0 to indicate a void
result.
NPInvalidateFunctionPtr is called by the scripting environment
when the native code is shutdown. Any attempt to message a
NPObject instance after the invalidate callback has been
called will result in undefined behavior, even if the native code
is still retaining those NPObject instances. (The runtime
will typically return immediately, with 0 or NULL, from an attempt
to dispatch to a NPObject, but this behavior should not be
depended upon.)
The NPEnumerationFunctionPtr function may pass an array of
NPIdentifiers back to the caller. The callee allocs the memory of
the array using NPN_MemAlloc(), and it's the caller's responsibility
to release it using NPN_MemFree().
*/
struct NPClass
{
uint32_t structVersion;
NPAllocateFunctionPtr allocate;
NPDeallocateFunctionPtr deallocate;
NPInvalidateFunctionPtr invalidate;
NPHasMethodFunctionPtr hasMethod;
NPInvokeFunctionPtr invoke;
NPInvokeDefaultFunctionPtr invokeDefault;
NPHasPropertyFunctionPtr hasProperty;
NPGetPropertyFunctionPtr getProperty;
NPSetPropertyFunctionPtr setProperty;
NPRemovePropertyFunctionPtr removeProperty;
NPEnumerationFunctionPtr enumerate;
NPConstructFunctionPtr construct;
};
#define NP_CLASS_STRUCT_VERSION 3
#define NP_CLASS_STRUCT_VERSION_ENUM 2
#define NP_CLASS_STRUCT_VERSION_CTOR 3
#define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \
((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM)
#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \
((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR)
struct NPObject {
NPClass *_class;
uint32_t referenceCount;
/*
* Additional space may be allocated here by types of NPObjects
*/
};
/*
If the class has an allocate function, NPN_CreateObject invokes
that function, otherwise a NPObject is allocated and
returned. This method will initialize the referenceCount member of
the NPObject to 1.
*/
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
/*
Increment the NPObject's reference count.
*/
NPObject *NPN_RetainObject(NPObject *npobj);
/*
Decremented the NPObject's reference count. If the reference
count goes to zero, the class's destroy function is invoke if
specified, otherwise the object is freed directly.
*/
void NPN_ReleaseObject(NPObject *npobj);
/*
Functions to access script objects represented by NPObject.
Calls to script objects are synchronous. If a function returns a
value, it will be supplied via the result NPVariant
argument. Successful calls will return true, false will be
returned in case of an error.
Calls made from plugin code to script must be made from the thread
on which the plugin was initialized.
*/
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result);
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
NPVariant *result);
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
NPVariant *result);
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
const NPVariant *value);
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
uint32_t *count);
bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
/*
NPN_SetException may be called to trigger a script exception upon
return from entry points into NPObjects. Typical usage:
NPN_SetException (npobj, message);
*/
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
#ifdef __cplusplus
}
#endif
#endif
webaccounts-browser-extension-0.5/npapi-plugin/src/npapi-headers/headers/npapi.h 0000644 0001750 0001750 00000070053 12165544500 027556 0 ustar ken ken 0000000 0000000 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* 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 npapi_h_
#define npapi_h_
#if defined(__OS2__)
#pragma pack(1)
#endif
#include "nptypes.h"
#if defined(__OS2__) || defined(OS2)
#ifndef XP_OS2
#define XP_OS2 1
#endif
#endif
#if defined(_WIN32) && !defined(__SYMBIAN32__)
#include
#ifndef XP_WIN
#define XP_WIN 1
#endif
#endif
#if defined(__SYMBIAN32__)
#ifndef XP_SYMBIAN
#define XP_SYMBIAN 1
#undef XP_WIN
#endif
#endif
#if defined(__APPLE_CC__) && !defined(XP_UNIX)
#ifndef XP_MACOSX
#define XP_MACOSX 1
#endif
#endif
#if defined(XP_MACOSX) && defined(__LP64__)
#define NP_NO_QUICKDRAW
#define NP_NO_CARBON
#endif
#if defined(XP_MACOSX)
#include
#include
#ifndef NP_NO_CARBON
#include
#endif
#endif
#if defined(XP_UNIX)
#include
#if defined(MOZ_X11)
#include
#include
#endif
#endif
#if defined(XP_SYMBIAN)
#include
#include
#endif
/*----------------------------------------------------------------------*/
/* Plugin Version Constants */
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
#define NP_VERSION_MINOR 27
/* The OS/2 version of Netscape uses RC_DATA to define the
mime types, file extensions, etc that are required.
Use a vertical bar to separate types, end types with \0.
FileVersion and ProductVersion are 32bit ints, all other
entries are strings that MUST be terminated with a \0.
AN EXAMPLE:
RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
RCDATA NP_INFO_MIMEType { "video/x-video|",
"video/x-flick\0" }
RCDATA NP_INFO_FileExtents { "avi|",
"flc\0" }
RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
"MMOS2 Flc/Fli player(*.flc)\0" }
RCDATA NP_INFO_FileVersion { 1,0,0,1 }
RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
RCDATA NP_INFO_InternalName { "NPAVI32\0" )
RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
*/
/* RC_DATA types for version info - required */
#define NP_INFO_ProductVersion 1
#define NP_INFO_MIMEType 2
#define NP_INFO_FileOpenName 3
#define NP_INFO_FileExtents 4
/* RC_DATA types for version info - used if found */
#define NP_INFO_FileDescription 5
#define NP_INFO_ProductName 6
/* RC_DATA types for version info - optional */
#define NP_INFO_CompanyName 7
#define NP_INFO_FileVersion 8
#define NP_INFO_InternalName 9
#define NP_INFO_LegalCopyright 10
#define NP_INFO_OriginalFilename 11
#ifndef RC_INVOKED
/*----------------------------------------------------------------------*/
/* Definition of Basic Types */
/*----------------------------------------------------------------------*/
typedef unsigned char NPBool;
typedef int16_t NPError;
typedef int16_t NPReason;
typedef char* NPMIMEType;
/*----------------------------------------------------------------------*/
/* Structures and definitions */
/*----------------------------------------------------------------------*/
#if !defined(__LP64__)
#if defined(XP_MACOSX)
#pragma options align=mac68k
#endif
#endif /* __LP64__ */
/*
* NPP is a plug-in's opaque instance handle
*/
typedef struct _NPP
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
} NPP_t;
typedef NPP_t* NPP;
typedef struct _NPStream
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
const char* url;
uint32_t end;
uint32_t lastmodified;
void* notifyData;
const char* headers; /* Response headers from host.
* Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
* Used for HTTP only; NULL for non-HTTP.
* Available from NPP_NewStream onwards.
* Plugin should copy this data before storing it.
* Includes HTTP status line and all headers,
* preferably verbatim as received from server,
* headers formatted as in HTTP ("Header: Value"),
* and newlines (\n, NOT \r\n) separating lines.
* Terminated by \n\0 (NOT \n\n\0). */
} NPStream;
typedef struct _NPByteRange
{
int32_t offset; /* negative offset means from the end */
uint32_t length;
struct _NPByteRange* next;
} NPByteRange;
typedef struct _NPSavedData
{
int32_t len;
void* buf;
} NPSavedData;
typedef struct _NPRect
{
uint16_t top;
uint16_t left;
uint16_t bottom;
uint16_t right;
} NPRect;
typedef struct _NPSize
{
int32_t width;
int32_t height;
} NPSize;
typedef enum {
NPFocusNext = 0,
NPFocusPrevious = 1
} NPFocusDirection;
/* Return values for NPP_HandleEvent */
#define kNPEventNotHandled 0
#define kNPEventHandled 1
/* Exact meaning must be spec'd in event model. */
#define kNPEventStartIME 2
#if defined(XP_UNIX)
/*
* Unix specific structures and definitions
*/
/*
* Callback Structures.
*
* These are used to pass additional platform specific information.
*/
enum {
NP_SETWINDOW = 1,
NP_PRINT
};
typedef struct
{
int32_t type;
} NPAnyCallbackStruct;
typedef struct
{
int32_t type;
#if defined(MOZ_X11)
Display* display;
Visual* visual;
Colormap colormap;
unsigned int depth;
#endif
} NPSetWindowCallbackStruct;
typedef struct
{
int32_t type;
FILE* fp;
} NPPrintCallbackStruct;
#endif /* XP_UNIX */
#if defined(XP_MACOSX)
typedef enum {
#ifndef NP_NO_QUICKDRAW
NPDrawingModelQuickDraw = 0,
#endif
NPDrawingModelCoreGraphics = 1,
NPDrawingModelOpenGL = 2,
NPDrawingModelCoreAnimation = 3,
NPDrawingModelInvalidatingCoreAnimation = 4
} NPDrawingModel;
typedef enum {
#ifndef NP_NO_CARBON
NPEventModelCarbon = 0,
#endif
NPEventModelCocoa = 1
} NPEventModel;
#endif
/*
* The following masks are applied on certain platforms to NPNV and
* NPPV selectors that pass around pointers to COM interfaces. Newer
* compilers on some platforms may generate vtables that are not
* compatible with older compilers. To prevent older plugins from
* not understanding a new browser's ABI, these masks change the
* values of those selectors on those platforms. To remain backwards
* compatible with different versions of the browser, plugins can
* use these masks to dynamically determine and use the correct C++
* ABI that the browser is expecting. This does not apply to Windows
* as Microsoft's COM ABI will likely not change.
*/
#define NP_ABI_GCC3_MASK 0x10000000
/*
* gcc 3.x generated vtables on UNIX and OSX are incompatible with
* previous compilers.
*/
#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
#else
#define _NP_ABI_MIXIN_FOR_GCC3 0
#endif
#if defined(XP_MACOSX)
#define NP_ABI_MACHO_MASK 0x01000000
#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
#else
#define _NP_ABI_MIXIN_FOR_MACHO 0
#endif
#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
/*
* List of variable names for which NPP_GetValue shall be implemented
*/
typedef enum {
NPPVpluginNameString = 1,
NPPVpluginDescriptionString,
NPPVpluginWindowBool,
NPPVpluginTransparentBool,
NPPVjavaClass,
NPPVpluginWindowSize,
NPPVpluginTimerInterval,
NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
NPPVpluginScriptableIID = 11,
NPPVjavascriptPushCallerBool = 12,
NPPVpluginKeepLibraryInMemory = 13,
NPPVpluginNeedsXEmbed = 14,
/* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14.
*/
NPPVpluginScriptableNPObject = 15,
/* Get the plugin value (as \0-terminated UTF-8 string data) for
* form submission if the plugin is part of a form. Use
* NPN_MemAlloc() to allocate memory for the string data. Introduced
* in NPAPI minor version 15.
*/
NPPVformValue = 16,
NPPVpluginUrlRequestsDisplayedBool = 17,
/* Checks if the plugin is interested in receiving the http body of
* all http requests (including failed ones, http status != 200).
*/
NPPVpluginWantsAllNetworkStreams = 18,
/* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
NPPVpluginNativeAccessibleAtkPlugId = 19,
/* Checks to see if the plug-in would like the browser to load the "src" attribute. */
NPPVpluginCancelSrcStream = 20,
NPPVsupportsAdvancedKeyHandling = 21,
NPPVpluginUsesDOMForCursorBool = 22
#if defined(XP_MACOSX)
/* Used for negotiating drawing models */
, NPPVpluginDrawingModel = 1000
/* Used for negotiating event models */
, NPPVpluginEventModel = 1001
/* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
, NPPVpluginCoreAnimationLayer = 1003
#endif
#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
, NPPVpluginWindowlessLocalBool = 2002
#endif
} NPPVariable;
/*
* List of variable names for which NPN_GetValue should be implemented.
*/
typedef enum {
NPNVxDisplay = 1,
NPNVxtAppContext,
NPNVnetscapeWindow,
NPNVjavascriptEnabledBool,
NPNVasdEnabledBool,
NPNVisOfflineBool,
NPNVserviceManager = (10 | NP_ABI_MASK),
NPNVDOMElement = (11 | NP_ABI_MASK),
NPNVDOMWindow = (12 | NP_ABI_MASK),
NPNVToolkit = (13 | NP_ABI_MASK),
NPNVSupportsXEmbedBool = 14,
/* Get the NPObject wrapper for the browser window. */
NPNVWindowNPObject = 15,
/* Get the NPObject wrapper for the plugins DOM element. */
NPNVPluginElementNPObject = 16,
NPNVSupportsWindowless = 17,
NPNVprivateModeBool = 18,
NPNVsupportsAdvancedKeyHandling = 21,
NPNVdocumentOrigin = 22
#if defined(XP_MACOSX)
/* Used for negotiating drawing models */
, NPNVpluginDrawingModel = 1000
#ifndef NP_NO_QUICKDRAW
, NPNVsupportsQuickDrawBool = 2000
#endif
, NPNVsupportsCoreGraphicsBool = 2001
, NPNVsupportsOpenGLBool = 2002
, NPNVsupportsCoreAnimationBool = 2003
, NPNVsupportsInvalidatingCoreAnimationBool = 2004
#ifndef NP_NO_CARBON
, NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
#endif
, NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
, NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
Cocoa text input specification. */
, NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
CA model compositing */
#endif
#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
, NPNVSupportsWindowlessLocal = 2002
#endif
} NPNVariable;
typedef enum {
NPNURLVCookie = 501,
NPNURLVProxy
} NPNURLVariable;
/*
* The type of Toolkit the widgets use
*/
typedef enum {
NPNVGtk12 = 1,
NPNVGtk2
} NPNToolkitType;
/*
* The type of a NPWindow - it specifies the type of the data structure
* returned in the window field.
*/
typedef enum {
NPWindowTypeWindow = 1,
NPWindowTypeDrawable
} NPWindowType;
typedef struct _NPWindow
{
void* window; /* Platform specific window handle */
/* OS/2: x - Position of bottom left corner */
/* OS/2: y - relative to visible netscape window */
int32_t x; /* Position of top left corner relative */
int32_t y; /* to a netscape page. */
uint32_t width; /* Maximum window size */
uint32_t height;
NPRect clipRect; /* Clipping rectangle in port coordinates */
#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
void * ws_info; /* Platform-dependent additional data */
#endif /* XP_UNIX */
NPWindowType type; /* Is this a window or a drawable? */
} NPWindow;
typedef struct _NPImageExpose
{
char* data; /* image pointer */
int32_t stride; /* Stride of data image pointer */
int32_t depth; /* Depth of image pointer */
int32_t x; /* Expose x */
int32_t y; /* Expose y */
uint32_t width; /* Expose width */
uint32_t height; /* Expose height */
NPSize dataSize; /* Data buffer size */
float translateX; /* translate X matrix value */
float translateY; /* translate Y matrix value */
float scaleX; /* scale X matrix value */
float scaleY; /* scale Y matrix value */
} NPImageExpose;
typedef struct _NPFullPrint
{
NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
NPBool printOne; /* TRUE if plugin should print one copy to default
printer */
void* platformPrint; /* Platform-specific printing info */
} NPFullPrint;
typedef struct _NPEmbedPrint
{
NPWindow window;
void* platformPrint; /* Platform-specific printing info */
} NPEmbedPrint;
typedef struct _NPPrint
{
uint16_t mode; /* NP_FULL or NP_EMBED */
union
{
NPFullPrint fullPrint; /* if mode is NP_FULL */
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
} print;
} NPPrint;
#if defined(XP_MACOSX)
#ifndef NP_NO_CARBON
typedef EventRecord NPEvent;
#endif
#elif defined(XP_SYMBIAN)
typedef QEvent NPEvent;
#elif defined(XP_WIN)
typedef struct _NPEvent
{
uint16_t event;
uintptr_t wParam;
uintptr_t lParam;
} NPEvent;
#elif defined(XP_OS2)
typedef struct _NPEvent
{
uint32_t event;
uint32_t wParam;
uint32_t lParam;
} NPEvent;
#elif defined(XP_UNIX) && defined(MOZ_X11)
typedef XEvent NPEvent;
#else
typedef void* NPEvent;
#endif
#if defined(XP_MACOSX)
typedef void* NPRegion;
#ifndef NP_NO_QUICKDRAW
typedef RgnHandle NPQDRegion;
#endif
typedef CGPathRef NPCGRegion;
#elif defined(XP_WIN)
typedef HRGN NPRegion;
#elif defined(XP_UNIX) && defined(MOZ_X11)
typedef Region NPRegion;
#elif defined(XP_SYMBIAN)
typedef QRegion* NPRegion;
#else
typedef void *NPRegion;
#endif
typedef struct _NPNSString NPNSString;
typedef struct _NPNSWindow NPNSWindow;
typedef struct _NPNSMenu NPNSMenu;
#if defined(XP_MACOSX)
typedef NPNSMenu NPMenu;
#else
typedef void *NPMenu;
#endif
typedef enum {
NPCoordinateSpacePlugin = 1,
NPCoordinateSpaceWindow,
NPCoordinateSpaceFlippedWindow,
NPCoordinateSpaceScreen,
NPCoordinateSpaceFlippedScreen
} NPCoordinateSpace;
#if defined(XP_MACOSX)
#ifndef NP_NO_QUICKDRAW
typedef struct NP_Port
{
CGrafPtr port;
int32_t portx; /* position inside the topmost window */
int32_t porty;
} NP_Port;
#endif /* NP_NO_QUICKDRAW */
/*
* NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
* as its drawing model.
*/
typedef struct NP_CGContext
{
CGContextRef context;
void *window; /* A WindowRef under the Carbon event model. */
} NP_CGContext;
/*
* NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
* drawing model.
*/
typedef struct NP_GLContext
{
CGLContextObj context;
#ifdef NP_NO_CARBON
NPNSWindow *window;
#else
void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
#endif
} NP_GLContext;
typedef enum {
NPCocoaEventDrawRect = 1,
NPCocoaEventMouseDown,
NPCocoaEventMouseUp,
NPCocoaEventMouseMoved,
NPCocoaEventMouseEntered,
NPCocoaEventMouseExited,
NPCocoaEventMouseDragged,
NPCocoaEventKeyDown,
NPCocoaEventKeyUp,
NPCocoaEventFlagsChanged,
NPCocoaEventFocusChanged,
NPCocoaEventWindowFocusChanged,
NPCocoaEventScrollWheel,
NPCocoaEventTextInput
} NPCocoaEventType;
typedef struct _NPCocoaEvent {
NPCocoaEventType type;
uint32_t version;
union {
struct {
uint32_t modifierFlags;
double pluginX;
double pluginY;
int32_t buttonNumber;
int32_t clickCount;
double deltaX;
double deltaY;
double deltaZ;
} mouse;
struct {
uint32_t modifierFlags;
NPNSString *characters;
NPNSString *charactersIgnoringModifiers;
NPBool isARepeat;
uint16_t keyCode;
} key;
struct {
CGContextRef context;
double x;
double y;
double width;
double height;
} draw;
struct {
NPBool hasFocus;
} focus;
struct {
NPNSString *text;
} text;
} data;
} NPCocoaEvent;
#ifndef NP_NO_CARBON
/* Non-standard event types that can be passed to HandleEvent */
enum NPEventType {
NPEventType_GetFocusEvent = (osEvt + 16),
NPEventType_LoseFocusEvent,
NPEventType_AdjustCursorEvent,
NPEventType_MenuCommandEvent,
NPEventType_ClippingChangedEvent,
NPEventType_ScrollingBeginsEvent = 1000,
NPEventType_ScrollingEndsEvent
};
#endif /* NP_NO_CARBON */
#endif /* XP_MACOSX */
/*
* Values for mode passed to NPP_New:
*/
#define NP_EMBED 1
#define NP_FULL 2
/*
* Values for stream type passed to NPP_NewStream:
*/
#define NP_NORMAL 1
#define NP_SEEK 2
#define NP_ASFILE 3
#define NP_ASFILEONLY 4
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
/*
* Flags for NPP_ClearSiteData.
*/
#define NP_CLEAR_ALL 0
#define NP_CLEAR_CACHE (1 << 0)
#if !defined(__LP64__)
#if defined(XP_MACOSX)
#pragma options align=reset
#endif
#endif /* __LP64__ */
/*----------------------------------------------------------------------*/
/* Error and Reason Code definitions */
/*----------------------------------------------------------------------*/
/*
* Values of type NPError:
*/
#define NPERR_BASE 0
#define NPERR_NO_ERROR (NPERR_BASE + 0)
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
#define NPERR_INVALID_URL (NPERR_BASE + 10)
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
#define NPERR_NO_DATA (NPERR_BASE + 12)
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
#define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
#define NPERR_MALFORMED_SITE (NPERR_BASE + 15)
/*
* Values of type NPReason:
*/
#define NPRES_BASE 0
#define NPRES_DONE (NPRES_BASE + 0)
#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
#define NPRES_USER_BREAK (NPRES_BASE + 2)
/*
* Don't use these obsolete error codes any more.
*/
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
/*
* Version feature information
*/
#define NPVERS_HAS_STREAMOUTPUT 8
#define NPVERS_HAS_NOTIFICATION 9
#define NPVERS_HAS_LIVECONNECT 9
#define NPVERS_68K_HAS_LIVECONNECT 11
#define NPVERS_HAS_WINDOWLESS 11
#define NPVERS_HAS_XPCONNECT_SCRIPTING 13
#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
#define NPVERS_HAS_FORM_VALUES 15
#define NPVERS_HAS_POPUPS_ENABLED_STATE 16
#define NPVERS_HAS_RESPONSE_HEADERS 17
#define NPVERS_HAS_NPOBJECT_ENUM 18
#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
#define NPVERS_HAS_ALL_NETWORK_STREAMS 20
#define NPVERS_HAS_URL_AND_AUTH_INFO 21
#define NPVERS_HAS_PRIVATE_MODE 22
#define NPVERS_MACOSX_HAS_COCOA_EVENTS 23
#define NPVERS_HAS_ADVANCED_KEY_HANDLING 25
#define NPVERS_HAS_URL_REDIRECT_HANDLING 26
#define NPVERS_HAS_CLEAR_SITE_DATA 27
/*----------------------------------------------------------------------*/
/* Function Prototypes */
/*----------------------------------------------------------------------*/
#if defined(__OS2__)
#define NP_LOADDS _System
#else
#define NP_LOADDS
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* NPP_* functions are provided by the plugin and called by the navigator. */
#if defined(XP_UNIX)
const char* NPP_GetMIMEDescription(void);
#endif
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
uint16_t mode, int16_t argc, char* argn[],
char* argv[], NPSavedData* saved);
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
NPStream* stream, NPBool seekable,
uint16_t* stype);
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
int32_t len, void* buffer);
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
const char* fname);
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData);
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
void NP_LOADDS NPP_LostFocus(NPP instance);
void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
char** NP_LOADDS NPP_GetSitesWithData(void);
/* NPN_* functions are provided by the navigator and called by the plugin. */
void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
int* netscape_major, int* netscape_minor);
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
const char* target, void* notifyData);
NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
const char* target);
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32_t len,
const char* buf, NPBool file,
void* notifyData);
NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
const char* target, uint32_t len,
const char* buf, NPBool file);
NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream);
int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
void* buffer);
NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
void NP_LOADDS NPN_Status(NPP instance, const char* message);
const char* NP_LOADDS NPN_UserAgent(NPP instance);
void* NP_LOADDS NPN_MemAlloc(uint32_t size);
void NP_LOADDS NPN_MemFree(void* ptr);
uint32_t NP_LOADDS NPN_MemFlush(uint32_t size);
void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
void *value);
NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
void *value);
void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
void NP_LOADDS NPN_InvalidateRegion(NPP instance,
NPRegion invalidRegion);
void NP_LOADDS NPN_ForceRedraw(NPP instance);
void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
void (*func) (void *),
void *userData);
NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
const char *url, char **value,
uint32_t *len);
NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
const char *url, const char *value,
uint32_t len);
NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
const char *protocol,
const char *host, int32_t port,
const char *scheme,
const char *realm,
char **username, uint32_t *ulen,
char **password,
uint32_t *plen);
uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* RC_INVOKED */
#if defined(__OS2__)
#pragma pack()
#endif
#endif /* npapi_h_ */
webaccounts-browser-extension-0.5/npapi-plugin/src/npapi-headers/headers/nptypes.h 0000644 0001750 0001750 00000007405 12165544500 030152 0 ustar ken ken 0000000 0000000 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Johnny Stenback (Original author)
*
* 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 nptypes_h_
#define nptypes_h_
/*
* Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and
* true/false macros are available.
*/
#if defined(WIN32) || defined(OS2)
/*
* Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool
* is predefined tho, both in C and C++.
*/
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX)
/*
* AIX and SunOS ship a inttypes.h header that defines [u]int32_t,
* but not bool for C.
*/
#include
#ifndef __cplusplus
typedef int bool;
#define true 1
#define false 0
#endif
#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD)
/*
* BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and
* u_int32_t.
*/
#include
/*
* BSD/OS ships no header that defines uint32_t, nor bool (for C)
*/
#if defined(bsdi)
typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t;
#if !defined(__cplusplus)
typedef int bool;
#define true 1
#define false 0
#endif
#else
/*
* FreeBSD and OpenBSD define uint32_t and bool.
*/
#include
#include
#endif
#elif defined(BEOS)
#include
#else
/*
* For those that ship a standard C99 stdint.h header file, include
* it. Can't do the same for stdbool.h tho, since some systems ship
* with a stdbool.h file that doesn't compile!
*/
#include
#ifndef __cplusplus
#if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
#include
#else
/*
* GCC 2.91 can't deal with a typedef for bool, but a #define
* works.
*/
#define bool int
#define true 1
#define false 0
#endif
#endif
#endif
#endif /* nptypes_h_ */
webaccounts-browser-extension-0.5/npapi-plugin/src/npapi-headers/headers/npfunctions.h 0000644 0001750 0001750 00000037523 12165544500 031022 0 ustar ken ken 0000000 0000000 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* 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 npfunctions_h_
#define npfunctions_h_
#ifdef __OS2__
#pragma pack(1)
#define NP_LOADDS _System
#else
#define NP_LOADDS
#endif
#include "npapi.h"
#include "npruntime.h"
typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
/* Any NPObjects returned to the browser via NPP_GetValue should be retained
by the plugin on the way out. The browser is responsible for releasing. */
typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
depend on it sticking around and don't free it. */
typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
typedef void (*NPN_MemFreeProcPtr)(void* ptr);
typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
typedef void* (*NPN_GetJavaEnvProcPtr)(void);
typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen);
typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
typedef struct _NPPluginFuncs {
uint16_t size;
uint16_t version;
NPP_NewProcPtr newp;
NPP_DestroyProcPtr destroy;
NPP_SetWindowProcPtr setwindow;
NPP_NewStreamProcPtr newstream;
NPP_DestroyStreamProcPtr destroystream;
NPP_StreamAsFileProcPtr asfile;
NPP_WriteReadyProcPtr writeready;
NPP_WriteProcPtr write;
NPP_PrintProcPtr print;
NPP_HandleEventProcPtr event;
NPP_URLNotifyProcPtr urlnotify;
void* javaClass;
NPP_GetValueProcPtr getvalue;
NPP_SetValueProcPtr setvalue;
NPP_GotFocusPtr gotfocus;
NPP_LostFocusPtr lostfocus;
NPP_URLRedirectNotifyPtr urlredirectnotify;
NPP_ClearSiteDataPtr clearsitedata;
NPP_GetSitesWithDataPtr getsiteswithdata;
} NPPluginFuncs;
typedef struct _NPNetscapeFuncs {
uint16_t size;
uint16_t version;
NPN_GetURLProcPtr geturl;
NPN_PostURLProcPtr posturl;
NPN_RequestReadProcPtr requestread;
NPN_NewStreamProcPtr newstream;
NPN_WriteProcPtr write;
NPN_DestroyStreamProcPtr destroystream;
NPN_StatusProcPtr status;
NPN_UserAgentProcPtr uagent;
NPN_MemAllocProcPtr memalloc;
NPN_MemFreeProcPtr memfree;
NPN_MemFlushProcPtr memflush;
NPN_ReloadPluginsProcPtr reloadplugins;
NPN_GetJavaEnvProcPtr getJavaEnv;
NPN_GetJavaPeerProcPtr getJavaPeer;
NPN_GetURLNotifyProcPtr geturlnotify;
NPN_PostURLNotifyProcPtr posturlnotify;
NPN_GetValueProcPtr getvalue;
NPN_SetValueProcPtr setvalue;
NPN_InvalidateRectProcPtr invalidaterect;
NPN_InvalidateRegionProcPtr invalidateregion;
NPN_ForceRedrawProcPtr forceredraw;
NPN_GetStringIdentifierProcPtr getstringidentifier;
NPN_GetStringIdentifiersProcPtr getstringidentifiers;
NPN_GetIntIdentifierProcPtr getintidentifier;
NPN_IdentifierIsStringProcPtr identifierisstring;
NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
NPN_IntFromIdentifierProcPtr intfromidentifier;
NPN_CreateObjectProcPtr createobject;
NPN_RetainObjectProcPtr retainobject;
NPN_ReleaseObjectProcPtr releaseobject;
NPN_InvokeProcPtr invoke;
NPN_InvokeDefaultProcPtr invokeDefault;
NPN_EvaluateProcPtr evaluate;
NPN_GetPropertyProcPtr getproperty;
NPN_SetPropertyProcPtr setproperty;
NPN_RemovePropertyProcPtr removeproperty;
NPN_HasPropertyProcPtr hasproperty;
NPN_HasMethodProcPtr hasmethod;
NPN_ReleaseVariantValueProcPtr releasevariantvalue;
NPN_SetExceptionProcPtr setexception;
NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
NPN_EnumerateProcPtr enumerate;
NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
NPN_ConstructProcPtr construct;
NPN_GetValueForURLPtr getvalueforurl;
NPN_SetValueForURLPtr setvalueforurl;
NPN_GetAuthenticationInfoPtr getauthenticationinfo;
NPN_ScheduleTimerPtr scheduletimer;
NPN_UnscheduleTimerPtr unscheduletimer;
NPN_PopUpContextMenuPtr popupcontextmenu;
NPN_ConvertPointPtr convertpoint;
NPN_HandleEventPtr handleevent;
NPN_UnfocusInstancePtr unfocusinstance;
NPN_URLRedirectResponsePtr urlredirectresponse;
} NPNetscapeFuncs;
#ifdef XP_MACOSX
/*
* Mac OS X version(s) of NP_GetMIMEDescription(const char *)
* These can be called to retreive MIME information from the plugin dynamically
*
* Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
* to get mime info from the plugin only on OSX and may not be supported
* in furture version -- use NP_GetMIMEDescription instead
*/
enum
{
kBPSupportedMIMETypesStructVers_1 = 1
};
typedef struct _BPSupportedMIMETypes
{
SInt32 structVersion; /* struct version */
Handle typeStrings; /* STR# formated handle, allocated by plug-in */
Handle infoStrings; /* STR# formated handle, allocated by plug-in */
} BPSupportedMIMETypes;
OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
#endif
#if defined(_WIN32)
#define OSCALL WINAPI
#else
#if defined(__OS2__)
#define OSCALL _System
#else
#define OSCALL
#endif
#endif
#if defined(XP_UNIX)
/* GCC 3.3 and later support the visibility attribute. */
#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define NP_VISIBILITY_DEFAULT __global
#else
#define NP_VISIBILITY_DEFAULT
#endif
#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
#endif
#if defined(_WIN32) || defined (__OS2__)
#ifdef __cplusplus
extern "C" {
#endif
/* plugin meta member functions */
#if defined(__OS2__)
typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
char *pMimeTypes;
char *pFileExtents;
char *pFileOpenTemplate;
char *pProductName;
char *pProductDescription;
unsigned long dwProductVersionMS;
unsigned long dwProductVersionLS;
} NPPluginData;
typedef NPError (*NP_GetPluginDataFunc)(NPPluginData*);
NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
#endif
typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs);
typedef NPError (*NP_ShutdownFunc)(void);
NPError OSCALL NP_Shutdown(void);
typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
const char* NP_GetMIMEDescription(void);
#ifdef __cplusplus
}
#endif
#endif
#if defined(__OS2__)
#pragma pack()
#endif
#ifdef XP_UNIX
#ifdef __cplusplus
extern "C" {
#endif
typedef char* (*NP_GetPluginVersionFunc)(void);
NP_EXPORT(char*) NP_GetPluginVersion(void);
typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
NP_EXPORT(const char*) NP_GetMIMEDescription(void);
#ifdef XP_MACOSX
typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
#else
typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
#endif
typedef NPError (*NP_ShutdownFunc)(void);
NP_EXPORT(NPError) NP_Shutdown(void);
typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *);
NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
#ifdef __cplusplus
}
#endif
#endif
#endif /* npfunctions_h_ */
webaccounts-browser-extension-0.5/npapi-plugin/src/object.c 0000644 0001750 0001750 00000012437 12165544500 023557 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "login-handler.h"
#include "object.h"
#include
typedef struct {
NPObject object;
GHashTable *methods;
} WebAccountsObjectWrapper;
typedef NPVariant (*WebAccountsMethod) (NPObject *object,
const NPVariant *args,
uint32_t argc);
static const gchar method_set_login_info[] = "setLoginInfo";
static gchar *variant_to_string(const NPVariant *variant)
{
return g_strndup (NPVARIANT_TO_STRING (*variant).UTF8Characters,
NPVARIANT_TO_STRING (*variant).UTF8Length);
}
static NPObject *
NPClass_Allocate (NPP instance, NPClass *aClass)
{
g_return_val_if_fail (instance != NULL, NULL);
WebAccountsObjectWrapper *wrapper = g_new0 (WebAccountsObjectWrapper, 1);
wrapper->methods = g_hash_table_new (g_str_hash, g_str_equal);
return (NPObject *)wrapper;
}
static void
NPClass_Deallocate (NPObject *npobj)
{
WebAccountsObjectWrapper *wrapper = (WebAccountsObjectWrapper *) npobj;
g_return_if_fail (wrapper != NULL);
g_hash_table_unref (wrapper->methods);
g_free (wrapper);
}
static void
NPClass_Invalidate (NPObject *npobj)
{
}
static bool
NPClass_HasMethod (NPObject *npobj, NPIdentifier name)
{
WebAccountsObjectWrapper *wrapper = (WebAccountsObjectWrapper *) npobj;
gchar *method_name;
gboolean has_method;
g_return_val_if_fail (wrapper != NULL, false);
method_name = NPN_UTF8FromIdentifier (name);
has_method = (g_hash_table_lookup (wrapper->methods, method_name) != NULL);
NPN_MemFree (method_name);
return has_method;
}
static bool
NPClass_Invoke (NPObject *npobj, NPIdentifier name,
const NPVariant *args, uint32_t argc, NPVariant *result)
{
WebAccountsObjectWrapper *wrapper = (WebAccountsObjectWrapper *) npobj;
gchar *method_name;
WebAccountsMethod method;
g_return_val_if_fail (wrapper != NULL, false);
method_name = NPN_UTF8FromIdentifier (name);
method = g_hash_table_lookup (wrapper->methods, method_name);
NPN_MemFree (method_name);
if (G_UNLIKELY (method == NULL))
return false;
*result = method (npobj, args, argc);
return true;
}
static bool
NPClass_InvokeDefault (NPObject *npobj, const NPVariant *args, uint32_t argc,
NPVariant *result)
{
return false;
}
static bool
NPClass_HasProperty (NPObject *npobj, NPIdentifier name)
{
return false;
}
static bool
NPClass_GetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result)
{
return false;
}
static bool
NPClass_SetProperty (NPObject *npobj, NPIdentifier name, const NPVariant *value)
{
return false;
}
static bool
NPClass_RemoveProperty (NPObject *npobj, NPIdentifier name)
{
return false;
}
static bool
NPClass_Enumerate (NPObject *npobj, NPIdentifier **identifier, uint32_t *count)
{
return false;
}
static bool
NPClass_Construct (NPObject *npobj, const NPVariant *args, uint32_t argc,
NPVariant *result)
{
return false;
}
static NPClass js_object_class = {
.structVersion = NP_CLASS_STRUCT_VERSION,
.allocate = NPClass_Allocate,
.deallocate = NPClass_Deallocate,
.invalidate = NPClass_Invalidate,
.hasMethod = NPClass_HasMethod,
.invoke = NPClass_Invoke,
.invokeDefault = NPClass_InvokeDefault,
.hasProperty = NPClass_HasProperty,
.getProperty = NPClass_GetProperty,
.setProperty = NPClass_SetProperty,
.removeProperty = NPClass_RemoveProperty,
.enumerate = NPClass_Enumerate,
.construct = NPClass_Construct
};
static NPVariant
webaccounts_set_login_info_wrapper (NPObject *object,
const NPVariant *args,
uint32_t argc)
{
NPVariant result;
gchar *login_info;
NULL_TO_NPVARIANT (result);
g_debug ("%s called", G_STRFUNC);
if (G_UNLIKELY (argc < 1 || !NPVARIANT_IS_STRING(args[0])))
return result;
login_info = variant_to_string (args);
if (G_UNLIKELY (login_info == NULL))
return result;
webaccounts_login_handler_set_json (login_info);
g_free (login_info);
return result;
}
NPObject *
webaccounts_create_plugin_object (NPP instance)
{
NPObject *object = NPN_CreateObject (instance, &js_object_class);
g_return_val_if_fail (object != NULL, NULL);
WebAccountsObjectWrapper *wrapper =
(WebAccountsObjectWrapper *) object;
g_hash_table_insert (wrapper->methods,
(gchar *)method_set_login_info,
webaccounts_set_login_info_wrapper);
return object;
}
webaccounts-browser-extension-0.5/npapi-plugin/src/plugin.c 0000644 0001750 0001750 00000031061 12165544500 023601 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "plugin.h"
#include "object.h"
#include
#define PLUGIN_NAME "Web Accounts integration plugin"
#define PLUGIN_DESCRIPTION "Web Accounts integration plugin"
#define PLUGIN_VERSION "0.1"
typedef struct {
NPPluginFuncs *plugin_funcs;
NPP instance;
} WebAccountsBrowserPlugin;
static NPNetscapeFuncs *browser_funcs = NULL;
NP_EXPORT(NPError)
NP_Initialize(NPNetscapeFuncs *bFuncs, NPPluginFuncs *pFuncs)
{
g_debug ("%s called", G_STRFUNC);
browser_funcs = bFuncs;
// Check the size of the provided structure based on the offset of the
// last member we need.
if (pFuncs->size < (offsetof(NPPluginFuncs, setvalue) + sizeof(void*)))
return NPERR_INVALID_FUNCTABLE_ERROR;
pFuncs->newp = NPP_New;
pFuncs->destroy = NPP_Destroy;
pFuncs->setwindow = NPP_SetWindow;
pFuncs->newstream = NPP_NewStream;
pFuncs->destroystream = NPP_DestroyStream;
pFuncs->asfile = NPP_StreamAsFile;
pFuncs->writeready = NPP_WriteReady;
pFuncs->write = NPP_Write;
pFuncs->print = NPP_Print;
pFuncs->event = NPP_HandleEvent;
pFuncs->urlnotify = NPP_URLNotify;
pFuncs->getvalue = NPP_GetValue;
pFuncs->setvalue = NPP_SetValue;
return NPERR_NO_ERROR;
}
NP_EXPORT(char*)
NP_GetPluginVersion()
{
return PLUGIN_VERSION;
}
NP_EXPORT(const char*)
NP_GetMIMEDescription()
{
return "application/x-webaccounts-npapi:none:" PLUGIN_NAME;
}
NP_EXPORT(NPError)
NP_GetValue(void *future, NPPVariable aVariable, void *aValue)
{
switch (aVariable) {
case NPPVpluginNameString:
*((char**)aValue) = PLUGIN_NAME;
break;
case NPPVpluginDescriptionString:
*((char**)aValue) = PLUGIN_DESCRIPTION;
break;
default:
return NPERR_INVALID_PARAM;
break;
}
return NPERR_NO_ERROR;
}
NP_EXPORT(NPError)
NP_Shutdown()
{
return NPERR_NO_ERROR;
}
NPError
NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
int16_t argc, char *argn[], char *argv[], NPSavedData *saved)
{
if (G_UNLIKELY (instance == NULL))
return NPERR_INVALID_INSTANCE_ERROR;
WebAccountsBrowserPlugin *plugin = g_new0 (WebAccountsBrowserPlugin, 1);
plugin->instance = instance;
instance->pdata = plugin;
return NPERR_NO_ERROR;
}
NPError
NPP_Destroy(NPP instance, NPSavedData **save)
{
if (G_UNLIKELY (instance == NULL || instance->pdata == NULL))
return NPERR_NO_ERROR;
WebAccountsBrowserPlugin *plugin = instance->pdata;
g_free (plugin);
return NPERR_NO_ERROR;
}
NPError
NPP_SetWindow(NPP instance, NPWindow *window)
{
return NPERR_NO_ERROR;
}
NPError
NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable,
uint16_t *stype)
{
return NPERR_NO_ERROR;
}
NPError
NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
{
return NPERR_GENERIC_ERROR;
}
int32_t
NPP_WriteReady(NPP instance, NPStream *stream)
{
return 0;
}
int32_t
NPP_Write(NPP instance, NPStream *stream, int32_t offset, int32_t len,
void *buffer)
{
return 0;
}
void
NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname)
{
}
void
NPP_Print(NPP instance, NPPrint *platformPrint)
{
}
int16_t
NPP_HandleEvent(NPP instance, void *event)
{
return 0;
}
void
NPP_URLNotify(NPP instance, const char *URL, NPReason reason, void *notifyData) {
}
NPError
NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
NPBool support;
if (G_UNLIKELY (instance == NULL || instance->pdata == NULL))
return NPERR_INVALID_INSTANCE_ERROR;
switch (variable) {
case NPPVpluginScriptableNPObject:
*(NPObject **)value = webaccounts_create_plugin_object (instance);
break;
case NPPVpluginNeedsXEmbed:
support = false;
NPN_GetValue (instance, NPNVSupportsXEmbedBool, &support);
*((NPBool *) value) = support;
break;
default:
return NPERR_GENERIC_ERROR;
}
return NPERR_NO_ERROR;
}
NPError
NPP_SetValue(NPP instance, NPNVariable variable, void *value)
{
return NPERR_GENERIC_ERROR;
}
NPError
NPN_GetURLNotify (NPP instance, const char *url, const char *target,
void *notifyData)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->geturlnotify (instance, url, target, notifyData);
}
NPError
NPN_GetURL (NPP instance, const char *url, const char *target)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->geturl (instance, url, target);
}
NPError
NPN_PostURLNotify (NPP instance, const char *url, const char *window,
uint32_t len, const char *buf, NPBool file, void *notifyData)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->posturlnotify (instance, url, window, len, buf, file, notifyData);
}
NPError
NPN_PostURL(NPP instance, const char *url, const char *window,
uint32_t len, const char *buf, NPBool file)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->posturl (instance, url, window, len, buf, file);
}
NPError
NPN_RequestRead(NPStream *stream, NPByteRange *rangeList)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->requestread (stream, rangeList);
}
NPError
NPN_NewStream(NPP instance, NPMIMEType type, const char *target,
NPStream **stream)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->newstream (instance, type, target, stream);
}
int32_t NPN_Write(NPP instance, NPStream *stream, int32_t len, void *buffer)
{
g_return_val_if_fail (browser_funcs != NULL, 0);
return browser_funcs->write (instance, stream, len, buffer);
}
NPError
NPN_DestroyStream(NPP instance, NPStream *stream, NPError reason)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->destroystream (instance, stream, reason);
}
void
NPN_Status(NPP instance, const char *message)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->status (instance, message);
}
const char *NPN_UserAgent(NPP instance)
{
g_return_val_if_fail (browser_funcs != NULL, NULL);
return browser_funcs->uagent(instance);
}
void *NPN_MemAlloc(uint32_t size)
{
g_return_val_if_fail (browser_funcs != NULL, NULL);
return browser_funcs->memalloc(size);
}
void
NPN_MemFree(void *ptr)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->memfree(ptr);
}
uint32_t NPN_MemFlush (uint32_t size)
{
g_return_val_if_fail (browser_funcs != NULL, 0);
return browser_funcs->memflush(size);
}
void
NPN_ReloadPlugins (NPBool reloadPages)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->reloadplugins(reloadPages);
}
NPError
NPN_GetValue(NPP instance, NPNVariable variable, void *value)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->getvalue(instance, variable, value);
}
NPError
NPN_SetValue(NPP instance, NPPVariable variable, void *value)
{
g_return_val_if_fail (browser_funcs != NULL, NPERR_INVALID_PLUGIN_ERROR);
return browser_funcs->setvalue(instance, variable, value);
}
void
NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->invalidaterect(instance, invalidRect);
}
void
NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->invalidateregion(instance, invalidRegion);
}
void
NPN_ForceRedraw(NPP instance)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->forceredraw(instance);
}
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
{
g_return_val_if_fail (browser_funcs != NULL, 0);
return browser_funcs->getstringidentifier(name);
}
void
NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers)
{
g_return_if_fail (browser_funcs != NULL);
return browser_funcs->getstringidentifiers(names, nameCount, identifiers);
}
NPIdentifier NPN_GetIntIdentifier(int32_t id)
{
g_return_val_if_fail (browser_funcs != NULL, 0);
return browser_funcs->getintidentifier(id);
}
bool
NPN_IdentifierIsString(NPIdentifier identifier)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->identifierisstring(identifier);
}
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
{
g_return_val_if_fail (browser_funcs != NULL, NULL);
return browser_funcs->utf8fromidentifier(identifier);
}
int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
{
g_return_val_if_fail (browser_funcs != NULL, 0);
return browser_funcs->intfromidentifier(identifier);
}
NPObject *
NPN_CreateObject(NPP instance, NPClass *klass)
{
g_return_val_if_fail (browser_funcs != NULL, NULL);
return browser_funcs->createobject (instance, klass);
}
NPObject *NPN_RetainObject(NPObject *obj)
{
g_return_val_if_fail (browser_funcs != NULL, NULL);
return browser_funcs->retainobject(obj);
}
void
NPN_ReleaseObject(NPObject *obj)
{
g_return_if_fail (browser_funcs != NULL);
return browser_funcs->releaseobject(obj);
}
bool
NPN_Invoke (NPP npp, NPObject *obj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->invoke(npp, obj, methodName, args, argCount, result);
}
bool
NPN_InvokeDefault (NPP npp, NPObject *obj, const NPVariant *args,
uint32_t argCount, NPVariant *result)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->invokeDefault(npp, obj, args, argCount, result);
}
bool
NPN_Evaluate(NPP npp, NPObject *obj, NPString *script,
NPVariant *result)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->evaluate(npp, obj, script, result);
}
bool
NPN_GetProperty(NPP npp, NPObject *obj, NPIdentifier propertyName,
NPVariant *result)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->getproperty(npp, obj, propertyName, result);
}
bool
NPN_SetProperty (NPP npp, NPObject *obj, NPIdentifier propertyName,
const NPVariant *value)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->setproperty(npp, obj, propertyName, value);
}
bool
NPN_RemoveProperty (NPP npp, NPObject *obj, NPIdentifier propertyName)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->removeproperty(npp, obj, propertyName);
}
bool
NPN_Enumerate (NPP npp, NPObject *obj, NPIdentifier **identifier,
uint32_t *count)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->enumerate(npp, obj, identifier, count);
}
bool
NPN_Construct (NPP npp, NPObject *obj, const NPVariant *args,
uint32_t argCount, NPVariant *result)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->construct(npp, obj, args, argCount, result);
}
bool
NPN_HasProperty (NPP npp, NPObject *obj, NPIdentifier propertyName)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->hasproperty(npp, obj, propertyName);
}
bool
NPN_HasMethod (NPP npp, NPObject *obj, NPIdentifier methodName)
{
g_return_val_if_fail (browser_funcs != NULL, false);
return browser_funcs->hasmethod(npp, obj, methodName);
}
void
NPN_ReleaseVariantValue (NPVariant *variant)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->releasevariantvalue(variant);
}
void
NPN_SetException (NPObject *obj, const NPUTF8 *message)
{
g_return_if_fail (browser_funcs != NULL);
browser_funcs->setexception(obj, message);
}
webaccounts-browser-extension-0.5/npapi-plugin/src/object.h 0000644 0001750 0001750 00000001720 12165544500 023555 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef WEBACCOUNTS_OBJECT_H
#define WEBACCOUNTS_OBJECT_H
#include "npapi-headers/headers/npapi.h"
#include "npapi-headers/headers/npruntime.h"
NPObject *webaccounts_create_plugin_object (NPP instance);
#endif
webaccounts-browser-extension-0.5/npapi-plugin/src/Makefile.am 0000644 0001750 0001750 00000001606 12165544500 024175 0 ustar ken ken 0000000 0000000 noinst_LTLIBRARIES = libwebaccounts_npapi_plugin.la
libwebaccounts_npapi_plugin_la_CPPFLAGS = \
$(WEBACCOUNTS_NPAPI_PLUGIN_CFLAGS) \
$(NPAPI_DEBUG_CFLAGS) \
-I$(top_srcdir)/lib/webaccounts \
-DG_LOG_DOMAIN=\"webaccounts-npapi\" \
-DXP_UNIX=1
libwebaccounts_npapi_plugin_la_SOURCES = \
npapi-headers/headers/npapi.h \
npapi-headers/headers/npfunctions.h \
npapi-headers/headers/npruntime.h \
npapi-headers/headers/nptypes.h \
object.c \
object.h \
plugin.c \
plugin.h
libwebaccounts_npapi_plugin_la_LDFLAGS = \
-avoid-version \
-module \
-shared \
-export-dynamic \
-rpath /nowhere
libwebaccounts_npapi_plugin_la_LIBADD = \
$(top_builddir)/lib/webaccounts/libwebaccounts.la \
$(WEBACCOUNTS_NPAPI_PLUGIN_LIBS)
noinst_HEADERS = \
npapi-headers/headers/npapi.h \
npapi-headers/headers/npfunctions.h \
npapi-headers/headers/npruntime.h \
npapi-headers/headers/nptypes.h
webaccounts-browser-extension-0.5/npapi-plugin/src/plugin.h 0000644 0001750 0001750 00000003754 12165544500 023616 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef WEBACCOUNTS_PLUGIN_H
#define WEBACCOUNTS_PLUGIN_H
#include "npapi-headers/headers/npapi.h"
#include "npapi-headers/headers/npfunctions.h"
NPError NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
NPError NP_Shutdown();
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
NPError NPP_Destroy(NPP instance, NPSavedData** save);
NPError NPP_SetWindow(NPP instance, NPWindow* window);
NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
int32_t NPP_WriteReady(NPP instance, NPStream* stream);
int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
void NPP_Print(NPP instance, NPPrint* platformPrint);
int16_t NPP_HandleEvent(NPP instance, void* event);
void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData);
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
#endif // WEBACCOUNTS_PLUGIN_H
webaccounts-browser-extension-0.5/chromium-extension/ 0000755 0001750 0001750 00000000000 12165544707 022612 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/chromium-extension/build.sh 0000755 0001750 0001750 00000001002 12165544500 024230 0 ustar ken ken 0000000 0000000 #!/bin/bash -e
CRX_FILENAME=`pwd`/../chromium-extension.crx
PEM_FILENAME=`pwd`/../chromium-extension.pem
if [ -e "$CRX_FILENAME" ]
then
rm -f "$CRX_FILENAME"
fi
#if [ -e "$PEM_FILENAME" ]
#then
# rm -f "$PEM_FILENAME"
#fi
if test -n "`which google-chrome`"; then
google-chrome --no-message-box --pack-extension=`pwd` --pack-extension-key=../chromium-extension.pem
else
chromium-browser --no-message-box --pack-extension=`pwd`
fi
# not necessary
# mv `pwd`/../unity-chromium-extension.crx .
webaccounts-browser-extension-0.5/chromium-extension/background-page.js 0000644 0001750 0001750 00000006345 12165544500 026200 0 ustar ken ken 0000000 0000000 /* Chromium Unity integration extension
*
* Copyright 2012 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
**/
(function () {
// TODO extract based on logging settings
var log = {
info: function(msg) {
if (msg) {
console.log('Info: ' + msg);
}
},
error: function(msg) {
if (msg) {
console.log('Error: ' + msg);
}
}
};
log.info("Ubuntu web accounts extension loaded");
var plugin = document.getElementById('webaccountsChromiumExtensionId');
if (!plugin) {
log.error("Unable to access NPAPI plugin");
return;
}
function collect_cookies(msg) {
var cookie_domain = msg.domain;
if (cookie_domain[0] != ".") {
cookie_domain = "." + cookie_domain;
}
var details = {
domain: msg.domain
}
chrome.cookies.getAll(details, function(cookies) {
var len = cookies.length;
var cookie_strings = [];
for (var i = 0; i < len; i++) {
cookie_strings.push(cookies[i].name + "=" + cookies[i].value);
}
cookie_dict = {}
cookie_dict[cookie_domain] = cookie_strings.join(";");
plugin.setLoginInfo(JSON.stringify({
login: msg.login,
domain: msg.domain,
cookies: cookie_dict
}));
});
}
function registerListener(webappsId) {
chrome.extension.onRequestExternal.addListener(
function(msg, sender, sendResponse) {
log.info("Got webapps message");
if (msg.type == "login") {
log.info("Login event; username = " + msg.login +
", domain: " + msg.domain);
cookies = collect_cookies(msg);
}
});
chrome.extension.sendRequest(webappsId,
{action: "registerLoginListener"});
}
function isUnityWebApps(extension) {
if (extension.name.indexOf("Unity WebApps") >= 0) {
return true;
} else {
return false;
}
}
chrome.management.onEnabled.addListener(function(info) {
if (isUnityWebApps(info)) {
log.info("WebApps extension enabled with id " + info.id);
registerListener(info.id);
}
});
chrome.management.getAll(function(result) {
var webappsId = "";
var len = result.length;
for (var i = 0; i < len; i++) {
log.info("Extension: " + result[i].name);
if (isUnityWebApps(result[i])) {
webappsId = result[i].id;
break;
}
}
if (webappsId) {
log.info("WebApps extension found with id " + webappsId);
registerListener(webappsId);
} else {
log.error("No WebApps extension found!");
}
});
}) ();
webaccounts-browser-extension-0.5/chromium-extension/manifest.json.in 0000644 0001750 0001750 00000000762 12165544500 025714 0 ustar ken ken 0000000 0000000 {
"name": "Ubuntu web accounts Chromium extension",
"version": "@VERSION@",
"description": "Ubuntu web accounts Chromium integration",
"icons": {
"16": "skin/cof-16.png",
"48": "skin/cof-48.png"
},
"background_page": "background-page.html",
"permissions": [
"cookies",
"management",
"http://*/*",
"https://*/*"
],
"plugins": [
{"path": "libwebaccounts_npapi_plugin.so", "public": false }
]
}
webaccounts-browser-extension-0.5/chromium-extension/background-page.html 0000644 0001750 0001750 00000000440 12165544500 026516 0 ustar ken ken 0000000 0000000
Ubuntu Web accounts Extension Background Page
webaccounts-browser-extension-0.5/chromium-extension/skin/ 0000755 0001750 0001750 00000000000 12165544707 023556 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/chromium-extension/skin/cof-48.png 0000644 0001750 0001750 00000005451 12165544500 025260 0 ustar ken ken 0000000 0000000 ‰PNG
IHDR 0 0 Wù‡ sRGB ®Îé bKGD ÿ ÿ ÿ ½§“ pHYs šœ tIMEÜ
ÈÉn tEXtComment Created with GIMPW
„IDAThÞ½šypõÇ?ow%ٖزqâ„°rpSŽP(L
v Üç@¡n—”s Ji À(w)W8š`ZœBIì¤Ðpt „t€`°
HâXrìH¶eI»¯HZ_Rb·;³3žŸ¥÷{Ç÷ÝÆáiW *Uu/Vd–À$… ’úHT¡]”/A×)¬‘PíŠÐ–±Þ-cdüU½BDf¨jˆ˜ª #RUA UÝ""_KkW„ý¿ Ð2¯²Õ:žT¥\RÜêÎ*CUTõQYZÛ
ÿÏh©œ ,‘YšbYeŒVTPT%-Ä÷Ö6…ïWZë+
c pŽŽwùYäU6…·ŒY€Öú@XUDe|'OTu©² ØjÜiZçUú^Jë2¾šF¡Çqb=ˆÛûUQÁ¡!Ø~l‡h¯<a•*Å"Œ/rLÕ7=IÑÁuˆå!Ñþ-á'n¡çÝ×\B¤$PT¹2Ø~$oZR°ù_Í8ý}T]ûeÇ_8È*_Ÿ8'w[BQqøymsø…ÁôŒáV`¹ˆ ˆî 6P;‰ëÅé‰`G»±£Ý8=Ûqb=h2¶=óŠˆÿ¨Ó ™¬bUáñ–úÀ´ÁWZCmb,A5¸#QjÀë0-
÷?œâŸžŒoÏÙXU“Ó"ÚL¼åc¢ï¼JtÕ‹#;¤iŽt¥‘w€)#B¨¥>p&‹iÍK>Œã8EÅî¢øð0ü¥#>gãyûSvÆ•L8µáÁMôóõY3qz£ƒ9+e ¨ÞWÛ¾n„ZæU– ‹wóâñ⛾?vWVEõ¨Ìˆå¥tþ:—,¦ï?«`Þqh¿íüј'Í<À…õ•“†BHµ‘Yù@G“I¬ª&ÞºïôøæÌ´ßq!Ó^nE<ž”/À ˆ’Òvù¹7 ê°éÆSñL©Å,)'öÙZ4Ã((Ê¡1Aa‚¨þ¸ÂÅhë¼@'*åùÀ,ß…]Ÿz£¨€ÈªÙzÏ/);ù2*~¨ìî0ØIÌŠj7ì Çè[ûOìíìs(^Kÿ§ïç(ÛÔ®ÜÖ)YUåßHeZÕYšš(˜õ㌦I&øná\ì®”žx1½kVût
Úß›ò@ÓÂÜÿaó)>ú,¼Sg¡moÛÊ·—ŽÝF#w´y(¸"t•¤w"?Ë¥|§¯‡êEOPRîl{ùaÂ^„x²,..§ÎÊN¿‚ÀE·fW¢ˆ‰ïZøæ?B¼¾Ñ|a€æç(³ÍÖy•¹Y ”Ú/Øó ª~uï‹»'üØMé‹ÞlA²Ïb½ƒÝَα dh™e’á-$ÚÖç "~`©‘î¤jr9®ˆPvâE®Ð'"DßZFè‘À´òOx–‡íÿx–Ž®ÎÜ:@³tþ£uDÙO!°¯‘jÅNãÙ/¦…ÿ°ù.XØ]l½»ñxsš|°2ÄòizžØg@Ä
fˆU9uœœ"G"¬:óý}ˆÇ‹Æch<†§fw)šÅDdÕ‹h2>¦ªtû«K2ð•Ò“.Fý9ƒEf¹j'U|»ïÍÔgֲǫ›¾¥êšI|ßF÷ߟLi+}Qôíec.î¢o-âôþ#N‚dÂåü#<3
I®êÎ_ÊÄÅÏã¶g†@Ù ±ËOÐùÌ)‡K6öéš±MDp¶wÿæ3×¹g—)Haq>$*¬¬Ñê8øvŽµË”!a°øˆiÿý’íXÕØÝa´¿Ã3alB±õž+°ª&ƒÄ‰õ@ÚGÔNæüºå(¨"¾áÓ¹:â+@ãilÚÉñéq“xÛß|‘Ê5ñj'0,_^ÑÈ$š]ÎÆÛÖãôF0ŠJ2!SDèo[ÆúðLœ
fE5bZ®°ºSŽÜeÊ“ÿÆ7ó@×yÛü‰)%6d1TµÝ•m£]tÜw•Bý_~Äæ_ŸÂ„3¦"TÚ|ÁýÆÞ{}x§àÎø‘mØ‘m9ᣱ@¾<—оÕH´¾ÿ!ó°·wÒ÷ñ;x¦ \r›‹‚ÿ°ùÄ_zpLBZŸ©}¬Ùó^bZ£[6U´‚®ÓAXÓ1èyo9±
koNd›+¹¨*ÅGŸ…ˆ1¦(T:ÿ‚!çÝËG<¾Ñ'‚¨®3ÖÉHÙÒ´ÓL…ÎX½kš]ÿ÷NÁ„Ó¢‰x>1Û(í$³fãŸsœ‹fbÓWÄÛ>¹½ÌàGQ‘Õ†ˆ„TuKîK"Ëÿâ®éU©¸è·”¿ •òMØì;‡‰hÒ'Dšžw•£˜/)ªkÚ¡)qúú¿øÐU‰ª*UW?@É1g£éì9œ5²Ï÷>”Iw½‚x¼.ìÛ½Qºþú§|¬©ªºÑÍ ^šþ’ŽZ€øÙ´è4’¡M?T¤™î+„QTŒÎ±ˆåIRzSoo’ ŠfÏ¥ú–稹y¦ô ŽÍæëŽCûc¹Ã²ª òþô¦pWVKY©ùÆt߬ÙÔܽ,£ÁÞµo°å·gãÿÉ|ªo~:z[>&Þ¶µ“x'×âÛgŽ«ÓR;‰ÆûSÙ¼¨”ŽG®'ÒüBÞ9Eg¿`sç'’5R¹ZDîÏÂñ…ÁÄ[žÃœPÅ·—Fü«
ìöÒXåÕ9çG=ï¾FxÉbâmëS 3Þb –•_îYY»"T竈ÊRUý>¯ìï- Ã|·p.÷]Eÿçh¸«¼zTüŠÑ·—±åwçR|ä©ÿÕǯoeêÒðÔìžöE$©ª
CæBéÍÈ£¹|!ûIvlbûëÏb–WQ.2Èb&µ’ :Ÿ¾Ò“.¡âüEÇöLšFͽ¯"¦9Šªª*@£ˆ´8ÜmWù±ªî»ÃõVådJO¾”â#NªªRDV7ÒqOµoö;yh¿ób¢o¼œñáÛ¶g¬Üq6ªªu"òP¶Cå¦*‰ö„¹žÐW#…Ř¥å`˜8ÑnœÈ¶Tßl˜ˆa¸ÇŠé¿Í²ÀHÆWÀQÕ¹ÙÌ;6…·¨² TÆ>yÁ00|…HQ ˆ`GºR}ƒDŠJ0|… ½¾9dj‘Ê3`yï5UUEUï
6…ßÊ9^O jT‡I¯àv¦Æî%K:øÆ/\Öë|úvìîÐ Ú*ðy*ؾq‡WL-u…bð0*:ž›UE<>¼»ï‰UYCÿ†5ØÛ;ÝŽ?°½DžRÕ˃Ía{ç–|usŠ×U“:68¸Jç̪ÜVÕ{‚MáEã°f
LCä]…}?ÆÉìŒó;%@– T¸dÂ8c %FÛ¶ÏmFLª;rIj3"{ úhjß ã¡ñÇ_©ª³€3óež±¨°õ˜ò
5Í[S¿›Ý€ÂQ–±ë¡N
R%ÁFDÞÇqî
6w~²S]ÝXUØRð#Lö‘£€ƒ@g‚T¢ZP]§"«Eu›§7…»Ærÿ”Ó&è ŸY IEND®B`‚ webaccounts-browser-extension-0.5/chromium-extension/skin/cof-16.png 0000644 0001750 0001750 00000001513 12165544500 025246 0 ustar ken ken 0000000 0000000 ‰PNG
IHDR óÿa sBIT|dˆ IDAT8e’_h•uÇ?Ïï}ß³óž÷xΖwbº6;³
ÿ4tc®©
ª‹’(ÌþPf»ºë&¼)dÊ «d’° ±ÙBÔ™M›9jÁÂÍÚ4u2vŽç¯ç}¿nò8×sõÀóý>ÏÃ÷û–U2¬švÖUõlŒ;m©¨µN@¦sÁ剴?öÍÕâÁÙ‚ž\Š—%½ÕÓè~´7Ù²ÄV÷ÏÐ`üÀ‡þ*|þÉŸù÷´¡`Ý%÷oX1´«!¼ÛQbÉ2²x1Võ;ìª–Å©Öæ˜óıë¥Ae §ÑÝ¿«ÁÝ0€×ÖMì¹7ˆly{e’ê—öbÅjÈ-
ž]ïÙ$Oß*+ɰjé¬ù=l‰`¯ZÊ®Wq~¯½”¦Æ)MÿFîÔʼnQ |mt÷èb«ìyÄý¸·ÉÛ§@PuŸŽàÔÖ3·g;図 5ÞÖ.}èl†Ùžmp§À3ù/ÕÆ¸Ó&ƈѷu¡†õÌ÷÷Qþç
¢5äÎçæþ·±“õDŸ|¡¢Íæj§C¥¢Ö:wC'k¿»N¸¹Ÿìé!Dîé("ä/üHá×SØÔbŒ %n§”€H¨
,qBAëåñ Áâ-t!»4¢¦sÁåüù¸²s-ÅKg'„·µ«rÀC¸¥ƒèS/bÊw*ßMf‚5‘öÇŒˆ1…,ù#”¯ÍèÀ^™Äè ø„›Û©ýàÁÂ
²'V_L—ÏÊWÞVs)d‰
à¬N{þ-T4FdËÓ 5þü5JSãdOب1ÏŽ.vXßÌ»¶<ôxÓ* :³@þü T$† þ¿É
Sýr/v¢ŽÛ'cDÌ‘¹ÒààÕÒPBø³M±ï·'BJîÅø®VüA}äÏ'}ì+óóByüÍ_nï(i“®€-!òþ£‘þ×êÝ×m%êƒsd®4øá¹wJÚ¤ÿsâþjô¬M¯¬®zwsµÓÑ·S2™ f.¦ËgÏNeƒŸ–âÿfñ1Î}»® IEND®B`‚ webaccounts-browser-extension-0.5/chromium-extension/content/ 0000755 0001750 0001750 00000000000 12165544707 024264 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/chromium-extension/Makefile.am 0000644 0001750 0001750 00000002101 12165544500 024627 0 ustar ken ken 0000000 0000000 CLEANFILES = res/*
EXTRA_DIST =
extensiondir = $(libdir)/webaccounts-chromium
extension_DATA=res/webaccounts.crx
clean-extension-package:
rm -f $(CLEANFILES)
SCRIPT_FILES = \
$(shell ls *.html) \
$(shell ls *.js) \
$(shell ls skin/*) \
$(shell ls content/*)
noinst_DATA = $(SCRIPT_FILES)
res/webaccounts.crx: $(SCRIPT_FILES) manifest.json webaccounts.json
cp -f $(top_builddir)/npapi-plugin/src/.libs/libwebaccounts_npapi_plugin.so .
if [ ! -f ../webaccounts.pem ]; \
then \
openssl genrsa 1024 > ../webaccounts.pem; \
fi
$(srcdir)/crxmake.sh $(abs_builddir) ../webaccounts.pem
mv res/chromium-extension.crx res/webaccounts.crx
manifestdir = $(datadir)/chromium/extensions/
manifest_DATA = $(shell ls $(top_builddir)/chromium-extension/res/*.json)
%.json: %.json.in
sed -e "s|\@EXTDIR\@|$(extensiondir)/webaccounts.crx|" $< | sed -e "s|\@VERSION\@|$(VERSION)|"> $@
CLEANFILES += \
manifest.json \
webaccounts.json \
libwebaccounts_npapi_plugin.so \
chromium-extension.crx
EXTRA_DIST += \
manifest.json.in \
webaccounts.json.in \
crxmake.sh \
$(SCRIPT_FILES)
webaccounts-browser-extension-0.5/chromium-extension/webaccounts.json.in 0000644 0001750 0001750 00000000104 12165544500 026411 0 ustar ken ken 0000000 0000000 {
"external_crx": "@EXTDIR@",
"external_version": "@VERSION@"
}
webaccounts-browser-extension-0.5/chromium-extension/crxmake.sh 0000755 0001750 0001750 00000002407 12165544500 024575 0 ustar ken ken 0000000 0000000 #!/bin/bash -e
#
# Purpose: Pack a Chromium extension directory into crx format
if test $# -ne 2; then
echo "Usage: crxmake.sh "
exit 1
fi
dir=$1
key=$2
name=$(basename "$dir")
crx="$name.crx"
pub="$name.pub"
sig="$name.sig"
zip="$name.zip"
trap 'rm -f "$pub" "$sig" "$zip"' EXIT
# zip up the crx dir
cwd=$(pwd -P)
(cd "$dir" && zip -qr -9 -X "$cwd/$zip" .)
# signature
openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig"
# public key
openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null
byte_swap () {
# Take "abcdefgh" and return it as "ghefcdab"
echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}"
}
crmagic_hex="4372 3234" # Cr24
version_hex="0200 0000" # 2
pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}')))
sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}')))
(
echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p
cat "$pub" "$sig" "$zip"
) > "$crx"
echo "Wrote $crx"
# Output files to package in subdir "res"
res="$cwd/res"
mkdir -p $res
echo "Result: $res"
cp -f $crx $res/
eid=`cat $key | openssl rsa -pubout -outform DER | openssl dgst -sha256 | awk '{print $2}' | cut -c 1-32 | tr '0-9a-f' 'a-p'`
echo "ID: $eid"
cp -f webaccounts.json $res/$eid.json
webaccounts-browser-extension-0.5/autogen.sh 0000755 0001750 0001750 00000010514 12165544500 020746 0 ustar ken ken 0000000 0000000 #!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
DIE=0
if [ -n "$GNOME2_DIR" ]; then
ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
PATH="$GNOME2_DIR/bin:$PATH"
export PATH
export LD_LIBRARY_PATH
fi
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level package directory"
exit 1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
(intltoolize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`intltool' installed."
echo "You can get it from:"
echo " ftp://ftp.gnome.org/pub/GNOME/"
DIE=1
}
}
(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
(xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`xml-i18n-toolize' installed."
echo "You can get it from:"
echo " ftp://ftp.gnome.org/pub/GNOME/"
DIE=1
}
}
(grep "^LT_INIT" $srcdir/configure.ac >/dev/null) && {
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
}
(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
(grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
(glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`glib' installed."
echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
DIE=1
}
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`automake' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
do
dr=`dirname $coin`
if test -f $dr/NO-AUTO-GEN; then
echo skipping $dr -- flagged as no auto-gen
else
echo processing $dr
( cd $dr
aclocalinclude="$ACLOCAL_FLAGS"
if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
echo "Creating $dr/aclocal.m4 ..."
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
echo "Running glib-gettextize... Ignore non-fatal messages."
echo "no" | glib-gettextize --force --copy
echo "Making $dr/aclocal.m4 writable ..."
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
fi
if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then
echo "Running intltoolize..."
intltoolize --copy --force --automake
fi
if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
echo "Running xml-i18n-toolize..."
xml-i18n-toolize --copy --force --automake
fi
if grep "^LT_INIT" configure.ac >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
libtoolize --force --copy
fi
fi
echo "Running aclocal $aclocalinclude ..."
aclocal $aclocalinclude
if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then
echo "Running autoheader..."
autoheader
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt
echo "Running autoconf ..."
autoconf
)
fi
done
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure "$@" ...
$srcdir/configure "$@" \
&& echo Now type \`make\' to compile. || exit 1
else
echo Skipping configure process.
fi
webaccounts-browser-extension-0.5/ChangeLog 0000644 0001750 0001750 00000000000 12165544500 020504 0 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/Makefile.am 0000644 0001750 0001750 00000000330 12165544500 020774 0 ustar ken ken 0000000 0000000 SUBDIRS = lib npapi-plugin po
if WITH_FIREFOX
SUBDIRS += firefox-extension
endif
if WITH_CHROMIUM
SUBDIRS += chromium-extension
endif
ACLOCAL_AMFLAGS = -I m4
CLEANFILES = webaccounts.pem
EXTRA_DIST = autogen.sh
webaccounts-browser-extension-0.5/po/ 0000755 0001750 0001750 00000000000 12165544707 017373 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/po/POTFILES.in 0000644 0001750 0001750 00000000163 12165544500 021137 0 ustar ken ken 0000000 0000000 # List of source files containing translatable strings.
lib/data/com.canonical.webcredentials.capture.gschema.xml
webaccounts-browser-extension-0.5/po/LINGUAS 0000644 0001750 0001750 00000000061 12165544500 020404 0 ustar ken ken 0000000 0000000 # please keep this list sorted alphabetically
#
webaccounts-browser-extension-0.5/m4/ 0000755 0001750 0001750 00000000000 12165544707 017275 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/m4/gtest.m4 0000644 0001750 0001750 00000004771 12165544500 020665 0 ustar ken ken 0000000 0000000 # Copyright (C) 2012 Canonical, Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Checks whether the gtest source is available on the system. Allows for
# adjusting the include and source path. Sets have_gtest=yes if the source is
# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and
# source location respectively.
AC_DEFUN([CHECK_GTEST],
[
AC_ARG_WITH([gtest-include-path],
[AS_HELP_STRING([--with-gtest-include-path],
[location of the Google test headers])],
[GTEST_CPPFLAGS="-I$withval"])
AC_ARG_WITH([gtest-source-path],
[AS_HELP_STRING([--with-gtest-source-path],
[location of the Google test sources, defaults to /usr/src/gtest])],
[GTEST_SOURCE="$withval"],
[GTEST_SOURCE="/usr/src/gtest"])
GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
AC_LANG_PUSH([C++])
tmp_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS"
AC_CHECK_HEADER([gtest/gtest.h])
CPPFLAGS="$tmp_CPPFLAGS"
AC_LANG_POP
AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
[$GTEST_SOURCE/src/gtest_main.cc],
[have_gtest_source=yes],
[have_gtest_source=no])
AS_IF([test "x$ac_cv_header_gtest_gtest_h" = xyes -a \
"x$have_gtest_source" = xyes],
[have_gtest=yes]
[AC_SUBST(GTEST_CPPFLAGS)]
[AC_SUBST(GTEST_SOURCE)],
[have_gtest=no])
]) # CHECK_GTEST
webaccounts-browser-extension-0.5/NEWS 0000644 0001750 0001750 00000000000 12165544500 017431 0 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/lib/ 0000755 0001750 0001750 00000000000 12165544707 017523 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/lib/data/ 0000755 0001750 0001750 00000000000 12165544707 020434 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/lib/data/com.canonical.webcredentials.capture.gschema.xml 0000644 0001750 0001750 00000001064 12165544500 031714 0 ustar ken ken 0000000 0000000
A list of accounts (in the form domain:account) which we will not propose to create locally.
[]
This key lists all those accounts for which the creation of a local account has been already asked, and won't be asked again.
webaccounts-browser-extension-0.5/lib/data/Makefile.am 0000644 0001750 0001750 00000000260 12165544500 022455 0 ustar ken ken 0000000 0000000 gsettings_SCHEMAS = \
com.canonical.webcredentials.capture.gschema.xml
@GSETTINGS_RULES@
EXTRA_DIST = \
$(gsettings_SCHEMAS)
CLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
webaccounts-browser-extension-0.5/lib/webaccounts/ 0000755 0001750 0001750 00000000000 12165544707 022040 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/lib/webaccounts/login-handler.c 0000644 0001750 0001750 00000024332 12165544500 024722 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "login-handler.h"
#include
#include
#include
#include
#include
#include
#define WEBCREDENTIALS_CAPTURE_SERVICE "com.canonical.webcredentials.capture"
#define WEBCREDENTIALS_CAPTURE_OBJECT_PATH \
"/com/canonical/webcredentials/capture"
#define WEBCREDENTIALS_CAPTURE_INTERFACE WEBCREDENTIALS_CAPTURE_SERVICE
#define WEBCREDENTIALS_DCONF_SCHEMA "com.canonical.webcredentials.capture"
/* Instantiating the manager is expensive; so, let's cache it */
static AgManager *manager = NULL;
static GDBusConnection *dbus_connection = NULL;
static AgProvider *
find_provider_for_domain (const gchar *domain)
{
GList *providers, *list;
AgProvider *result = NULL;
g_return_val_if_fail (AG_IS_MANAGER (manager), NULL);
providers = ag_manager_list_providers (manager);
for (list = providers; list != NULL; list = list->next)
{
AgProvider *provider = list->data;
const gchar *domains_regex;
domains_regex = ag_provider_get_domains_regex (provider);
if (domains_regex == NULL || domains_regex[0] == '\0')
{
continue;
}
if (g_regex_match_simple (domains_regex, domain, 0, 0))
{
/* Found a provider which supports this domain */
result = ag_provider_ref (provider);
break;
}
}
ag_provider_list_free (providers);
return result;
}
static void
blacklist_account (const gchar *domain, const gchar *username)
{
GSettings *settings;
gchar **accounts, **accounts_old;
guint length, i;
settings = g_settings_new (WEBCREDENTIALS_DCONF_SCHEMA);
if (G_UNLIKELY (settings == NULL))
{
g_warning ("Failed to open DConf database");
return;
}
accounts_old = g_settings_get_strv (settings, "dontask-accounts");
length = g_strv_length (accounts_old);
accounts = g_new (gchar *, length + 2);
for (i = 0; i < length; i++)
{
accounts[i] = accounts_old[i];
}
accounts[i++] = g_strdup_printf ("%s:%s", domain, username);
accounts[i] = NULL;
g_settings_set_strv (settings, "dontask-accounts",
(const gchar * const*) accounts);
g_object_unref (settings);
g_strfreev (accounts);
g_free (accounts_old);
}
static gboolean
account_blacklisted (const gchar *domain, const gchar *username)
{
GSettings *settings;
gchar **accounts;
gchar *match;
gint i;
gboolean found = FALSE;
settings = g_settings_new (WEBCREDENTIALS_DCONF_SCHEMA);
if (G_UNLIKELY (settings == NULL))
{
g_warning ("Failed to open DConf database");
return TRUE;
}
accounts = g_settings_get_strv (settings, "dontask-accounts");
match = g_strdup_printf ("%s:%s", domain, username);
for (i = 0; accounts[i] != NULL; i++)
{
if (strcmp (accounts[i], match) == 0)
{
found = TRUE;
break;
}
}
g_object_unref (settings);
g_strfreev (accounts);
g_free (match);
return found;
}
static gboolean
account_exists (AgProvider *provider, const gchar *username)
{
GList *accounts, *list;
gboolean account_exists = FALSE;
const gchar *provider_name;
g_return_val_if_fail (AG_IS_MANAGER (manager), FALSE);
/* An ag_manager_list_by_provider() method would be welcome here.
* http://code.google.com/p/accounts-sso/issues/detail?id=59
*/
provider_name = ag_provider_get_name (provider);
accounts = ag_manager_list (manager);
for (list = accounts; list != NULL; list = list->next)
{
AgAccountId account_id = (AgAccountId)GPOINTER_TO_INT(list->data);
AgAccount *account;
account = ag_manager_get_account (manager, account_id);
if (G_UNLIKELY (account == NULL))
{
continue;
}
if (g_strcmp0 (ag_account_get_provider_name (account),
provider_name) != 0)
{
g_object_unref (account);
continue;
}
/* Here we assume that the account username is used as display name; we
* might need to revisit this later. */
if (g_strcmp0 (ag_account_get_display_name (account), username) == 0)
{
g_object_unref (account);
account_exists = TRUE;
break;
}
g_object_unref (account);
}
ag_manager_list_free (accounts);
return account_exists;
}
/*
* Check whether the given account is relevant for the WebCredentials
* implementationand, if it is, forward the information to the system settings
* applet.
*/
void
webaccounts_store_login (const gchar *domain,
const gchar *username,
const gchar *password,
GVariant *cookies)
{
AgProvider *provider;
g_debug ("%s; domain %s, username %s, password %s", G_STRFUNC,
domain, username, password);
if (manager == NULL)
{
manager = ag_manager_new ();
}
if (domain == NULL || domain[0] == '\0' ||
username == NULL || username[0] == '\0')
{
g_warning ("Insufficient informations (domain = '%s', username = '%s')",
domain, username);
return;
}
provider = find_provider_for_domain (domain);
if (provider == NULL)
{
g_debug ("Provider not found");
/* The domain is not bound to any account provider; nothing to do here */
goto nothing_to_do;
}
if (account_blacklisted (domain, username))
{
g_debug ("Account %s on %s is blacklisted", username, domain);
goto nothing_to_do;
}
/* If an account for the same provider with the same username already
* exists, stop processing here. */
if (account_exists (provider, username))
{
g_debug ("Account for %s exists", username);
goto nothing_to_do;
}
/* Cannot pass NULL strings to D-Bus */
if (password == NULL)
{
password = "";
}
if (dbus_connection == NULL)
{
GError *error = NULL;
dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (error != NULL)
{
g_critical ("Failed to connect to session bus: %s", error->message);
g_error_free (error);
return;
}
}
/* Asynchronous call, with no callback because we don't care about the
* outcome of this call. */
g_dbus_connection_call (dbus_connection,
WEBCREDENTIALS_CAPTURE_SERVICE,
WEBCREDENTIALS_CAPTURE_OBJECT_PATH,
WEBCREDENTIALS_CAPTURE_INTERFACE,
"LoginCaptured",
g_variant_new ("(sss@a{ss})",
ag_provider_get_name (provider),
username,
password,
cookies),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
NULL,
NULL);
/* Don't propose to create this account ever again */
blacklist_account (domain, username);
nothing_to_do:
if (provider != NULL)
{
ag_provider_unref (provider);
provider = NULL;
}
}
void
webaccounts_login_handler_set_json (const gchar *login_info_json)
{
GVariant *login_info;
GVariant *cookies_in;
GVariant *cookies = NULL;
GVariantBuilder builder;
GError *error = NULL;
gchar *username = NULL;
gchar *password = NULL;
gchar *domain = NULL;
g_return_if_fail (login_info_json != NULL);
login_info = json_gvariant_deserialize_data (login_info_json, -1, NULL,
&error);
if (G_UNLIKELY (error != NULL))
{
g_warning ("Couldn't deserialize JSON object: %s", error->message);
g_clear_error (&error);
return;
}
g_return_if_fail (login_info != NULL);
if (!g_variant_lookup (login_info, "domain", "s", &domain))
{
g_warning ("Domain is missing");
goto error;
}
if (!g_variant_lookup (login_info, "login", "s", &username))
{
g_warning ("Username is missing");
goto error;
}
g_variant_lookup (login_info, "password", "s", &password);
g_debug ("Got username %s, domain %s", username, domain);
cookies_in = g_variant_lookup_value (login_info,
"cookies", G_VARIANT_TYPE_DICTIONARY);
g_variant_builder_init (&builder, (GVariantType *) "a{ss}");
if (cookies_in)
{
GVariantIter iter;
GVariant *value;
gchar *key;
g_debug ("Got cookies");
g_variant_iter_init (&iter, cookies_in);
while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
{
g_debug ("domain %s, cookies: %s",
key, g_variant_get_string (value, NULL));
g_variant_builder_add (&builder, "{ss}",
key, g_variant_get_string (value, NULL));
}
g_variant_unref (cookies_in);
}
cookies = g_variant_builder_end (&builder);
webaccounts_store_login (domain, username, password, cookies);
error:
g_free (password);
g_free (username);
g_free (domain);
g_variant_unref (login_info);
}
webaccounts-browser-extension-0.5/lib/webaccounts/Makefile.am 0000644 0001750 0001750 00000000510 12165544500 024057 0 ustar ken ken 0000000 0000000 pkglib_LTLIBRARIES = libwebaccounts.la
libwebaccounts_la_CPPFLAGS = \
$(WEBACCOUNTS_CFLAGS) \
-DG_LOG_DOMAIN=\"webaccounts\"
libwebaccounts_la_SOURCES = \
login-handler.c \
login-handler.h
libwebaccounts_la_LDFLAGS = \
-release $(VERSION) \
-shared \
-export-dynamic
libwebaccounts_la_LIBADD = \
$(WEBACCOUNTS_LIBS)
webaccounts-browser-extension-0.5/lib/webaccounts/login-handler.h 0000644 0001750 0001750 00000001703 12165544500 024724 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef WEBACCOUNTS_LOGIN_HANDLER_H
#define WEBACCOUNTS_LOGIN_HANDLER_H
#include
G_BEGIN_DECLS
void webaccounts_login_handler_set_json (const gchar *login_info_json);
G_END_DECLS
#endif
webaccounts-browser-extension-0.5/lib/Makefile.am 0000644 0001750 0001750 00000000042 12165544500 021542 0 ustar ken ken 0000000 0000000 SUBDIRS = webaccounts data tests
webaccounts-browser-extension-0.5/lib/tests/ 0000755 0001750 0001750 00000000000 12165544707 020665 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/lib/tests/main.cpp 0000644 0001750 0001750 00000010413 12165544500 022303 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "fake-capture-service.h"
#include "login-handler.h"
#include
#include
#include
#include
TEST (webaccounts, wrong_domain) {
FakeCaptureService service;
static const gchar json_string[] = "{"
" 'login': 'my user name', "
" 'domain': 'invalid.com' "
"}";
fake_capture_service_init (&service);
/* This should fail because there isn't a provider handling the domain
* "invalid.com" */
webaccounts_login_handler_set_json (json_string);
EXPECT_FALSE (service.called);
fake_capture_service_unset (&service);
}
TEST (webaccounts, existing_account) {
AgManager *manager;
AgAccount *account;
FakeCaptureService service;
static const gchar json_string[] = "{"
" 'login': 'user@test.com', "
" 'domain': 'example.com' "
"}";
/* first, create an account for user@test.com */
manager = ag_manager_new ();
ASSERT_TRUE (manager != NULL);
account = ag_manager_create_account (manager, "MyProvider");
ASSERT_TRUE (account != NULL);
ag_account_set_display_name (account, "user@test.com");
ag_account_store_blocking (account, NULL);
g_object_unref (account);
g_object_unref (manager);
fake_capture_service_init (&service);
/* This should fail because an account for that username already exists */
webaccounts_login_handler_set_json (json_string);
EXPECT_FALSE (service.called);
fake_capture_service_unset (&service);
}
TEST (webaccounts, username) {
FakeCaptureService service;
static const gchar json_string[] = "{"
" 'login': 'my user name', "
" 'domain': 'example.com' "
"}";
fake_capture_service_init (&service);
webaccounts_login_handler_set_json (json_string);
EXPECT_TRUE (service.called);
EXPECT_STREQ ("my user name", service.username);
EXPECT_STREQ ("MyProvider", service.provider_name);
fake_capture_service_unset (&service);
}
TEST (webaccounts, blacklist) {
FakeCaptureService service;
static const gchar json_string[] = "{"
" 'login': 'my user name', "
" 'domain': 'example.com' "
"}";
fake_capture_service_init (&service);
webaccounts_login_handler_set_json (json_string);
EXPECT_FALSE (service.called);
fake_capture_service_unset (&service);
}
TEST (webaccounts, cookies) {
FakeCaptureService service;
gboolean ok;
gchar *cookie;
static const gchar json_string[] = "{"
" 'login': 'Happy User', "
" 'domain': 'example.com', "
" 'cookies': { "
" 'example.com': 'a list of cookies', "
" 'test.com': 'more cookies' "
" } "
"}";
fake_capture_service_init (&service);
webaccounts_login_handler_set_json (json_string);
EXPECT_TRUE (service.called);
EXPECT_STREQ ("Happy User", service.username);
EXPECT_STREQ ("MyProvider", service.provider_name);
ASSERT_TRUE (service.cookies != NULL);
/* check the cookie contents */
ok = g_variant_lookup (service.cookies, "example.com", "s", &cookie);
EXPECT_TRUE (ok);
EXPECT_STREQ ("a list of cookies", cookie);
g_free (cookie);
ok = g_variant_lookup (service.cookies, "test.com", "s", &cookie);
EXPECT_TRUE (ok);
EXPECT_STREQ ("more cookies", cookie);
g_free (cookie);
fake_capture_service_unset (&service);
}
int main (int argc, char **argv)
{
::testing::InitGoogleTest (&argc, argv);
g_type_init ();
return RUN_ALL_TESTS ();
}
webaccounts-browser-extension-0.5/lib/tests/fake-capture-service.c 0000644 0001750 0001750 00000004554 12165544500 025035 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "fake-capture-service.h"
#include
#include
static FakeCaptureService *capture_service = NULL;
void fake_capture_service_init (FakeCaptureService *self)
{
memset (self, 0, sizeof (FakeCaptureService));
capture_service = self;
}
void fake_capture_service_unset (FakeCaptureService *self)
{
g_free (self->provider_name);
g_free (self->username);
g_free (self->password);
if (self->cookies != NULL)
g_variant_unref (self->cookies);
memset (self, 0, sizeof (FakeCaptureService));
}
void fake_capture_service_reset (FakeCaptureService *self)
{
fake_capture_service_unset (self);
fake_capture_service_init (self);
}
void
g_dbus_connection_call (GDBusConnection *connection,
const gchar *bus_name,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
const GVariantType *reply_type,
GDBusCallFlags flags,
gint timeout_msec,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_return_if_fail (capture_service != NULL);
capture_service->called = TRUE;
g_return_if_fail (parameters != NULL);
g_variant_get (parameters, "(sss@a{ss})",
&capture_service->provider_name,
&capture_service->username,
&capture_service->password,
&capture_service->cookies);
}
webaccounts-browser-extension-0.5/lib/tests/fake-capture-service.h 0000644 0001750 0001750 00000002255 12165544500 025036 0 ustar ken ken 0000000 0000000 /*
* This file is part of the webaccounts-browser-plugin.
* Copyright (C) Canonical Ltd. 2012
*
* Author: Alberto Mardegan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef FAKE_CAPTURE_SERVICE_H
#define FAKE_CAPTURE_SERVICE_H
#include
G_BEGIN_DECLS
typedef struct {
gboolean called;
gchar *provider_name;
gchar *username;
gchar *password;
GVariant *cookies;
} FakeCaptureService;
void fake_capture_service_init (FakeCaptureService *self);
void fake_capture_service_unset (FakeCaptureService *self);
void fake_capture_service_reset (FakeCaptureService *self);
G_END_DECLS
#endif
webaccounts-browser-extension-0.5/lib/tests/data/ 0000755 0001750 0001750 00000000000 12165544707 021576 5 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/lib/tests/data/MyProvider.provider 0000644 0001750 0001750 00000000260 12165544500 025437 0 ustar ken ken 0000000 0000000
My Provider
general_myprovider
.*example\.com
webaccounts-browser-extension-0.5/lib/tests/Makefile.am 0000644 0001750 0001750 00000002627 12165544500 022717 0 ustar ken ken 0000000 0000000 EXTRA_DIST =
check_LIBRARIES = libgoogle-test.a
nodist_libgoogle_test_a_SOURCES = \
$(GTEST_SOURCE)/src/gtest-all.cc
libgoogle_test_a_CPPFLAGS = \
$(GTEST_CPPFLAGS)
check_PROGRAMS = webaccounts-test
webaccounts_test_CPPFLAGS = \
-I$(top_srcdir)/lib/webaccounts \
$(WEBACCOUNTS_CFLAGS)
webaccounts_test_SOURCES = \
fake-capture-service.c \
fake-capture-service.h \
main.cpp
webaccounts_test_LDADD = \
$(WEBACCOUNTS_LIBS) \
$(top_builddir)/lib/webaccounts/libwebaccounts.la \
libgoogle-test.a
webaccounts_test_LDFLAGS = \
$(WEBACCOUNTS_LDFLAGS) \
-pthread
TESTS_ENVIRONMENT = \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \
ACCOUNTS=/tmp \
AG_APPLICATIONS=$(top_srcdir)/lib/tests/data \
AG_SERVICES=$(top_srcdir)/lib/tests/data \
AG_SERVICE_TYPES=$(top_srcdir)/lib/tests/data \
AG_PROVIDERS=$(top_srcdir)/lib/tests/data \
AG_DEBUG=all \
GSETTINGS_SCHEMA_DIR=$(top_builddir)/lib/data \
GSETTINGS_BACKEND=memory \
G_DEBUG=gc-friendly \
G_MESSAGES_DEBUG=all \
G_SLICE=always-malloc,debug-blocks
TESTS = \
webaccounts-test
$(top_builddir)/lib/data/gschemas.compiled: $(top_srcdir)/lib/data/com.canonical.webcredentials.capture.gschema.xml
$(GLIB_COMPILE_SCHEMAS) --targetdir="$(top_builddir)/lib/data" "${top_srcdir}/lib/data"
all-local: $(top_builddir)/lib/data/gschemas.compiled
EXTRA_DIST += \
data/MyProvider.provider
CLEANFILES = $(top_builddir)/lib/data/gschemas.compiled
webaccounts-browser-extension-0.5/README 0000644 0001750 0001750 00000000000 12165544500 017612 0 ustar ken ken 0000000 0000000 webaccounts-browser-extension-0.5/configure.ac 0000644 0001750 0001750 00000005630 12165544500 021236 0 ustar ken ken 0000000 0000000 dnl Process this file with autoconf to produce a configure script.
dnl Created by Anjuta application wizard.
AC_INIT(webaccounts-browser-extension, 0.5)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11 tar-ustar])
AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CC_C99
AC_PROG_MKDIR_P
AC_PROG_SED
# For google test
AC_PROG_CXX
m4_include([m4/gtest.m4])
CHECK_GTEST
AC_DISABLE_STATIC
LT_INIT
dnl ***************************************************************************
dnl Internationalization
dnl ***************************************************************************
IT_PROG_INTLTOOL([0.50.0])
GETTEXT_PACKAGE=webcredentials_browser_extension
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
PKG_CHECK_MODULES(WEBACCOUNTS,
gio-2.0
glib-2.0
json-glib-1.0
libaccounts-glib
)
PKG_CHECK_MODULES(WEBACCOUNTS_NPAPI_PLUGIN,
glib-2.0
)
GLIB_GSETTINGS
dnl ***************************************************************************
dnl debug
dnl ***************************************************************************
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debugging. [default=no]]),
[enable_debug="yes"],[enable_debug="no"])
if test "x$enable_debug" = "xyes"; then
NPAPI_DEBUG_CFLAGS="-DNPAPI_DEBUG_ENABLED"
else
NPAPI_DEBUG_CFLAGS=""
fi
AC_SUBST(NPAPI_DEBUG_CFLAGS)
dnl ***************************************************************************
dnl Chromium extension
dnl ***************************************************************************
AC_ARG_ENABLE(chromium,
AC_HELP_STRING([--enable-chromium],
[Build chromium extension. [default=yes]]),
[enable_chromium="no"], [enable_chromium="yes"])
if test "x$enable_chromium" = "xyes"; then
AC_DEFINE([WITH_CHROMIUM], 1, [Build chromium extension.])
fi
AM_CONDITIONAL([WITH_CHROMIUM], [test "x$enable_chromium" = "xyes"])
dnl ***************************************************************************
dnl Firefox extension
dnl ***************************************************************************
AC_ARG_ENABLE(firefox,
AC_HELP_STRING([--enable-firefox],
[Build firefox extension. [default=yes]]),
[enable_firefox="no"], [enable_firefox="yes"])
if test "x$enable_firefox" = "xyes"; then
AC_DEFINE([WITH_FIREFOX], 1, [Build firefox extension.])
fi
AM_CONDITIONAL([WITH_FIREFOX], [test "x$enable_firefox" = "xyes"])
AC_CONFIG_FILES([
Makefile
chromium-extension/Makefile
firefox-extension/Makefile
firefox-extension/install.rdf
lib/Makefile
lib/data/Makefile
lib/webaccounts/Makefile
lib/tests/Makefile
npapi-plugin/Makefile
npapi-plugin/src/Makefile
po/Makefile.in
])
AC_OUTPUT
AC_MSG_NOTICE([
webaccounts-browser-extension $VERSION
----------------------
Chromium extension : ${enable_chromium}
Firefox extension : ${enable_firefox}
Debug : ${enable_debug}
])
webaccounts-browser-extension-0.5/COPYING 0000644 0001750 0001750 00000063502 12165544500 020005 0 ustar ken ken 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!