2005-12-09 11:51:02 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2005 Jacek Caban
|
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-12-09 11:51:02 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
#define NS_PROMPTSERVICE_CONTRACTID "@mozilla.org/embedcomp/prompt-service;1"
|
2006-03-27 21:02:28 +02:00
|
|
|
#define NS_TOOLTIPTEXTPROVIDER_CONTRACTID "@mozilla.org/embedcomp/tooltiptextprovider;1"
|
|
|
|
|
|
|
|
#define NS_TOOLTIPTEXTPROVIDER_CLASSNAME "nsTooltipTextProvider"
|
2005-12-09 11:51:02 +01:00
|
|
|
|
|
|
|
static const nsIID NS_PROMPTSERVICE_CID =
|
|
|
|
{0xa2112d6a,0x0e28,0x421f,{0xb4,0x6a,0x25,0xc0,0xb3,0x8,0xcb,0xd0}};
|
2006-03-27 21:02:28 +02:00
|
|
|
static const nsIID NS_TOOLTIPTEXTPROVIDER_CID =
|
|
|
|
{0x0b666e3e,0x569a,0x462c,{0xa7,0xf0,0xb1,0x6b,0xb1,0x5d,0x42,0xff}};
|
2005-12-09 11:51:02 +01:00
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_QueryInterface(nsIPromptService *iface,
|
2010-08-02 11:08:26 +02:00
|
|
|
nsIIDRef riid, void **result)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
*result = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_nsISupports, riid)) {
|
|
|
|
TRACE("(IID_nsISupports %p)\n", result);
|
|
|
|
*result = iface;
|
|
|
|
}else if(IsEqualGUID(&IID_nsIPromptService, riid)) {
|
|
|
|
TRACE("(IID_nsIPromptService %p)\n", result);
|
|
|
|
*result = iface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*result)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
TRACE("(%s %p)\n", debugstr_guid(riid), result);
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsrefcnt NSAPI nsPromptService_AddRef(nsIPromptService *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsrefcnt NSAPI nsPromptService_Release(nsIPromptService *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-06-13 17:40:51 +02:00
|
|
|
static nsresult NSAPI nsPromptService_Alert(nsIPromptService *iface, mozIDOMWindowProxy *aParent,
|
2005-12-09 11:51:02 +01:00
|
|
|
const PRUnichar *aDialogTitle, const PRUnichar *aText)
|
|
|
|
{
|
2012-06-25 14:04:59 +02:00
|
|
|
HTMLOuterWindow *window;
|
2006-12-08 12:38:19 +01:00
|
|
|
BSTR text;
|
|
|
|
|
|
|
|
TRACE("(%p %s %s)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText));
|
|
|
|
|
2016-06-13 17:40:51 +02:00
|
|
|
window = mozwindow_to_window(aParent);
|
2006-12-08 12:38:19 +01:00
|
|
|
if(!window) {
|
2016-06-13 17:40:51 +02:00
|
|
|
WARN("Could not find HTMLWindow for mozIDOMWindowProxy %p\n", aParent);
|
2006-12-08 12:38:19 +01:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
text = SysAllocString(aText);
|
2012-06-25 14:04:59 +02:00
|
|
|
IHTMLWindow2_alert(&window->base.IHTMLWindow2_iface, text);
|
2006-12-08 12:38:19 +01:00
|
|
|
SysFreeString(text);
|
|
|
|
|
|
|
|
return NS_OK;
|
2005-12-09 11:51:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_AlertCheck(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle,
|
2012-03-15 11:54:48 +01:00
|
|
|
const PRUnichar *aText, const PRUnichar *aCheckMsg, cpp_bool *aCheckState)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p %s %s %s %p)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText),
|
|
|
|
debugstr_w(aCheckMsg), aCheckState);
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_Confirm(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle, const PRUnichar *aText,
|
2012-03-15 11:54:48 +01:00
|
|
|
cpp_bool *_retval)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p %s %s %p)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText), _retval);
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_ConfirmCheck(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle,
|
2012-03-15 11:54:48 +01:00
|
|
|
const PRUnichar *aText, const PRUnichar *aCheckMsg, cpp_bool *aCheckState,
|
|
|
|
cpp_bool *_retval)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p %s %s %s %p %p)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText),
|
|
|
|
debugstr_w(aCheckMsg), aCheckState, _retval);
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_ConfirmEx(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle,
|
2013-01-23 18:44:42 +01:00
|
|
|
const PRUnichar *aText, UINT32 aButtonFlags, const PRUnichar *aButton0Title,
|
2005-12-09 11:51:02 +01:00
|
|
|
const PRUnichar *aButton1Title, const PRUnichar *aButton2Title,
|
2013-01-18 14:05:59 +01:00
|
|
|
const PRUnichar *aCheckMsg, cpp_bool *aCheckState, LONG *_retval)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p %s %s %08x %s %s %s %s %p %p) hack!\n", aParent, debugstr_w(aDialogTitle),
|
2005-12-09 11:51:02 +01:00
|
|
|
debugstr_w(aText), aButtonFlags, debugstr_w(aButton0Title),
|
|
|
|
debugstr_w(aButton1Title), debugstr_w(aButton2Title), debugstr_w(aCheckMsg),
|
|
|
|
aCheckState, _retval);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME:
|
|
|
|
* This is really very very ugly hack!!!
|
|
|
|
*/
|
|
|
|
|
2020-11-24 00:49:06 +01:00
|
|
|
if(aButton0Title && !memcmp(aButton0Title, L"Continue", sizeof(L"Continue")))
|
2005-12-09 11:51:02 +01:00
|
|
|
*_retval = 0;
|
2020-11-24 00:49:06 +01:00
|
|
|
else if(aButton1Title && !memcmp(aButton1Title, L"Continue", sizeof(L"Continue")))
|
2005-12-09 11:51:02 +01:00
|
|
|
*_retval = 1;
|
2020-11-24 00:49:06 +01:00
|
|
|
else if(aButton2Title && !memcmp(aButton2Title, L"Continue", sizeof(L"Continue")))
|
2005-12-09 11:51:02 +01:00
|
|
|
*_retval = 2;
|
2006-02-24 22:21:03 +01:00
|
|
|
/* else
|
|
|
|
* let's hope that _retval is set to the default value */
|
2005-12-09 11:51:02 +01:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_Prompt(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle,
|
2005-12-09 11:51:02 +01:00
|
|
|
const PRUnichar *aText, PRUnichar **aValue, const PRUnichar *aCheckMsg,
|
2012-03-15 11:54:48 +01:00
|
|
|
cpp_bool *aCheckState, cpp_bool *_retval)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p %s %s %p %s %p %p)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText),
|
|
|
|
aValue, debugstr_w(aCheckMsg), aCheckState, _retval);
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_PromptUsernameAndPassword(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle,
|
2005-12-09 11:51:02 +01:00
|
|
|
const PRUnichar *aText, PRUnichar **aUsername, PRUnichar **aPassword,
|
2012-03-15 11:54:48 +01:00
|
|
|
const PRUnichar *aCheckMsg, cpp_bool *aCheckState, cpp_bool *_retval)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p %s %s %p %p %s %p %p)\n", aParent, debugstr_w(aDialogTitle),
|
|
|
|
debugstr_w(aText), aUsername, aPassword, debugstr_w(aCheckMsg), aCheckState,
|
|
|
|
_retval);
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_PromptPassword(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle,
|
2005-12-09 11:51:02 +01:00
|
|
|
const PRUnichar *aText, PRUnichar **aPassword, const PRUnichar *aCheckMsg,
|
2012-03-15 11:54:48 +01:00
|
|
|
cpp_bool *aCheckState, cpp_bool *_retval)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p %s %s %p %s %p %p)\n", aParent, debugstr_w(aDialogTitle),
|
|
|
|
debugstr_w(aText), aPassword, debugstr_w(aCheckMsg), aCheckState, _retval);
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsPromptService_Select(nsIPromptService *iface,
|
2016-06-13 17:40:51 +02:00
|
|
|
mozIDOMWindowProxy *aParent, const PRUnichar *aDialogTitle,
|
2013-01-23 18:44:42 +01:00
|
|
|
const PRUnichar *aText, UINT32 aCount, const PRUnichar **aSelectList,
|
2013-01-18 14:05:59 +01:00
|
|
|
LONG *aOutSelection, cpp_bool *_retval)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p %s %s %d %p %p %p)\n", aParent, debugstr_w(aDialogTitle),
|
2005-12-09 11:51:02 +01:00
|
|
|
debugstr_w(aText), aCount, aSelectList, aOutSelection, _retval);
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const nsIPromptServiceVtbl PromptServiceVtbl = {
|
|
|
|
nsPromptService_QueryInterface,
|
|
|
|
nsPromptService_AddRef,
|
|
|
|
nsPromptService_Release,
|
|
|
|
nsPromptService_Alert,
|
|
|
|
nsPromptService_AlertCheck,
|
|
|
|
nsPromptService_Confirm,
|
|
|
|
nsPromptService_ConfirmCheck,
|
|
|
|
nsPromptService_ConfirmEx,
|
|
|
|
nsPromptService_Prompt,
|
|
|
|
nsPromptService_PromptUsernameAndPassword,
|
|
|
|
nsPromptService_PromptPassword,
|
|
|
|
nsPromptService_Select
|
|
|
|
};
|
|
|
|
|
|
|
|
static nsIPromptService nsPromptService = { &PromptServiceVtbl };
|
|
|
|
|
2006-03-27 21:02:28 +02:00
|
|
|
static nsresult NSAPI nsTooltipTextProvider_QueryInterface(nsITooltipTextProvider *iface,
|
2010-08-02 11:08:26 +02:00
|
|
|
nsIIDRef riid, void **result)
|
2006-03-27 21:02:28 +02:00
|
|
|
{
|
|
|
|
*result = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_nsISupports, riid)) {
|
|
|
|
TRACE("(IID_nsISupports %p)\n", result);
|
|
|
|
*result = iface;
|
|
|
|
}else if(IsEqualGUID(&IID_nsITooltipTextProvider, riid)) {
|
|
|
|
TRACE("(IID_nsITooltipTextProvider %p)\n", result);
|
|
|
|
*result = iface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*result) {
|
|
|
|
nsITooltipTextProvider_AddRef(iface);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("(%s %p)\n", debugstr_guid(riid), result);
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsrefcnt NSAPI nsTooltipTextProvider_AddRef(nsITooltipTextProvider *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsrefcnt NSAPI nsTooltipTextProvider_Release(nsITooltipTextProvider *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsTooltipTextProvider_GetNodeText(nsITooltipTextProvider *iface,
|
2012-03-15 11:54:48 +01:00
|
|
|
nsIDOMNode *aNode, PRUnichar **aText, cpp_bool *_retval)
|
2006-03-27 21:02:28 +02:00
|
|
|
{
|
|
|
|
nsIDOMHTMLElement *nselem;
|
|
|
|
nsIDOMNode *node = aNode, *parent;
|
|
|
|
nsAString title_str;
|
|
|
|
const PRUnichar *title = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p %p %p)\n", aNode, aText, _retval);
|
|
|
|
|
|
|
|
*aText = NULL;
|
|
|
|
|
|
|
|
nsAString_Init(&title_str, NULL);
|
|
|
|
|
|
|
|
do {
|
|
|
|
nsres = nsIDOMNode_QueryInterface(node, &IID_nsIDOMHTMLElement, (void**)&nselem);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
title = NULL;
|
|
|
|
|
|
|
|
nsIDOMHTMLElement_GetTitle(nselem, &title_str);
|
|
|
|
nsIDOMHTMLElement_Release(nselem);
|
|
|
|
|
2007-12-17 01:38:30 +01:00
|
|
|
nsAString_GetData(&title_str, &title);
|
2006-03-27 21:02:28 +02:00
|
|
|
if(title && *title) {
|
|
|
|
if(node != aNode)
|
|
|
|
nsIDOMNode_Release(node);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMNode_GetParentNode(node, &parent);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
parent = NULL;
|
|
|
|
|
|
|
|
if(node != aNode)
|
|
|
|
nsIDOMNode_Release(node);
|
|
|
|
node = parent;
|
|
|
|
} while(node);
|
|
|
|
|
|
|
|
if(title && *title) {
|
2019-06-13 08:34:29 +02:00
|
|
|
int size = (lstrlenW(title)+1)*sizeof(PRUnichar);
|
2006-03-27 21:02:28 +02:00
|
|
|
|
|
|
|
*aText = nsalloc(size);
|
|
|
|
memcpy(*aText, title, size);
|
|
|
|
TRACE("aText = %s\n", debugstr_w(*aText));
|
|
|
|
|
|
|
|
*_retval = TRUE;
|
|
|
|
}else {
|
|
|
|
*_retval = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Finish(&title_str);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const nsITooltipTextProviderVtbl nsTooltipTextProviderVtbl = {
|
|
|
|
nsTooltipTextProvider_QueryInterface,
|
|
|
|
nsTooltipTextProvider_AddRef,
|
|
|
|
nsTooltipTextProvider_Release,
|
|
|
|
nsTooltipTextProvider_GetNodeText
|
|
|
|
};
|
|
|
|
|
|
|
|
static nsITooltipTextProvider nsTooltipTextProvider = { &nsTooltipTextProviderVtbl };
|
|
|
|
|
2005-12-09 11:51:02 +01:00
|
|
|
typedef struct {
|
2011-01-04 01:46:39 +01:00
|
|
|
nsIFactory nsIFactory_iface;
|
2005-12-09 11:51:02 +01:00
|
|
|
nsISupports *service;
|
|
|
|
} nsServiceFactory;
|
|
|
|
|
2011-01-04 01:46:39 +01:00
|
|
|
static inline nsServiceFactory *impl_from_nsIFactory(nsIFactory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, nsServiceFactory, nsIFactory_iface);
|
|
|
|
}
|
2005-12-09 11:51:02 +01:00
|
|
|
|
|
|
|
static nsresult NSAPI nsServiceFactory_QueryInterface(nsIFactory *iface, nsIIDRef riid,
|
2010-08-02 11:08:26 +02:00
|
|
|
void **result)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
2011-01-04 01:46:39 +01:00
|
|
|
nsServiceFactory *This = impl_from_nsIFactory(iface);
|
2005-12-09 11:51:02 +01:00
|
|
|
|
|
|
|
*result = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_nsISupports, riid)) {
|
2008-01-16 12:20:50 +01:00
|
|
|
TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
|
2011-01-04 01:46:39 +01:00
|
|
|
*result = &This->nsIFactory_iface;
|
2005-12-09 11:51:02 +01:00
|
|
|
}else if(IsEqualGUID(&IID_nsIFactory, riid)) {
|
|
|
|
TRACE("(%p)->(IID_nsIFactory %p)\n", This, result);
|
2011-01-04 01:46:39 +01:00
|
|
|
*result = &This->nsIFactory_iface;
|
2005-12-09 11:51:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(*result)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsrefcnt NSAPI nsServiceFactory_AddRef(nsIFactory *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsrefcnt NSAPI nsServiceFactory_Release(nsIFactory *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsresult NSAPI nsServiceFactory_CreateInstance(nsIFactory *iface,
|
|
|
|
nsISupports *aOuter, const nsIID *iid, void **result)
|
|
|
|
{
|
2011-01-04 01:46:39 +01:00
|
|
|
nsServiceFactory *This = impl_from_nsIFactory(iface);
|
2005-12-09 11:51:02 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p %s %p)\n", This, aOuter, debugstr_guid(iid), result);
|
|
|
|
|
|
|
|
return nsISupports_QueryInterface(This->service, iid, result);
|
|
|
|
}
|
|
|
|
|
2012-03-15 11:54:48 +01:00
|
|
|
static nsresult NSAPI nsServiceFactory_LockFactory(nsIFactory *iface, cpp_bool lock)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
2011-01-04 01:46:39 +01:00
|
|
|
nsServiceFactory *This = impl_from_nsIFactory(iface);
|
2005-12-09 11:51:02 +01:00
|
|
|
WARN("(%p)->(%x)\n", This, lock);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const nsIFactoryVtbl nsServiceFactoryVtbl = {
|
|
|
|
nsServiceFactory_QueryInterface,
|
|
|
|
nsServiceFactory_AddRef,
|
|
|
|
nsServiceFactory_Release,
|
|
|
|
nsServiceFactory_CreateInstance,
|
|
|
|
nsServiceFactory_LockFactory
|
|
|
|
};
|
|
|
|
|
2006-03-01 22:04:51 +01:00
|
|
|
static nsServiceFactory nsPromptServiceFactory = {
|
2011-01-04 01:46:39 +01:00
|
|
|
{ &nsServiceFactoryVtbl },
|
2005-12-09 11:51:02 +01:00
|
|
|
(nsISupports*)&nsPromptService
|
|
|
|
};
|
|
|
|
|
2006-03-27 21:02:28 +02:00
|
|
|
static nsServiceFactory nsTooltipTextFactory = {
|
2011-01-04 01:46:39 +01:00
|
|
|
{ &nsServiceFactoryVtbl },
|
2006-03-27 21:02:28 +02:00
|
|
|
(nsISupports*)&nsTooltipTextProvider
|
|
|
|
};
|
|
|
|
|
2006-03-01 22:04:51 +01:00
|
|
|
void register_nsservice(nsIComponentRegistrar *registrar, nsIServiceManager *service_manager)
|
2005-12-09 11:51:02 +01:00
|
|
|
{
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
nsres = nsIComponentRegistrar_RegisterFactory(registrar, &NS_PROMPTSERVICE_CID,
|
2011-01-04 01:46:39 +01:00
|
|
|
"Prompt Service", NS_PROMPTSERVICE_CONTRACTID, &nsPromptServiceFactory.nsIFactory_iface);
|
2005-12-09 11:51:02 +01:00
|
|
|
if(NS_FAILED(nsres))
|
2022-02-15 07:29:41 +01:00
|
|
|
ERR("RegisterFactory failed: %08lx\n", nsres);
|
2006-03-01 22:04:51 +01:00
|
|
|
|
2006-03-27 21:02:28 +02:00
|
|
|
nsres = nsIComponentRegistrar_RegisterFactory(registrar, &NS_TOOLTIPTEXTPROVIDER_CID,
|
|
|
|
NS_TOOLTIPTEXTPROVIDER_CLASSNAME, NS_TOOLTIPTEXTPROVIDER_CONTRACTID,
|
2011-01-04 01:46:39 +01:00
|
|
|
&nsTooltipTextFactory.nsIFactory_iface);
|
2006-03-27 21:02:28 +02:00
|
|
|
if(NS_FAILED(nsres))
|
2022-02-15 07:29:41 +01:00
|
|
|
ERR("RegisterFactory failed: %08lx\n", nsres);
|
2005-12-09 11:51:02 +01:00
|
|
|
}
|