Add the prompt-service contract to nsEmbedCID.h

This commit is contained in:
bzbarsky%mit.edu 2005-03-07 16:07:11 +00:00
Родитель 08fefcb6ab
Коммит d624665bc9
36 изменённых файлов: 72 добавлений и 492 удалений

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

@ -58,4 +58,19 @@
#define NS_WEBBROWSER_CONTRACTID \
"@mozilla.org/embedding/browser/nsWebBrowser;1"
/**
* Prompt Service ContractID
* The prompt service is the way to pose various prompts, alerts,
* and confirmation dialogs to the user.
*
* This contract implements the following interfaces:
* nsIPromptService
*
* Embedders may override this ContractID with their own implementation if they
* want more control over the way prompts, alerts, and confirmation dialogs are
* presented to the user.
*/
#define NS_PROMPTSERVICE_CONTRACTID \
"@mozilla.org/embedcomp/prompt-service;1"
#endif // NSEMBEDCID_H

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

@ -73,6 +73,7 @@
#include "nsIDOMNSDocument.h"
#include "nsEmbedAPI.h"
#include "nsEmbedCID.h"
#define HACK_NON_REENTRANCY
#ifdef HACK_NON_REENTRANCY
@ -1056,7 +1057,7 @@ HRESULT CMozillaBrowser::Initialize()
rv = registrar->RegisterFactory(kPromptServiceCID,
"Prompt Service",
"@mozilla.org/embedcomp/prompt-service;1",
NS_PROMPTSERVICE_CONTRACTID,
promptFactory);
if (NS_FAILED(rv)) return rv;

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

@ -50,6 +50,7 @@
#include "nsCommandGroup.h"
#include "nsPrintingPromptService.h"
#include "nsBaseCommandController.h"
#include "nsEmbedCID.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowWatcher, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppStartupNotifier)

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

@ -45,7 +45,7 @@
#include "nsIDOMEventTarget.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsEmbedCID.h"
nsresult
NS_NewPrompter(nsIPrompt **result, nsIDOMWindow *aParent)
@ -113,7 +113,7 @@ nsPrompt::nsPrompt(nsIDOMWindow *aParent)
nsresult
nsPrompt::Init()
{
mPromptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1");
mPromptService = do_GetService(NS_PROMPTSERVICE_CONTRACTID);
return mPromptService ? NS_OK : NS_ERROR_FAILURE;
}

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

@ -41,8 +41,6 @@
// {A2112D6A-0E28-421f-B46A-25C0B308CBD0}
#define NS_PROMPTSERVICE_CID \
{0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
#define NS_PROMPTSERVICE_CONTRACTID \
"@mozilla.org/embedcomp/prompt-service;1"
#include "nsCOMPtr.h"
#include "nsIPromptService.h"

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

@ -1,123 +0,0 @@
# ***** 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 SVG project.
#
# The Initial Developer of the Original Code is
# Crocodile Clips Ltd.
# Portions created by the Initial Developer are Copyright (C) 2002
# 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 *****
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gksvgrendererlibart_s
LIBXUL_LIBRARY = 1
REQUIRES = \
xpcom \
widget \
pref \
gfx \
imglib2 \
string \
dom \
content \
necko \
libart_lgpl \
util \
uconv \
windowwatcher \
locale \
$(NULL)
CPPSRCS = \
nsSVGRendererLibart.cpp \
nsSVGLibartPathGeometry.cpp \
nsSVGLibartCanvas.cpp \
nsSVGLibartBPathBuilder.cpp \
nsSVGLibartRegion.cpp \
nsSVGRenderItem.cpp \
nsSVGFill.cpp \
nsSVGStroke.cpp \
nsSVGLibartGlyphGeometryDefault.cpp \
nsSVGLibartGlyphMetricsDefault.cpp \
nsSVGLibartGradient.cpp \
$(NULL)
include $(topsrcdir)/config/config.mk
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
# **********************************************************************
# choose a toolkit specific implementation of nsISVGLibartBitmap:
# gtk2 (disabled for now since "gdk_draw_pixbuf" only available in GTK+ >= 2.1):
ifeq ($(MOZ_GFX_TOOLKIT),gtk2x)
CPPSRCS += nsSVGLibartBitmapGdk.cpp
CFLAGS += $(MOZ_GTK2_CFLAGS)
CXXFLAGS += $(MOZ_GTK2_CFLAGS)
LOCAL_INCLUDES = \
-I$(topsrcdir)/gfx/src/gtk \
-I$(topsrcdir)/gfx/src \
$(NULL)
else
CPPSRCS += nsSVGLibartBitmapAlpha.cpp
endif
# **********************************************************************
# choose a text renderer besides the default one:
ifdef MOZ_ENABLE_FREETYPE2
CPPSRCS += \
nsSVGLibartFreetype.cpp \
nsSVGLibartGlyphGeometryFT.cpp \
nsSVGLibartGlyphMetricsFT.cpp \
$(NULL)
LOCAL_INCLUDES += \
$(FT2_CFLAGS) \
-I$(topsrcdir)/gfx \
-I$(topsrcdir)/gfx/src/freetype \
$(NULL)
DEFINES += -DMOZ_ENABLE_FREETYPE2
endif
# **********************************************************************
include $(topsrcdir)/config/rules.mk

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

@ -1,236 +0,0 @@
/* -*- 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Alex Fritze.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsISVGRenderer.h"
#include "nsSVGLibartPathGeometry.h"
#include "nsSVGLibartCanvas.h"
#include "nsSVGLibartRegion.h"
#include "nsSVGLibartGlyphGeometryDefault.h"
#include "nsSVGLibartGlyphMetricsDefault.h"
#ifdef MOZ_ENABLE_FREETYPE2
#include "nsString.h"
#include "nsIServiceManager.h"
#include "nsSVGLibartFreetype.h"
#include "nsSVGLibartGlyphGeometryFT.h"
#include "nsSVGLibartGlyphMetricsFT.h"
#include "nsIPromptService.h"
#endif
/**
* \addtogroup libart_renderer Libart Rendering Engine
* @{
*/
////////////////////////////////////////////////////////////////////////
/**
* Libart-based renderer implementation
*/
class nsSVGRendererLibart : public nsISVGRenderer
{
protected:
friend nsresult NS_NewSVGRendererLibart(nsISVGRenderer** aResult);
nsSVGRendererLibart();
virtual ~nsSVGRendererLibart();
public:
// nsISupports interface
NS_DECL_ISUPPORTS
// nsISVGRenderer interface
NS_DECL_NSISVGRENDERER
static PRBool sGlobalsInited;
#ifdef MOZ_ENABLE_FREETYPE2
static PRBool sUseFreetype;
#endif
};
/** @} */
//----------------------------------------------------------------------
// implementation
PRBool nsSVGRendererLibart::sGlobalsInited = PR_FALSE;
#ifdef MOZ_ENABLE_FREETYPE2
PRBool nsSVGRendererLibart::sUseFreetype = PR_FALSE;
#endif
nsSVGRendererLibart::nsSVGRendererLibart()
{
}
nsSVGRendererLibart::~nsSVGRendererLibart()
{
}
nsresult
NS_NewSVGRendererLibart(nsISVGRenderer** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
nsSVGRendererLibart* result = new nsSVGRendererLibart();
if (! result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
*aResult = result;
if (!nsSVGRendererLibart::sGlobalsInited) {
#ifdef MOZ_ENABLE_FREETYPE2
static NS_NAMED_LITERAL_CSTRING(prompt_service, "@mozilla.org/embedcomp/prompt-service;1");
if (!nsSVGLibartFreetype::Init()) {
nsCOMPtr<nsIPromptService> prompter(do_GetService(prompt_service.get()));
NS_NAMED_LITERAL_STRING(title, "Freetype error");
NS_NAMED_LITERAL_STRING(msg, "The Libart/Freetype SVG rendering engine could not initialize the freetype library. Please go to http://www.mozilla.org/projects/fonts/unix/enabling_truetype.html and follow steps 2-7.");
prompter->Alert(nsnull, title.get(), msg.get());
}
else if (!nsSVGLibartFreetype::HasSuitableFonts()) {
nsCOMPtr<nsIPromptService> prompter(do_GetService(prompt_service.get()));
NS_NAMED_LITERAL_STRING(title, "Font Configuration Error");
NS_NAMED_LITERAL_STRING(msg, "The Libart/Freetype SVG rendering engine can't find any truetype fonts on your system. Please go to http://www.mozilla.org/projects/fonts/unix/enabling_truetype.html and follow steps 2-7.");
prompter->Alert(nsnull, title.get(), msg.get());
nsSVGLibartFreetype::Shutdown();
}
else {
nsSVGRendererLibart::sUseFreetype = PR_TRUE;
NS_InitSVGLibartGlyphMetricsFTGlobals();
}
#endif
nsSVGRendererLibart::sGlobalsInited = PR_TRUE;
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ISUPPORTS1(nsSVGRendererLibart, nsISVGRenderer)
//----------------------------------------------------------------------
// nsISVGRenderer methods
/** Implements nsISVGRendererPathGeometry createPathGeometry(in nsISVGPathGeometrySource src); */
NS_IMETHODIMP
nsSVGRendererLibart::CreatePathGeometry(nsISVGPathGeometrySource *src,
nsISVGRendererPathGeometry **_retval)
{
return NS_NewSVGLibartPathGeometry(_retval, src);
}
/** Implements nsISVGRendererGlyphMetrics createGlyphMetrics(in nsISVGGlyphMetricsSource src); */
NS_IMETHODIMP
nsSVGRendererLibart::CreateGlyphMetrics(nsISVGGlyphMetricsSource *src,
nsISVGRendererGlyphMetrics **_retval)
{
#ifdef MOZ_ENABLE_FREETYPE2
if (sUseFreetype)
return NS_NewSVGLibartGlyphMetricsFT(_retval, src);
#endif
return NS_NewSVGLibartGlyphMetricsDefault(_retval, src);
}
/** Implements nsISVGRendererGlyphGeometry createGlyphGeometry(in nsISVGGlyphGeometrySource src); */
NS_IMETHODIMP
nsSVGRendererLibart::CreateGlyphGeometry(nsISVGGlyphGeometrySource *src,
nsISVGRendererGlyphGeometry **_retval)
{
#ifdef MOZ_ENABLE_FREETYPE2
if (sUseFreetype)
return NS_NewSVGLibartGlyphGeometryFT(_retval, src);
#endif
return NS_NewSVGLibartGlyphGeometryDefault(_retval, src);
}
/** Implements [noscript] nsISVGRendererCanvas createCanvas(in nsIRenderingContext ctx,
in nsPresContext presContext, const in nsRectRef dirtyRect); */
NS_IMETHODIMP
nsSVGRendererLibart::CreateCanvas(nsIRenderingContext *ctx,
nsPresContext *presContext,
const nsRect & dirtyRect,
nsISVGRendererCanvas **_retval)
{
return NS_NewSVGLibartCanvas(_retval, ctx, presContext, dirtyRect);
}
/** Implements nsISVGRendererRegion createRectRegion(in float x, in float y, in float width, in float height); */
NS_IMETHODIMP
nsSVGRendererLibart::CreateRectRegion(float x, float y, float width, float height,
nsISVGRendererRegion **_retval)
{
return NS_NewSVGLibartRectRegion(_retval, x, y, width, height);
}
/** Implements nsISVGRendererSurface createSurface(in float width, in float height); */
NS_IMETHODIMP
nsSVGRendererLibart::CreateSurface(PRUint32 width, PRUint32 height,
nsISVGRendererSurface **_retval)
{
// XXX
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////
// module initialisation
void NS_InitSVGRendererLibartGlobals()
{
// Initialization of freetype (if compiled-in) is done lazily in
// NS_NewSVGRendererLibart(). The main reason is that we might want
// to show error messages using the prompt service, and that's
// probably not a good idea in *this* function, at a time when
// layout is still not fully initialized.
}
void NS_FreeSVGRendererLibartGlobals()
{
if (!nsSVGRendererLibart::sGlobalsInited) return;
#ifdef MOZ_ENABLE_FREETYPE2
if (nsSVGRendererLibart::sUseFreetype) {
NS_FreeSVGLibartGlyphMetricsFTGlobals();
nsSVGLibartFreetype::Shutdown();
}
#endif
}

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

@ -56,6 +56,7 @@ REQUIRES = \
intl \
windowwatcher \
pref \
embed_base \
$(NULL)
CPPSRCS = nsMailGNOMEIntegration.cpp

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

@ -49,6 +49,7 @@
#include "nsIPrefBranch.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsEmbedCID.h"
#include <glib.h>
#include <limits.h>
@ -265,7 +266,7 @@ nsMailGNOMEIntegration::ShowMailIntegrationDialog(nsIDOMWindow* aParentWindow)
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPromptService> promptService =
do_GetService("@mozilla.org/embedcomp/prompt-service;1");
do_GetService(NS_PROMPTSERVICE_CONTRACTID);
NS_ENSURE_TRUE(promptService, NS_ERROR_FAILURE);
if (mShowMailDialog && showMailDialog) {

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

@ -69,6 +69,7 @@ REQUIRES = xpcom \
import \
windowwatcher \
uriloader \
embed_base \
$(NULL)
CPPSRCS = \

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

@ -70,6 +70,8 @@
#include "nsAddressBook.h" // for the map
#include "nsEmbedCID.h"
#define ID_PAB_TABLE 1
#define ID_DELETEDCARDS_TABLE 2
@ -642,7 +644,8 @@ nsresult nsAddrDatabase::AlertAboutCorruptMabFile(const PRUnichar *aOldFileName,
rv = bundle->GetStringFromName(NS_LITERAL_STRING("corruptMabFileTitle").get(), getter_Copies(alertTitle));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPromptService> prompter = do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv);
nsCOMPtr<nsIPromptService> prompter =
do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = prompter->Alert(nsnull /* we don't know the parent window */, alertTitle.get(), alertMessage.get());

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

@ -71,6 +71,7 @@ REQUIRES = xpcom \
mimetype \
uriloader \
windowwatcher \
embed_base \
$(NULL)
EXPORTS = \

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

@ -110,6 +110,7 @@
#include "nsInt64.h"
#include <time.h>
#include "nsIMsgMailNewsUrl.h"
#include "nsEmbedCID.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
@ -1376,7 +1377,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *aMsgWindow,
if (confirmDeletion)
{
IMAPGetStringByID(IMAP_EMPTY_TRASH_CONFIRM, getter_Copies(confirmationStr));
promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1");
promptService = do_GetService(NS_PROMPTSERVICE_CONTRACTID);
nsCOMPtr<nsIDocShell> docShell;
if (aMsgWindow)
{

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

@ -66,6 +66,7 @@ REQUIRES = xpcom \
msgimap \
nkcache \
windowwatcher \
embed_base \
$(NULL)
CPPSRCS = \

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

@ -67,6 +67,7 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDocShell.h"
#include "nsIDOMWindowInternal.h"
#include "nsEmbedCID.h"
NS_IMPL_THREADSAFE_ISUPPORTS1(nsPop3Sink, nsIPop3Sink)
@ -727,7 +728,8 @@ nsresult nsPop3Sink::HandleTempDownloadFailed(nsIMsgWindow *msgWindow)
if (NS_SUCCEEDED(rv))
bundle->FormatStringFromID(POP3_TMP_DOWNLOAD_FAILED, params, 2, getter_Copies(confirmString));
nsCOMPtr<nsIDOMWindowInternal> parentWindow;
nsCOMPtr<nsIPromptService> promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1");
nsCOMPtr<nsIPromptService> promptService =
do_GetService(NS_PROMPTSERVICE_CONTRACTID);
nsCOMPtr<nsIDocShell> docShell;
if (msgWindow)
{

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

@ -73,6 +73,7 @@ REQUIRES = xpcom \
unicharutil \
embedcomponents \
xulapp \
embed_base \
$(NULL)
EXPORTS = \

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

@ -87,6 +87,8 @@
#include "msgMapiMain.h"
#include "nsNetUtil.h"
#include "nsEmbedCID.h"
#ifndef MOZ_XUL_APP
#include "nsICmdLineService.h"
#endif
@ -191,7 +193,7 @@ PRBool nsMapiHook::DisplayLoginDialog(PRBool aLogin, PRUnichar **aUsername,
nsresult rv;
PRBool btnResult = PR_FALSE;
nsCOMPtr<nsIPromptService> dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
nsCOMPtr<nsIPromptService> dlgService(do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && dlgService)
{
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv));
@ -328,7 +330,7 @@ nsMapiHook::IsBlindSendAllowed()
getter_Copies(dontShowAgainMessage));
if (NS_FAILED(rv)) return PR_FALSE;
nsCOMPtr<nsIPromptService> dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
nsCOMPtr<nsIPromptService> dlgService(do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv) || !dlgService) return PR_FALSE;
PRBool continueToWarn = PR_TRUE;

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

@ -48,6 +48,8 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsEmbedCID.h"
/** Implementation of the nsIMapiRegistry interface.
* Use standard implementation of nsISupports stuff.
*/
@ -160,7 +162,7 @@ nsMapiRegistry::ShowMailIntegrationDialog(nsIDOMWindow *aParentWindow) {
nsresult rv;
nsCOMPtr<nsIPromptService> promptService(do_GetService(
"@mozilla.org/embedcomp/prompt-service;1", &rv));
NS_PROMPTSERVICE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && promptService)
{
nsCOMPtr<nsIStringBundle> bundle;

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

@ -53,6 +53,7 @@
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsNativeCharsetUtils.h"
#include "nsEmbedCID.h"
#include <mbstring.h>
#define EXE_EXTENSION ".exe"
@ -1240,7 +1241,7 @@ nsresult nsMapiRegistryUtils::ShowMapiErrorDialog(PRBool aForMail)
{
nsresult rv;
nsCOMPtr<nsIPromptService> promptService(do_GetService(
"@mozilla.org/embedcomp/prompt-service;1", &rv));
NS_PROMPTSERVICE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && promptService)
{
nsCOMPtr<nsIStringBundle> bundle;

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

@ -63,6 +63,7 @@ REQUIRES = xpcom \
webbrwsr \
uconv \
windowwatcher \
embed_base \
$(NULL)
CPPSRCS = \

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

@ -74,6 +74,7 @@
#include "nsIDocShellTreeOwner.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWindowWatcher.h"
#include "nsEmbedCID.h"
#if defined(XP_MAC) && !defined(DEBUG)
//lower silly optimization level which takes an age for this file.
@ -482,7 +483,7 @@ nsPrefMigration::ShowSpaceDialog(PRInt32 *choice)
rv = bundle->GetStringFromName(NS_LITERAL_STRING("createNew.label").get(), getter_Copies(createNewLabel));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIPromptService> promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv);
nsCOMPtr<nsIPromptService> promptService = do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
const PRUint32 buttons =

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

@ -64,6 +64,7 @@ REQUIRES = xpcom \
chrome \
windowwatcher \
profdirserviceprovider \
embed_base \
$(NULL)
CPPSRCS = nsProfile.cpp \

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

@ -97,7 +97,7 @@
#include "nsIWindowWatcher.h"
#include "jsapi.h"
#include "nsIJSContextStack.h"
#include "nsEmbedCID.h"
#if defined(XP_MAC) || defined(XP_MACOSX)
#define OLD_REGISTRY_FILE_NAME "Netscape Registry"
@ -648,7 +648,7 @@ nsProfile::ConfirmAutoMigration(PRBool canInteract, PRBool *confirmed)
rv = migrationBundle->GetStringFromName(NS_LITERAL_STRING("manage").get(), getter_Copies(button1Title));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIPromptService> promptService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
nsCOMPtr<nsIPromptService> promptService(do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
PRInt32 buttonPressed;
rv = promptService->ConfirmEx(nsnull, dialogTitle.get(), msgString.get(),

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

@ -61,6 +61,7 @@ REQUIRES = xpcom \
appshell \
dom \
xpinstall \
embed_base \
$(NULL)
ifeq ($(OS_ARCH),WINNT)

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

@ -64,6 +64,7 @@
#include "nsVoidArray.h"
#include "nsEnumeratorUtils.h"
#include "nsIFileURL.h"
#include "nsEmbedCID.h"
/* Outstanding issues/todo:
* 1. Implement pause/resume.
@ -1390,7 +1391,7 @@ nsDownloadManager::ConfirmCancelDownloads(PRInt32 aCount, nsISupportsPRBool* aCa
wm->GetMostRecentWindow(NS_LITERAL_STRING("Download:Manager").get(), getter_AddRefs(dmWindow));
// Show alert.
nsCOMPtr<nsIPromptService> prompter(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIPromptService> prompter(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
if (prompter) {
PRInt32 flags = (nsIPromptService::BUTTON_TITLE_IS_STRING * nsIPromptService::BUTTON_POS_0) + (nsIPromptService::BUTTON_TITLE_IS_STRING * nsIPromptService::BUTTON_POS_1);
PRBool nothing = PR_FALSE;
@ -1526,7 +1527,7 @@ nsXPIProgressListener::OnStateChange(PRUint32 aIndex, PRInt16 aState, PRInt32 aV
xpinstallBundle->FormatStringFromName(NS_LITERAL_STRING("installComplete").get(), strings, 1, getter_Copies(message));
xpinstallBundle->GetStringFromName(NS_LITERAL_STRING("installCompleteTitle").get(), getter_Copies(title));
nsCOMPtr<nsIPromptService> ps(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIPromptService> ps(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
ps->Alert(nsnull, title, message);
}

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

@ -77,6 +77,7 @@ REQUIRES = xpcom \
uconv \
docshell \
windowwatcher \
embed_base \
$(NULL)
ifdef MOZ_PHOENIX

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

@ -52,15 +52,13 @@
#include "nsMIMEInfoMac.h"
#include "nsIInternetConfigService.h"
#include "nsEmbedCID.h"
#include <LaunchServices.h>
// chrome URL's
#define HELPERAPPLAUNCHER_BUNDLE_URL "chrome://global/locale/helperAppLauncher.properties"
#define BRAND_BUNDLE_URL "chrome://global/locale/brand.properties"
#define NS_PROMPTSERVICE_CONTRACTID "@mozilla.org/embedcomp/prompt-service;1"
nsOSHelperAppService::nsOSHelperAppService() : nsExternalHelperAppService()
{
}

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

@ -72,6 +72,7 @@
#include "nsIObserverService.h"
#include "nsXPCOM.h"
#include "nsXPFEComponentsCID.h"
#include "nsEmbedCID.h"
struct JSContext;
@ -933,7 +934,7 @@ struct MessageWindow {
}
if ( !dialogMsg.IsEmpty() && !dialogTitle.IsEmpty() && !brandName.IsEmpty() ) {
nsCOMPtr<nsIPromptService> dialog( do_GetService( "@mozilla.org/embedcomp/prompt-service;1" ) );
nsCOMPtr<nsIPromptService> dialog( do_GetService( NS_PROMPTSERVICE_CONTRACTID ) );
if ( dialog ) {
PRBool reallyDisable;
nsNativeAppSupportWin::mLastWindowIsConfirmation = PR_TRUE;

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

@ -62,6 +62,7 @@ REQUIRES = xpcom \
widget \
pref \
appcomps \
embed_base \
$(NULL)
CPPSRCS = \
nsDownloadManager.cpp \

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

@ -64,6 +64,7 @@
#include "nsIPrefService.h"
#include "nsIFileURL.h"
#include "nsIAlertsService.h"
#include "nsEmbedCID.h"
/* Outstanding issues/todo:
* 1. Implement pause/resume.
@ -870,7 +871,7 @@ nsDownloadManager::Observe(nsISupports* aSubject, const char* aTopic, const PRUn
getter_Copies(proceed));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPromptService> promptService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
nsCOMPtr<nsIPromptService> promptService(do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
@ -1145,7 +1146,7 @@ nsDownload::OnStatusChange(nsIWebProgress *aWebProgress,
wm->GetMostRecentWindow(NS_LITERAL_STRING("Download:Manager").get(), getter_AddRefs(dmWindow));
// Show alert.
nsCOMPtr<nsIPromptService> prompter(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIPromptService> prompter(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
if (prompter)
prompter->Alert(dmWindow, title, aMessage);
}

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

@ -70,6 +70,7 @@
#include "nsWidgetsCID.h"
#include "nsAppShellCID.h"
#include "nsXPFEComponentsCID.h"
#include "nsEmbedCID.h"
NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
@ -524,7 +525,7 @@ nsAppStartup::CheckAndRemigrateDefunctProfile()
rv = migrationBundle->GetStringFromName(NS_LITERAL_STRING("confirmRemigration").get(), getter_Copies(dialogText));
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsIPromptService> promptService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
nsCOMPtr<nsIPromptService> promptService(do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv,rv);
PRInt32 buttonPressed;
rv = promptService->ConfirmEx(nsnull, brandName.get(),

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

@ -65,6 +65,7 @@ REQUIRES = \
gfx \
locale \
xulapp \
embed_base \
$(NULL)
FORCE_STATIC_LIB = 1

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

@ -80,6 +80,7 @@
#endif
#include "nsXPFEComponentsCID.h"
#include "nsEmbedCID.h"
#define RUNKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
@ -419,7 +420,7 @@ nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent,
// o We need the string bundle service to fetch the appropriate
// dialog text.
nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID;
nsCOMPtr<nsIPromptService> promptService( do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIPromptService> promptService( do_GetService(NS_PROMPTSERVICE_CONTRACTID));
nsCOMPtr<nsIStringBundleService> bundleService( do_GetService( bundleCID, &rv ) );
if ( promptService && bundleService ) {

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

@ -85,6 +85,7 @@ REQUIRES = xpcom \
layout \
chrome \
extensions \
embed_base \
$(ZLIB_REQUIRES) \
$(NULL)

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

@ -1,106 +0,0 @@
/* -*- 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 Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Daniel Veditz <dveditz@netscape.com>
* Jens Bannmann <jens.b@web.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 ***** */
/* used by XPInstall for actions that must be performed on the UI thread */
#include "nsXPIProxy.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIPluginManager.h"
#include "nsIServiceManager.h"
#include "nsIObserverService.h"
#include "nsIPromptService.h"
nsXPIProxy::nsXPIProxy()
{
}
nsXPIProxy::~nsXPIProxy()
{
}
NS_IMPL_THREADSAFE_ISUPPORTS1(nsXPIProxy, nsPIXPIProxy)
NS_IMETHODIMP
nsXPIProxy::RefreshPlugins(PRBool aReloadPages)
{
NS_DEFINE_CID(pluginManagerCID,NS_PLUGINMANAGER_CID);
nsCOMPtr<nsIPluginManager> plugins(do_GetService(pluginManagerCID));
if (!plugins)
return NS_ERROR_FAILURE;
return plugins->ReloadPlugins(aReloadPages);
}
NS_IMETHODIMP
nsXPIProxy::NotifyRestartNeeded()
{
nsCOMPtr<nsIObserverService> obs(do_GetService("@mozilla.org/observer-service;1"));
if (obs)
obs->NotifyObservers( nsnull, "xpinstall-restart", nsnull );
return NS_OK;
}
NS_IMETHODIMP
nsXPIProxy::Alert(const PRUnichar* aTitle, const PRUnichar* aText)
{
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (!dialog)
return NS_ERROR_FAILURE;
return dialog->Alert( nsnull, aTitle, aText );
}
NS_IMETHODIMP
nsXPIProxy::ConfirmEx(const PRUnichar* aDialogTitle, const PRUnichar* aText, PRUint32 aButtonFlags, const PRUnichar* aButton0Title, const PRUnichar* aButton1Title, const PRUnichar* aButton2Title, const PRUnichar* aCheckMsg, PRBool* aCheckState, PRInt32* aReturn)
{
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (!dialog)
return NS_ERROR_FAILURE;
return dialog->ConfirmEx( nsnull, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState, aReturn );
}

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

@ -83,6 +83,8 @@
#include "CertReader.h"
#include "nsEmbedCID.h"
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
@ -425,7 +427,7 @@ PRBool nsXPInstallManager::ConfirmChromeInstall(nsIDOMWindowInternal* aParentWin
// confirmation dialog
PRBool bInstall = PR_FALSE;
nsCOMPtr<nsIPromptService> dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIPromptService> dlgService(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
if (dlgService)
{
dlgService->Confirm(