Compare commits
5 Commits
src
...
XPINSTALL_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed66e42ce5 | ||
|
|
021d4da153 | ||
|
|
e9d7999625 | ||
|
|
76af2ddf0b | ||
|
|
425dab1758 |
Binary file not shown.
Binary file not shown.
@@ -25,6 +25,6 @@
|
||||
|
||||
DEPTH=..
|
||||
|
||||
DIRS= public res src
|
||||
DIRS= public src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
xmlns:NC="http://home.netscape.com/NC-rdf#">
|
||||
|
||||
<RDF:Bag ID="NC:SoftwareUpdateRoot">
|
||||
<RDF:li>
|
||||
<RDF:Bag ID="NC:NewSoftwareToday" NC:title="New Software">
|
||||
|
||||
<RDF:li>
|
||||
<RDF:Description ID="AimUpdate344">
|
||||
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
|
||||
@@ -26,8 +23,5 @@
|
||||
<NC:url>http://home.netscape.com/index.html</NC:url>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
|
||||
</RDF:Bag>
|
||||
</RDF:li>
|
||||
</RDF:Bag>
|
||||
</RDF:RDF>
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
|
||||
nsISoftwareUpdate.h
|
||||
nsSoftwareUpdateIIDs.h
|
||||
nsIXPInstallProgressNotifier.h
|
||||
@@ -31,13 +31,12 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xpinstall
|
||||
|
||||
XPIDLSRCS = nsIXPInstallProgress.idl
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMInstallTriggerGlobal.h \
|
||||
nsIDOMInstallVersion.h \
|
||||
nsSoftwareUpdateIIDs.h \
|
||||
nsISoftwareUpdate.h \
|
||||
nsIXPInstallProgressNotifier.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
@@ -22,15 +22,17 @@
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
MODULE=xpinstall
|
||||
DEPTH=..\..
|
||||
|
||||
DEFINES=-D_IMPL_NS_DOM
|
||||
|
||||
EXPORTS= nsIDOMInstallTriggerGlobal.h \
|
||||
nsIDOMInstallVersion.h \
|
||||
nsSoftwareUpdateIIDs.h \
|
||||
nsISoftwareUpdate.h
|
||||
nsISoftwareUpdate.h \
|
||||
nsIXPInstallProgressNotifier.h
|
||||
|
||||
XPIDLSRCS = .\nsIXPInstallProgress.idl
|
||||
MODULE=xpinstall
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "nsIFactory.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsIXPInstallProgressNotifier.h"
|
||||
|
||||
#define NS_IXPINSTALLCOMPONENT_PROGID NS_IAPPSHELLCOMPONENT_PROGID "/xpinstall"
|
||||
#define NS_IXPINSTALLCOMPONENT_CLASSNAME "Mozilla XPInstall Component"
|
||||
@@ -53,13 +53,13 @@ class nsISoftwareUpdate : public nsISupports
|
||||
const nsString& localFile,
|
||||
long flags) = 0;
|
||||
|
||||
NS_IMETHOD RegisterNotifier(nsIXPInstallProgress *notifier) = 0;
|
||||
NS_IMETHOD RegisterNotifier(nsIXPInstallProgressNotifier *notifier) = 0;
|
||||
|
||||
NS_IMETHOD InstallPending(void) = 0;
|
||||
|
||||
/* FIX: these should be in a private interface */
|
||||
NS_IMETHOD InstallJarCallBack() = 0;
|
||||
NS_IMETHOD GetTopLevelNotifier(nsIXPInstallProgress **notifier) = 0;
|
||||
NS_IMETHOD GetTopLevelNotifier(nsIXPInstallProgressNotifier **notifier) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[uuid(eea90d40-b059-11d2-915e-c12b696c9333)]
|
||||
interface nsIXPInstallProgress : nsISupports
|
||||
{
|
||||
void BeforeJavascriptEvaluation();
|
||||
void AfterJavascriptEvaluation();
|
||||
void InstallStarted([const] in string UIPackageName);
|
||||
void ItemScheduled([const] in string message );
|
||||
void InstallFinalization([const] in string message, in long itemNum, in long totNum );
|
||||
void InstallAborted();
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
progress.xul
|
||||
progress.css
|
||||
progress.html
|
||||
@@ -1,34 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
EXPORT_RESOURCE_XPINSTALL = \
|
||||
$(srcdir)/progress.xul \
|
||||
$(srcdir)/progress.html \
|
||||
$(srcdir)/progress.css \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
$(INSTALL) $(EXPORT_RESOURCE_XPINSTALL) $(DIST)/bin/res/xpinstall
|
||||
@@ -1,31 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) progress.xul $(DIST)\bin\res\xpinstall
|
||||
$(MAKE_INSTALL) progress.css $(DIST)\bin\res\xpinstall
|
||||
$(MAKE_INSTALL) progress.html $(DIST)\bin\res\xpinstall
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\res\xpinstall\progress.xul
|
||||
rm -f $(DIST)\res\xpinstall\progress.css
|
||||
rm -f $(DIST)\res\xpinstall\progress.html
|
||||
@@ -1,3 +0,0 @@
|
||||
TD {
|
||||
font: 10pt sans-serif;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<body bgcolor="#C0C0C0" style="overflow:visible; margin: 0px; color-background: rgb(192,192,192);">
|
||||
<center>
|
||||
<table BORDER COLS=5 WIDTH="99%" style="color-background:rgb(192,192,192);">
|
||||
<tr>
|
||||
<td WIDTH="3%" NOWRAP style="border: 1px inset rgb(192,192,192);"> </td>
|
||||
<td WIDTH="3%" NOWRAP style="border: 1px inset rgb(192,192,192);"> </td>
|
||||
<td WIDTH="3%" NOWRAP style="border: 1px inset rgb(192,192,192);"> </td>
|
||||
<td WIDTH="10%" NOWRAP style="border: 1px inset rgb(192,192,192);"> </td>
|
||||
<td WIDTH="81%" NOWRAP style="border: 1px inset rgb(192,192,192);"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="../samples/xul.css" type="text/css"?>
|
||||
<?xml-stylesheet href="progress.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window
|
||||
[
|
||||
<!ENTITY downloadWindow.title "XPInstall Progress">
|
||||
<!ENTITY status "Status:">
|
||||
<!ENTITY cancelButtonTitle "Cancel">
|
||||
]
|
||||
>
|
||||
|
||||
<window xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="XPInstall Progress"
|
||||
width="425"
|
||||
height="225">
|
||||
|
||||
<data>
|
||||
<broadcaster id="data.canceled" type="string" value="false"/>
|
||||
</data>
|
||||
|
||||
|
||||
<html:script>
|
||||
|
||||
function cancelInstall()
|
||||
{
|
||||
var cancelData = document.getElementById("data.canceled");
|
||||
cancelData.setAttribute( "value", "true");
|
||||
}
|
||||
|
||||
</html:script>
|
||||
|
||||
<html:center>
|
||||
<html:table style="width:100%;">
|
||||
|
||||
<html:tr>
|
||||
<html:td align="center">
|
||||
<html:input id="dialog.uiPackageName" readonly="" style="background-color:lightgray;width:300px;"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
|
||||
<html:tr>
|
||||
<html:td nowrap="" style="border: 1px rgb(192,192,192);" align="center">
|
||||
<html:input id="dialog.currentAction" readonly="" style="background-color:lightgray;width:450px;"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
|
||||
|
||||
<html:tr>
|
||||
<html:td align="center" width="15%" nowrap="" style="border: 1px rgb(192,192,192);">
|
||||
<progressmeter id="dialog.progress" mode="undetermined" style="width:300px;height:16px;">
|
||||
</progressmeter>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
|
||||
<html:tr>
|
||||
<html:td align="center" width="3%" nowrap="" style="border: 1px rgb(192,192,192);">
|
||||
<html:button onclick="cancelInstall()" height="12">
|
||||
&cancelButtonTitle;
|
||||
</html:button>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
|
||||
</html:center>
|
||||
</window>
|
||||
@@ -45,7 +45,6 @@ LINCS= \
|
||||
-I$(PUBLIC)\netlib \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\pref \
|
||||
-I$(PUBLIC)\rdf \
|
||||
-I$(PUBLIC)\js \
|
||||
-I$(PUBLIC)\dom \
|
||||
-I$(PUBLIC)\raptor \
|
||||
@@ -59,6 +58,7 @@ LLIBS = \
|
||||
$(DIST)\lib\libreg32.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\xppref32.lib \
|
||||
$(DIST)\lib\js3250.lib \
|
||||
$(DIST)\lib\jsdombase_s.lib \
|
||||
$(DIST)\lib\jsdomevents_s.lib \
|
||||
@@ -95,7 +95,6 @@ OBJS = \
|
||||
.\$(OBJDIR)\nsWinProfile.obj \
|
||||
.\$(OBJDIR)\nsJSWinProfile.obj \
|
||||
.\$(OBJDIR)\nsWinProfileItem.obj \
|
||||
.\$(OBJDIR)\nsInstallProgressDialog.obj \
|
||||
.\$(OBJDIR)\nsInstallFileOpItem.obj \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -38,11 +38,12 @@
|
||||
#include "nsFileStream.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "prtime.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include "pratom.h"
|
||||
#include "prefapi.h"
|
||||
#include "VerReg.h"
|
||||
|
||||
#include "zipfile.h"
|
||||
|
||||
#include "nsInstall.h"
|
||||
@@ -62,10 +63,6 @@
|
||||
#include "nsInstallFileOpEnums.h"
|
||||
#include "nsInstallFileOpItem.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include "Gestalt.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
#define FILESEP "\\"
|
||||
#elif defined(XP_MAC)
|
||||
@@ -156,7 +153,7 @@ nsInstallInfo::GetArguments(nsString& args, PRUint32 index)
|
||||
{
|
||||
nsString aURL = GetFromURL(index);
|
||||
|
||||
PRInt32 result = aURL.RFind("?");
|
||||
PRInt32 result = aURL.RFind('?');
|
||||
if (result != -1)
|
||||
{
|
||||
aURL.Right(args, (aURL.Length() - result - 1) );
|
||||
@@ -717,25 +714,6 @@ PRInt32
|
||||
nsInstall::Gestalt(const nsString& aSelector, PRInt32* aReturn)
|
||||
{
|
||||
*aReturn = nsnull;
|
||||
|
||||
#ifdef XP_MAC
|
||||
|
||||
long response = 0;
|
||||
|
||||
if (aSelector == "")
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
char selector[4];
|
||||
|
||||
aSelector.ToCString((char*)&selector,4);
|
||||
|
||||
Gestalt(selector, (int*)&response);
|
||||
|
||||
*aReturn = response;
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1452,35 +1430,21 @@ nsInstall::GetQualifiedRegName(const nsString& name, nsString& qualifiedRegName
|
||||
}
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kPrefsIID, NS_IPREF_IID);
|
||||
static NS_DEFINE_IID(kPrefsCID, NS_PREF_CID);
|
||||
|
||||
void
|
||||
nsInstall::CurrentUserNode(nsString& userRegNode)
|
||||
{
|
||||
char *profname;
|
||||
int len = MAXREGNAMELEN;
|
||||
nsIPref * prefs;
|
||||
|
||||
nsresult rv = nsServiceManager::GetService(kPrefsCID,
|
||||
kPrefsIID,
|
||||
(nsISupports**) &prefs);
|
||||
int err;
|
||||
|
||||
profname = (char*) PR_Malloc(len);
|
||||
|
||||
if ( NS_SUCCEEDED(rv) )
|
||||
{
|
||||
rv = prefs->CopyCharPref("profile.name", &profname);
|
||||
|
||||
if ( NS_FAILED(rv) )
|
||||
{
|
||||
PR_FREEIF(profname); // Allocated by PREF_CopyCharPref
|
||||
profname = NULL;
|
||||
}
|
||||
|
||||
NS_RELEASE(prefs);
|
||||
}
|
||||
else
|
||||
err = PREF_GetCharPref( "profile.name", profname, &len );
|
||||
|
||||
if ( err != PREF_OK )
|
||||
{
|
||||
PR_FREEIF(profname);
|
||||
profname = NULL;
|
||||
}
|
||||
|
||||
@@ -1621,7 +1585,7 @@ nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsFileSpec* aSuggestedNa
|
||||
|
||||
// Get the extention of the file in the jar.
|
||||
|
||||
PRInt32 result = aJarfile.RFind(".");
|
||||
PRInt32 result = aJarfile.RFind('.');
|
||||
if (result != -1)
|
||||
{
|
||||
// We found an extention. Add it to the tempfileName string
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "nsInstallObject.h"
|
||||
#include "nsInstallVersion.h"
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsIXPInstallProgressNotifier.h"
|
||||
|
||||
|
||||
class nsInstallInfo
|
||||
@@ -235,7 +235,7 @@ class nsInstall
|
||||
nsVector* mInstalledFiles;
|
||||
nsHashtable* mPatchList;
|
||||
|
||||
nsIXPInstallProgress *mNotifier;
|
||||
nsIXPInstallProgressNotifier *mNotifier;
|
||||
|
||||
PRInt32 mLastError;
|
||||
|
||||
|
||||
@@ -1,343 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsInstallProgressDialog.h"
|
||||
|
||||
#include "nsIAppShellComponentImpl.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsINetService.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID( kAppShellServiceCID, NS_APPSHELL_SERVICE_CID );
|
||||
static NS_DEFINE_IID( kNetServiceCID, NS_NETSERVICE_CID );
|
||||
|
||||
// Utility to set element attribute.
|
||||
static nsresult setAttribute( nsIDOMXULDocument *doc,
|
||||
const char *id,
|
||||
const char *name,
|
||||
const nsString &value ) {
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if ( doc ) {
|
||||
// Find specified element.
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = doc->GetElementById( id, getter_AddRefs( elem ) );
|
||||
if ( elem ) {
|
||||
// Set the text attribute.
|
||||
rv = elem->SetAttribute( name, value );
|
||||
if ( NS_SUCCEEDED( rv ) ) {
|
||||
} else {
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: SetAttribute failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
} else {
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: GetElementById failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// Utility to get element attribute.
|
||||
static nsresult getAttribute( nsIDOMXULDocument *doc,
|
||||
const char *id,
|
||||
const char *name,
|
||||
nsString &value ) {
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if ( doc ) {
|
||||
// Find specified element.
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = doc->GetElementById( id, getter_AddRefs( elem ) );
|
||||
if ( elem ) {
|
||||
// Set the text attribute.
|
||||
rv = elem->GetAttribute( name, value );
|
||||
if ( NS_SUCCEEDED( rv ) ) {
|
||||
} else {
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: SetAttribute failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
} else {
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: GetElementById failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsInstallProgressDialog::nsInstallProgressDialog()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mWindow = nsnull;
|
||||
mDocument = nsnull;
|
||||
|
||||
}
|
||||
|
||||
nsInstallProgressDialog::~nsInstallProgressDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF( nsInstallProgressDialog );
|
||||
NS_IMPL_RELEASE( nsInstallProgressDialog );
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
{
|
||||
if (aInstancePtr == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(nsIXPInstallProgress::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsInstallProgressDialog*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsIXULWindowCallbacks::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIXULWindowCallbacks*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (nsISupports*)((nsIXPInstallProgress*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::BeforeJavascriptEvaluation()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Get app shell service.
|
||||
nsIAppShellService *appShell;
|
||||
rv = nsServiceManager::GetService( kAppShellServiceCID,
|
||||
nsIAppShellService::GetIID(),
|
||||
(nsISupports**)&appShell );
|
||||
|
||||
if ( NS_SUCCEEDED( rv ) )
|
||||
{
|
||||
// Open "progress" dialog.
|
||||
nsIURL *url;
|
||||
rv = NS_NewURL( &url, "resource:/res/xpinstall/progress.xul" );
|
||||
|
||||
if ( NS_SUCCEEDED(rv) )
|
||||
{
|
||||
|
||||
nsIWebShellWindow *newWindow;
|
||||
|
||||
rv = appShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
newWindow,
|
||||
nsnull,
|
||||
this, // callbacks??
|
||||
0,
|
||||
0 );
|
||||
|
||||
if ( NS_SUCCEEDED( rv ) )
|
||||
{
|
||||
mWindow = newWindow;
|
||||
NS_RELEASE( newWindow );
|
||||
|
||||
if (mWindow != nsnull)
|
||||
mWindow->Show(PR_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_PRINTF( PR_STDOUT, "Error creating progress dialog, rv=0x%X\n", (int)rv );
|
||||
}
|
||||
NS_RELEASE( url );
|
||||
}
|
||||
|
||||
nsServiceManager::ReleaseService( kAppShellServiceCID, appShell );
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_PRINTF( PR_STDOUT, "Unable to get app shell service, rv=0x%X\n", (int)rv );
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::AfterJavascriptEvaluation()
|
||||
{
|
||||
if (mWindow)
|
||||
{
|
||||
mWindow->Close();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::InstallStarted(const char *UIPackageName)
|
||||
{
|
||||
setAttribute( mDocument, "dialog.uiPackageName", "value", nsString(UIPackageName) );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::ItemScheduled(const char *message)
|
||||
{
|
||||
PRInt32 maxChars = 40;
|
||||
|
||||
nsString theMessage(message);
|
||||
PRInt32 len = theMessage.Length();
|
||||
if (len > maxChars)
|
||||
{
|
||||
PRInt32 offset = (len/2) - ((len - maxChars)/2);
|
||||
PRInt32 count = (len - maxChars);
|
||||
theMessage.Cut(offset, count);
|
||||
theMessage.Insert(nsString("..."), offset);
|
||||
}
|
||||
setAttribute( mDocument, "dialog.currentAction", "value", theMessage );
|
||||
|
||||
nsString aValue;
|
||||
getAttribute( mDocument, "data.canceled", "value", aValue );
|
||||
|
||||
if (aValue.EqualsIgnoreCase("true"))
|
||||
return -1;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::InstallFinalization(const char *message, PRInt32 itemNum, PRInt32 totNum)
|
||||
{
|
||||
|
||||
PRInt32 maxChars = 40;
|
||||
|
||||
nsString theMessage(message);
|
||||
PRInt32 len = theMessage.Length();
|
||||
if (len > maxChars)
|
||||
{
|
||||
PRInt32 offset = (len/2) - ((len - maxChars)/2);
|
||||
PRInt32 count = (len - maxChars);
|
||||
theMessage.Cut(offset, count);
|
||||
theMessage.Insert(nsString("..."), offset);
|
||||
}
|
||||
|
||||
setAttribute( mDocument, "dialog.currentAction", "value", theMessage );
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
char buf[16];
|
||||
|
||||
PR_snprintf( buf, sizeof buf, "%lu", totNum );
|
||||
setAttribute( mDocument, "dialog.progress", "max", buf );
|
||||
|
||||
if (totNum != 0)
|
||||
{
|
||||
PR_snprintf( buf, sizeof buf, "%lu", ((totNum-itemNum)/totNum) );
|
||||
}
|
||||
else
|
||||
{
|
||||
PR_snprintf( buf, sizeof buf, "%lu", 0 );
|
||||
}
|
||||
setAttribute( mDocument, "dialog.progress", "value", buf );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::InstallAborted()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Do startup stuff from C++ side.
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::ConstructBeforeJavaScript(nsIWebShell *aWebShell)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Get content viewer from the web shell.
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
rv = aWebShell ? aWebShell->GetContentViewer(getter_AddRefs(contentViewer))
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
|
||||
if ( contentViewer ) {
|
||||
// Up-cast to a document viewer.
|
||||
nsCOMPtr<nsIDocumentViewer> docViewer( do_QueryInterface( contentViewer, &rv ) );
|
||||
if ( docViewer ) {
|
||||
// Get the document from the doc viewer.
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
rv = docViewer->GetDocument(*getter_AddRefs(document));
|
||||
if ( document ) {
|
||||
// Upcast to XUL document.
|
||||
mDocument = do_QueryInterface( document, &rv );
|
||||
if ( ! mDocument )
|
||||
{
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: Upcast to nsIDOMXULDocument failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: GetDocument failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: Upcast to nsIDocumentViewer failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_PRINTF( PR_STDOUT, "%s %d: GetContentViewer failed, rv=0x%X\n",
|
||||
__FILE__, (int)__LINE__, (int)rv );
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
#ifndef __nsInstallProgressDialog_h__
|
||||
#define __nsInstallProgressDialog_h__
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIXULWindowCallbacks.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
|
||||
|
||||
class nsInstallProgressDialog : public nsIXPInstallProgress, public nsIXULWindowCallbacks
|
||||
{
|
||||
public:
|
||||
|
||||
nsInstallProgressDialog();
|
||||
virtual ~nsInstallProgressDialog();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
NS_IMETHOD BeforeJavascriptEvaluation();
|
||||
NS_IMETHOD AfterJavascriptEvaluation();
|
||||
NS_IMETHOD InstallStarted(const char *UIPackageName);
|
||||
NS_IMETHOD ItemScheduled(const char *message);
|
||||
NS_IMETHOD InstallFinalization(const char *message, PRInt32 itemNum, PRInt32 totNum);
|
||||
NS_IMETHOD InstallAborted();
|
||||
|
||||
// Declare implementations of nsIXULWindowCallbacks interface functions.
|
||||
NS_IMETHOD ConstructBeforeJavaScript(nsIWebShell *aWebShell);
|
||||
NS_IMETHOD ConstructAfterJavaScript(nsIWebShell *aWebShell) { return NS_OK; }
|
||||
|
||||
private:
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> mDocument;
|
||||
nsCOMPtr<nsIWebShellWindow> mWindow;
|
||||
};
|
||||
#endif
|
||||
@@ -27,10 +27,8 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "nsRepository.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "pratom.h"
|
||||
#include "prefapi.h"
|
||||
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
|
||||
@@ -39,7 +37,6 @@ static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIInstallTrigger_IID, NS_IDOMINSTALLTRIGGERGLOBAL_IID);
|
||||
static NS_DEFINE_IID(kIInstallTrigger_CID, NS_SoftwareUpdateInstallTrigger_CID);
|
||||
|
||||
|
||||
|
||||
@@ -124,37 +121,11 @@ nsInstallTrigger::SetScriptObject(void *aScriptObject)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kPrefsIID, NS_IPREF_IID);
|
||||
static NS_DEFINE_IID(kPrefsCID, NS_PREF_CID);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallTrigger::UpdateEnabled(PRBool* aReturn)
|
||||
{
|
||||
nsIPref * prefs;
|
||||
|
||||
nsresult rv = nsServiceManager::GetService(kPrefsCID,
|
||||
kPrefsIID,
|
||||
(nsISupports**) &prefs);
|
||||
|
||||
|
||||
if ( NS_SUCCEEDED(rv) )
|
||||
{
|
||||
rv = prefs->GetBoolPref( (const char*) AUTOUPDATE_ENABLE_PREF, aReturn);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
*aReturn = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_RELEASE(prefs);
|
||||
}
|
||||
else
|
||||
{
|
||||
*aReturn = PR_FALSE; /* no prefs manager. set to false */
|
||||
}
|
||||
|
||||
//FIX!!!!!!!!!!
|
||||
*aReturn = PR_TRUE;
|
||||
PREF_GetBoolPref( (const char*) AUTOUPDATE_ENABLE_PREF, aReturn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -256,14 +227,14 @@ nsInstallTrigger::CreateTempFileFromURL(const nsString& aURL, nsString& tempFile
|
||||
{
|
||||
nsSpecialSystemDirectory tempFile(nsSpecialSystemDirectory::OS_TemporaryDirectory);
|
||||
|
||||
PRInt32 result = aURL.RFind("/");
|
||||
PRInt32 result = aURL.RFind('/');
|
||||
if (result != -1)
|
||||
{
|
||||
nsString jarName;
|
||||
|
||||
aURL.Right(jarName, (aURL.Length() - result) );
|
||||
|
||||
PRInt32 argOffset = jarName.RFind("?");
|
||||
PRInt32 argOffset = jarName.RFind('?');
|
||||
|
||||
if (argOffset != -1)
|
||||
{
|
||||
@@ -289,71 +260,101 @@ nsInstallTrigger::CreateTempFileFromURL(const nsString& aURL, nsString& tempFile
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
static PRInt32 gInstallTriggerInstanceCnt = 0;
|
||||
static PRInt32 gInstallTriggerLock = 0;
|
||||
|
||||
nsInstallTriggerFactory::nsInstallTriggerFactory(void)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mRefCnt=0;
|
||||
PR_AtomicIncrement(&gInstallTriggerInstanceCnt);
|
||||
}
|
||||
|
||||
nsInstallTriggerFactory::~nsInstallTriggerFactory(void)
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
PR_AtomicDecrement(&gInstallTriggerInstanceCnt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallTriggerFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
NS_IMETHODIMP
|
||||
nsInstallTriggerFactory::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
{
|
||||
if (! aResult)
|
||||
if (aInstancePtr == NULL)
|
||||
{
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
// Always NULL result, in case of failure
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if ( aIID.Equals(kISupportsIID) )
|
||||
{
|
||||
*aInstancePtr = (void*) this;
|
||||
}
|
||||
else if ( aIID.Equals(kIFactoryIID) )
|
||||
{
|
||||
*aInstancePtr = (void*) this;
|
||||
}
|
||||
|
||||
if (aInstancePtr == NULL)
|
||||
{
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsInstallTriggerFactory);
|
||||
NS_IMPL_RELEASE(nsInstallTriggerFactory);
|
||||
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsInstallTriggerFactory::AddRef(void)
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsInstallTriggerFactory::Release(void)
|
||||
{
|
||||
if (--mRefCnt ==0)
|
||||
{
|
||||
delete this;
|
||||
return 0; // Don't access mRefCnt after deleting!
|
||||
}
|
||||
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallTriggerFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
if (aResult == NULL)
|
||||
{
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
*aResult = NULL;
|
||||
|
||||
/* do I have to use iSupports? */
|
||||
nsInstallTrigger *inst = new nsInstallTrigger();
|
||||
|
||||
if (! inst)
|
||||
|
||||
if (inst == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult)))
|
||||
{
|
||||
// We didn't get the right interface.
|
||||
NS_ERROR("didn't support the interface you wanted");
|
||||
}
|
||||
return rv;
|
||||
nsresult result = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
delete inst;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallTriggerFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
if (aLock)
|
||||
PR_AtomicIncrement(&gInstallTriggerLock);
|
||||
else
|
||||
PR_AtomicDecrement(&gInstallTriggerLock);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "pratom.h"
|
||||
#include "prprf.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
@@ -333,40 +334,69 @@ nsInstallVersion::StringToVersionNumbers(const nsString& version, PRInt32 *aMajo
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
static PRInt32 gInstallVersionInstanceCnt = 0;
|
||||
static PRInt32 gInstallVersionLock = 0;
|
||||
|
||||
nsInstallVersionFactory::nsInstallVersionFactory(void)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mRefCnt=0;
|
||||
PR_AtomicIncrement(&gInstallVersionInstanceCnt);
|
||||
}
|
||||
|
||||
nsInstallVersionFactory::~nsInstallVersionFactory(void)
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
PR_AtomicDecrement(&gInstallVersionInstanceCnt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallVersionFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
NS_IMETHODIMP
|
||||
nsInstallVersionFactory::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
{
|
||||
if (! aResult)
|
||||
if (aInstancePtr == NULL)
|
||||
{
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
if ( aIID.Equals(kISupportsIID) )
|
||||
{
|
||||
*aInstancePtr = (void*) this;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
else if ( aIID.Equals(kIFactoryIID) )
|
||||
{
|
||||
*aInstancePtr = (void*) this;
|
||||
}
|
||||
|
||||
if (aInstancePtr == NULL)
|
||||
{
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsInstallVersionFactory);
|
||||
NS_IMPL_RELEASE(nsInstallVersionFactory);
|
||||
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsInstallVersionFactory::AddRef(void)
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsInstallVersionFactory::Release(void)
|
||||
{
|
||||
if (--mRefCnt ==0)
|
||||
{
|
||||
delete this;
|
||||
return 0; // Don't access mRefCnt after deleting!
|
||||
}
|
||||
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallVersionFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
@@ -395,5 +425,10 @@ nsInstallVersionFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void
|
||||
NS_IMETHODIMP
|
||||
nsInstallVersionFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK;
|
||||
if (aLock)
|
||||
PR_AtomicIncrement(&gInstallVersionLock);
|
||||
else
|
||||
PR_AtomicDecrement(&gInstallVersionLock);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsIXPInstallProgressNotifier.h"
|
||||
#include "nsLoggingProgressNotifier.h"
|
||||
|
||||
#include "nsFileSpec.h"
|
||||
@@ -35,28 +35,24 @@
|
||||
|
||||
nsLoggingProgressNotifier::nsLoggingProgressNotifier()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsLoggingProgressNotifier::~nsLoggingProgressNotifier()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsLoggingProgressNotifier, nsIXPInstallProgress::GetIID());
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressNotifier::BeforeJavascriptEvaluation()
|
||||
void
|
||||
nsLoggingProgressNotifier::BeforeJavascriptEvaluation(void)
|
||||
{
|
||||
nsSpecialSystemDirectory logFile(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
logFile += "Install.log";
|
||||
|
||||
mLogStream = new nsOutputFileStream(logFile, PR_WRONLY | PR_CREATE_FILE | PR_APPEND, 0744 );
|
||||
mLogStream->seek(logFile.GetFileSize());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressNotifier::AfterJavascriptEvaluation()
|
||||
void
|
||||
nsLoggingProgressNotifier::AfterJavascriptEvaluation(void)
|
||||
{
|
||||
char* time;
|
||||
GetTime(&time);
|
||||
@@ -69,14 +65,12 @@ nsLoggingProgressNotifier::AfterJavascriptEvaluation()
|
||||
mLogStream->close();
|
||||
delete mLogStream;
|
||||
mLogStream = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsLoggingProgressNotifier::InstallStarted(const char* UIPackageName)
|
||||
{
|
||||
if (mLogStream == nsnull) return -1;
|
||||
if (mLogStream == nsnull) return;
|
||||
|
||||
char* time;
|
||||
GetTime(&time);
|
||||
@@ -90,28 +84,26 @@ nsLoggingProgressNotifier::InstallStarted(const char* UIPackageName)
|
||||
|
||||
|
||||
PL_strfree(time);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
long
|
||||
nsLoggingProgressNotifier::ItemScheduled(const char* message )
|
||||
{
|
||||
return NS_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressNotifier::InstallFinalization(const char* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
void
|
||||
nsLoggingProgressNotifier::InstallFinalization(const char* message, long itemNum, long totNum )
|
||||
{
|
||||
if (mLogStream == nsnull) return -1;
|
||||
if (mLogStream == nsnull) return;
|
||||
|
||||
*mLogStream << " Item [" << (itemNum+1) << "/" << totNum << "]\t" << message << nsEndl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressNotifier::InstallAborted()
|
||||
void
|
||||
nsLoggingProgressNotifier::InstallAborted(void)
|
||||
{
|
||||
if (mLogStream == nsnull) return -1;
|
||||
if (mLogStream == nsnull) return;
|
||||
|
||||
char* time;
|
||||
GetTime(&time);
|
||||
@@ -119,7 +111,6 @@ nsLoggingProgressNotifier::InstallAborted()
|
||||
*mLogStream << " Aborted Installation at " << time << nsEndl << nsEndl;
|
||||
|
||||
PL_strfree(time);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -27,25 +27,23 @@
|
||||
#ifndef nsLoggingProgressNotifier_H__
|
||||
#define nsLoggingProgressNotifier_H__
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsIXPInstallProgressNotifier.h"
|
||||
#include "nsFileStream.h"
|
||||
|
||||
|
||||
class nsLoggingProgressNotifier : public nsIXPInstallProgress
|
||||
class nsLoggingProgressNotifier : public nsIXPInstallProgressNotifier
|
||||
{
|
||||
public:
|
||||
|
||||
nsLoggingProgressNotifier();
|
||||
virtual ~nsLoggingProgressNotifier();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD BeforeJavascriptEvaluation();
|
||||
NS_IMETHOD AfterJavascriptEvaluation();
|
||||
NS_IMETHOD InstallStarted(const char* UIPackageName);
|
||||
NS_IMETHOD ItemScheduled(const char* message );
|
||||
NS_IMETHOD InstallFinalization(const char* message, PRInt32 itemNum, PRInt32 totNum );
|
||||
NS_IMETHOD InstallAborted();
|
||||
|
||||
void BeforeJavascriptEvaluation(void);
|
||||
void AfterJavascriptEvaluation(void);
|
||||
void InstallStarted(const char* UIPackageName);
|
||||
long ItemScheduled(const char* message );
|
||||
void InstallFinalization(const char* message, long itemNum, long totNum );
|
||||
void InstallAborted(void);
|
||||
|
||||
private:
|
||||
void GetTime(char** aString);
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsTopProgressNotifier.h"
|
||||
#include "nsLoggingProgressNotifier.h"
|
||||
#include "nsInstallProgressDialog.h"
|
||||
|
||||
#include "nsIAppShellComponent.h"
|
||||
#include "nsIRegistry.h"
|
||||
@@ -55,10 +54,6 @@
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsIScriptExternalNameSet.h"
|
||||
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsProxyObjectManager.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Globals
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -81,8 +76,8 @@ static NS_DEFINE_IID(kInstallTrigger_CID, NS_SoftwareUpdateInstallTrigger_CID);
|
||||
static NS_DEFINE_IID(kIInstallVersion_IID, NS_IDOMINSTALLVERSION_IID);
|
||||
static NS_DEFINE_IID(kInstallVersion_CID, NS_SoftwareUpdateInstallVersion_CID);
|
||||
|
||||
static NS_DEFINE_IID(kProxyObjectManagerIID, NS_IPROXYEVENT_MANAGER_IID);
|
||||
static NS_DEFINE_IID(kEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
|
||||
|
||||
|
||||
|
||||
nsSoftwareUpdate::nsSoftwareUpdate()
|
||||
@@ -119,7 +114,7 @@ nsSoftwareUpdate::nsSoftwareUpdate()
|
||||
NR_StartupRegistry(); /* startup the registry; if already started, this will essentially be a noop */
|
||||
|
||||
nsSpecialSystemDirectory appDir(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
VR_SetRegDirectory( appDir.GetNativePathCString() );
|
||||
VR_SetRegDirectory( nsNSPRPath(appDir) );
|
||||
|
||||
/***************************************/
|
||||
/* Stupid Hack to test js env*/
|
||||
@@ -153,56 +148,7 @@ nsSoftwareUpdate::nsSoftwareUpdate()
|
||||
|
||||
nsLoggingProgressNotifier *logger = new nsLoggingProgressNotifier();
|
||||
RegisterNotifier(logger);
|
||||
|
||||
nsIProxyObjectManager *manager;
|
||||
nsInstallProgressDialog *dialog = new nsInstallProgressDialog();
|
||||
nsInstallProgressDialog *proxy;
|
||||
nsISupports *dialogBase;
|
||||
|
||||
nsresult rv = dialog->QueryInterface(kISupportsIID, (void**)&dialogBase);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = nsServiceManager::GetService( NS_XPCOMPROXY_PROGID,
|
||||
kProxyObjectManagerIID,
|
||||
(nsISupports **)&manager);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// I am assuming that the thread that starts us up is the UI thread. this will/may break
|
||||
// I need to make a generic way of getting at the UI event queue.
|
||||
|
||||
nsIEventQueueService *eventQService;
|
||||
rv = nsServiceManager::GetService(NS_EVENTQUEUESERVICE_PROGID,
|
||||
kEventQueueServiceIID,
|
||||
(nsISupports **)&eventQService);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsIEventQueue *eventQ;
|
||||
eventQService->GetThreadEventQueue(PR_GetCurrentThread(), &eventQ);
|
||||
|
||||
PLEventQueue *plEventQ;
|
||||
eventQ->GetPLEventQueue(&plEventQ);
|
||||
|
||||
rv = manager->GetProxyObject(plEventQ, nsIXPInstallProgress::GetIID(), dialogBase, PROXY_SYNC, (void**)&proxy);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
RegisterNotifier(proxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dialog)
|
||||
dialog->Release();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nsSoftwareUpdate::~nsSoftwareUpdate()
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
@@ -292,7 +238,7 @@ nsSoftwareUpdate::Shutdown()
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::RegisterNotifier(nsIXPInstallProgress *notifier)
|
||||
nsSoftwareUpdate::RegisterNotifier(nsIXPInstallProgressNotifier *notifier)
|
||||
{
|
||||
// we are going to ignore the returned ID and enforce that once you
|
||||
// register a notifier, you can not remove it. This should at some
|
||||
@@ -304,7 +250,7 @@ nsSoftwareUpdate::RegisterNotifier(nsIXPInstallProgress *notifier)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::GetTopLevelNotifier(nsIXPInstallProgress **notifier)
|
||||
nsSoftwareUpdate::GetTopLevelNotifier(nsIXPInstallProgressNotifier **notifier)
|
||||
{
|
||||
*notifier = mTopLevelObserver;
|
||||
return NS_OK;
|
||||
|
||||
@@ -15,7 +15,7 @@ class nsInstallInfo;
|
||||
|
||||
#include "nsIScriptExternalNameSet.h"
|
||||
#include "nsIAppShellComponent.h"
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsIXPInstallProgressNotifier.h"
|
||||
#include "nsTopProgressNotifier.h"
|
||||
|
||||
class nsSoftwareUpdate: public nsIAppShellComponent, public nsISoftwareUpdate
|
||||
@@ -34,12 +34,12 @@ class nsSoftwareUpdate: public nsIAppShellComponent, public nsISoftwareUpdate
|
||||
const nsString& localFile,
|
||||
long flags);
|
||||
|
||||
NS_IMETHOD RegisterNotifier(nsIXPInstallProgress *notifier);
|
||||
NS_IMETHOD RegisterNotifier(nsIXPInstallProgressNotifier *notifier);
|
||||
|
||||
NS_IMETHOD InstallPending(void);
|
||||
|
||||
NS_IMETHOD InstallJarCallBack();
|
||||
NS_IMETHOD GetTopLevelNotifier(nsIXPInstallProgress **notifier);
|
||||
NS_IMETHOD GetTopLevelNotifier(nsIXPInstallProgressNotifier **notifier);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -295,7 +295,7 @@ extern "C" void RunInstallOnThread(void *data)
|
||||
kISoftwareUpdateIID,
|
||||
(nsISupports**)&softwareUpdate);
|
||||
|
||||
nsIXPInstallProgress *notifier;
|
||||
nsIXPInstallProgressNotifier *notifier;
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsIXPInstallProgressNotifier.h"
|
||||
#include "nsTopProgressNotifier.h"
|
||||
|
||||
nsTopProgressNotifier::nsTopProgressNotifier()
|
||||
@@ -37,7 +37,7 @@ nsTopProgressNotifier::~nsTopProgressNotifier()
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPInstallProgress* element = (nsIXPInstallProgress*)mNotifiers->Get(i);
|
||||
nsIXPInstallProgressNotifier* element = (nsIXPInstallProgressNotifier*)mNotifiers->Get(i);
|
||||
delete element;
|
||||
}
|
||||
|
||||
@@ -46,12 +46,8 @@ nsTopProgressNotifier::~nsTopProgressNotifier()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsTopProgressNotifier, nsIXPInstallProgress::GetIID());
|
||||
|
||||
|
||||
long
|
||||
nsTopProgressNotifier::RegisterNotifier(nsIXPInstallProgress * newNotifier)
|
||||
nsTopProgressNotifier::RegisterNotifier(nsIXPInstallProgressNotifier * newNotifier)
|
||||
{
|
||||
return mNotifiers->Add( newNotifier );
|
||||
}
|
||||
@@ -65,24 +61,22 @@ nsTopProgressNotifier::UnregisterNotifier(long id)
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressNotifier::BeforeJavascriptEvaluation()
|
||||
void
|
||||
nsTopProgressNotifier::BeforeJavascriptEvaluation(void)
|
||||
{
|
||||
if (mNotifiers)
|
||||
{
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPInstallProgress* element = (nsIXPInstallProgress*)mNotifiers->Get(i);
|
||||
nsIXPInstallProgressNotifier* element = (nsIXPInstallProgressNotifier*)mNotifiers->Get(i);
|
||||
if (element != NULL)
|
||||
element->BeforeJavascriptEvaluation();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsTopProgressNotifier::AfterJavascriptEvaluation(void)
|
||||
{
|
||||
if (mNotifiers)
|
||||
@@ -90,15 +84,14 @@ nsTopProgressNotifier::AfterJavascriptEvaluation(void)
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPInstallProgress* element = (nsIXPInstallProgress*)mNotifiers->Get(i);
|
||||
nsIXPInstallProgressNotifier* element = (nsIXPInstallProgressNotifier*)mNotifiers->Get(i);
|
||||
if (element != NULL)
|
||||
element->AfterJavascriptEvaluation();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsTopProgressNotifier::InstallStarted(const char* UIPackageName)
|
||||
{
|
||||
if (mNotifiers)
|
||||
@@ -106,15 +99,14 @@ nsTopProgressNotifier::InstallStarted(const char* UIPackageName)
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPInstallProgress* element = (nsIXPInstallProgress*)mNotifiers->Get(i);
|
||||
nsIXPInstallProgressNotifier* element = (nsIXPInstallProgressNotifier*)mNotifiers->Get(i);
|
||||
if (element != NULL)
|
||||
element->InstallStarted(UIPackageName);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
long
|
||||
nsTopProgressNotifier::ItemScheduled( const char* message )
|
||||
{
|
||||
long rv = 0;
|
||||
@@ -124,7 +116,7 @@ nsTopProgressNotifier::ItemScheduled( const char* message )
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPInstallProgress* element = (nsIXPInstallProgress*)mNotifiers->Get(i);
|
||||
nsIXPInstallProgressNotifier* element = (nsIXPInstallProgressNotifier*)mNotifiers->Get(i);
|
||||
if (element != NULL)
|
||||
if (element->ItemScheduled( message ) != 0)
|
||||
rv = -1;
|
||||
@@ -134,23 +126,22 @@ nsTopProgressNotifier::ItemScheduled( const char* message )
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressNotifier::InstallFinalization( const char* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
void
|
||||
nsTopProgressNotifier::InstallFinalization( const char* message, long itemNum, long totNum )
|
||||
{
|
||||
if (mNotifiers)
|
||||
{
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPInstallProgress* element = (nsIXPInstallProgress*)mNotifiers->Get(i);
|
||||
nsIXPInstallProgressNotifier* element = (nsIXPInstallProgressNotifier*)mNotifiers->Get(i);
|
||||
if (element != NULL)
|
||||
element->InstallFinalization( message, itemNum, totNum );
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsTopProgressNotifier::InstallAborted(void)
|
||||
{
|
||||
if (mNotifiers)
|
||||
@@ -158,12 +149,11 @@ nsTopProgressNotifier::InstallAborted(void)
|
||||
PRUint32 i=0;
|
||||
for (; i < mNotifiers->GetSize(); i++)
|
||||
{
|
||||
nsIXPInstallProgress* element = (nsIXPInstallProgress*)mNotifiers->Get(i);
|
||||
nsIXPInstallProgressNotifier* element = (nsIXPInstallProgressNotifier*)mNotifiers->Get(i);
|
||||
if (element != NULL)
|
||||
element->InstallAborted();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,29 +25,26 @@
|
||||
#ifndef nsTopProgressNotifier_h__
|
||||
#define nsTopProgressNotifier_h__
|
||||
|
||||
#include "nsIXPInstallProgress.h"
|
||||
#include "nsIXPInstallProgressNotifier.h"
|
||||
#include "nsVector.h"
|
||||
|
||||
|
||||
class nsTopProgressNotifier : public nsIXPInstallProgress
|
||||
class nsTopProgressNotifier : public nsIXPInstallProgressNotifier
|
||||
{
|
||||
public:
|
||||
|
||||
nsTopProgressNotifier();
|
||||
virtual ~nsTopProgressNotifier();
|
||||
|
||||
long RegisterNotifier(nsIXPInstallProgress * newNotifier);
|
||||
long RegisterNotifier(nsIXPInstallProgressNotifier * newNotifier);
|
||||
void UnregisterNotifier(long id);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
NS_IMETHOD BeforeJavascriptEvaluation();
|
||||
NS_IMETHOD AfterJavascriptEvaluation();
|
||||
NS_IMETHOD InstallStarted(const char* UIPackageName);
|
||||
NS_IMETHOD ItemScheduled(const char* message );
|
||||
NS_IMETHOD InstallFinalization(const char* message, PRInt32 itemNum, PRInt32 totNum );
|
||||
NS_IMETHOD InstallAborted();
|
||||
void BeforeJavascriptEvaluation(void);
|
||||
void AfterJavascriptEvaluation(void);
|
||||
void InstallStarted(const char* UIPackageName);
|
||||
long ItemScheduled(const char* message );
|
||||
void InstallFinalization(const char* message, long itemNum, long totNum );
|
||||
void InstallAborted(void);
|
||||
|
||||
private:
|
||||
nsVector *mNotifiers;
|
||||
|
||||
Reference in New Issue
Block a user