227796 - XPInstall InstallTrigger API changes - add a parameter to the install js object that supports an icon, also make the install FE parameterizable via a pref. r=bsmedberg, dveditz.
230768 - add the ability to make a window flash only a certain number of times in the taskbar. dom stuff r/sr=jst, widget changes r=danm, sr=bryner git-svn-id: svn://10.0.0.236/trunk@152640 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
6ac2a5a16b
commit
6494975f04
@ -51,6 +51,8 @@ interface nsIDOMChromeWindow : nsISupports
|
||||
|
||||
void getAttention();
|
||||
|
||||
void getAttentionWithCycleCount(in long aCycleCount);
|
||||
|
||||
void setCursor(in DOMString cursor);
|
||||
|
||||
void maximize();
|
||||
|
||||
@ -5759,12 +5759,18 @@ nsGlobalChromeWindow::Restore()
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalChromeWindow::GetAttention()
|
||||
{
|
||||
return GetAttentionWithCycleCount(-1);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalChromeWindow::GetAttentionWithCycleCount(PRInt32 aCycleCount)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
nsresult rv = GetMainWidget(getter_AddRefs(widget));
|
||||
|
||||
if (widget) {
|
||||
rv = widget->GetAttention();
|
||||
rv = widget->GetAttention(aCycleCount);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
@ -958,8 +958,11 @@ class nsIWidget : public nsISupports {
|
||||
* the Mac. The notification should be suppressed if the window is already
|
||||
* in the foreground and should be dismissed when the user brings this window
|
||||
* to the foreground.
|
||||
* @param aCycleCount Maximum number of times to animate the window per system
|
||||
* conventions. If set to -1, cycles indefinitely until
|
||||
* window is brought into the foreground.
|
||||
*/
|
||||
NS_IMETHOD GetAttention() = 0;
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount) = 0;
|
||||
|
||||
/**
|
||||
* Get the last user input event time in milliseconds. If there are any pending
|
||||
|
||||
@ -216,7 +216,7 @@ public:
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
||||
NS_IMETHOD SetTitle(const nsString& title);
|
||||
|
||||
NS_IMETHOD GetAttention();
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
|
||||
// nsIPluginWidget
|
||||
NS_IMETHOD GetPluginClipRect(nsRect& outClipRect, nsPoint& outOrigin, PRBool& outWidgetVisible);
|
||||
|
||||
@ -2027,7 +2027,7 @@ NS_IMETHODIMP nsChildView::SetTitle(const nsString& title)
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsChildView::GetAttention()
|
||||
NS_IMETHODIMP nsChildView::GetAttention(PRInt32 aCycleCount)
|
||||
{
|
||||
// Since the Mac doesn't consider each window a separate process this call functions
|
||||
// slightly different than on other platforms. We first check to see if we're the
|
||||
|
||||
@ -1320,7 +1320,7 @@ nsWindow::SetFocus(PRBool aRaise)
|
||||
// toplevel window has focus
|
||||
if (gRaiseWindows && aRaise && toplevel && top_mozarea &&
|
||||
(!GTK_WIDGET_HAS_FOCUS(top_mozarea) && !GTK_WIDGET_HAS_FOCUS(toplevel)))
|
||||
GetAttention();
|
||||
GetAttention(-1);
|
||||
|
||||
#ifdef DEBUG_FOCUS
|
||||
printf("top moz area is %p\n", NS_STATIC_CAST(void *, top_mozarea));
|
||||
@ -2830,7 +2830,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::GetAttention(void)
|
||||
NS_IMETHODIMP nsWindow::GetAttention(PRInt32 aCycleCount)
|
||||
{
|
||||
// get the next up moz area
|
||||
GtkWidget *top_mozarea = GetOwningWidget();
|
||||
|
||||
@ -113,7 +113,7 @@ public:
|
||||
NS_IMETHOD Enable (PRBool aState);
|
||||
NS_IMETHOD IsEnabled (PRBool *aState);
|
||||
NS_IMETHOD SetFocus(PRBool aRaise);
|
||||
NS_IMETHOD GetAttention(void);
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
NS_IMETHOD Destroy();
|
||||
void ResizeTransparencyBitmap(PRInt32 aNewWidth, PRInt32 aNewHeight);
|
||||
void ApplyTransparencyBitmap();
|
||||
|
||||
@ -577,7 +577,7 @@ nsWindow::SetFocus(PRBool aRaise)
|
||||
if (gRaiseWindows && aRaise && toplevelWidget &&
|
||||
!GTK_WIDGET_HAS_FOCUS(owningWidget) &&
|
||||
!GTK_WIDGET_HAS_FOCUS(toplevelWidget))
|
||||
GetAttention();
|
||||
GetAttention(-1);
|
||||
|
||||
nsWindow *owningWindow = get_window_for_gtk_widget(owningWidget);
|
||||
if (!owningWindow)
|
||||
@ -1125,7 +1125,7 @@ nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetAttention()
|
||||
nsWindow::GetAttention(PRInt32 aCycleCount)
|
||||
{
|
||||
LOG(("nsWindow::GetAttention [%p]\n", (void *)this));
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ public:
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
||||
PRBool aDoCapture,
|
||||
PRBool aConsumeRollupEvent);
|
||||
NS_IMETHOD GetAttention();
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
|
||||
|
||||
// utility methods
|
||||
|
||||
@ -2516,7 +2516,7 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsString& title)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::GetAttention()
|
||||
NS_IMETHODIMP nsWindow::GetAttention(PRInt32 aCycleCount)
|
||||
{
|
||||
// Since the Mac doesn't consider each window a separate process this call functions
|
||||
// slightly different than on other platforms. We first check to see if we're the
|
||||
|
||||
@ -200,7 +200,7 @@ public:
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
||||
NS_IMETHOD SetTitle(const nsString& title);
|
||||
|
||||
NS_IMETHOD GetAttention();
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
|
||||
// Mac specific methods
|
||||
static void nsRectToMacRect(const nsRect& aRect, Rect& aMacRect);
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
PRBool aDoCapture,
|
||||
PRBool aConsumeRollupEvent);
|
||||
|
||||
inline NS_IMETHOD GetAttention(void)
|
||||
inline NS_IMETHOD GetAttention(PRInt32 aCycleCount)
|
||||
{
|
||||
if( mWidget ) PtWindowToFront( mWidget );
|
||||
return NS_OK;
|
||||
|
||||
@ -553,7 +553,7 @@ public:
|
||||
delete current;
|
||||
}
|
||||
}
|
||||
void AddTimer(HWND timerWindow, HWND flashWindow, UINT timerID) {
|
||||
void AddTimer(HWND timerWindow, HWND flashWindow, PRInt32 maxFlashCount, UINT timerID) {
|
||||
TimerInfo *info;
|
||||
PRBool newInfo = PR_FALSE;
|
||||
info = FindInfo(timerWindow);
|
||||
@ -564,6 +564,8 @@ public:
|
||||
if (info) {
|
||||
info->timerWindow = timerWindow;
|
||||
info->flashWindow = flashWindow;
|
||||
info->maxFlashCount = maxFlashCount;
|
||||
info->flashCount = 0;
|
||||
info->timerID = timerID;
|
||||
info->hasFlashed = PR_FALSE;
|
||||
info->next = 0;
|
||||
@ -575,6 +577,18 @@ public:
|
||||
TimerInfo *info = FindInfo(timerWindow);
|
||||
return info ? info->flashWindow : 0;
|
||||
}
|
||||
PRInt32 GetMaxFlashCount(HWND timerWindow) {
|
||||
TimerInfo *info = FindInfo(timerWindow);
|
||||
return info ? info->maxFlashCount : -1;
|
||||
}
|
||||
PRInt32 GetFlashCount(HWND timerWindow) {
|
||||
TimerInfo *info = FindInfo(timerWindow);
|
||||
return info ? info->flashCount : -1;
|
||||
}
|
||||
void IncrementFlashCount(HWND timerWindow) {
|
||||
TimerInfo *info = FindInfo(timerWindow);
|
||||
++(info->flashCount);
|
||||
}
|
||||
void KillTimer(HWND timerWindow) {
|
||||
TimerInfo *info = FindInfo(timerWindow);
|
||||
if (info) {
|
||||
@ -597,6 +611,8 @@ private:
|
||||
HWND timerWindow,
|
||||
flashWindow;
|
||||
UINT timerID;
|
||||
PRInt32 maxFlashCount;
|
||||
PRInt32 flashCount;
|
||||
PRBool hasFlashed;
|
||||
TimerInfo *next;
|
||||
};
|
||||
@ -6696,7 +6712,22 @@ static VOID CALLBACK nsGetAttentionTimerFunc(HWND hwnd, UINT uMsg, UINT idEvent,
|
||||
// flash the outermost owner
|
||||
HWND flashwnd = gAttentionTimerMonitor->GetFlashWindowFor(hwnd);
|
||||
|
||||
::FlashWindow(flashwnd, TRUE);
|
||||
PRInt32 maxFlashCount = gAttentionTimerMonitor->GetMaxFlashCount(hwnd);
|
||||
PRInt32 flashCount = gAttentionTimerMonitor->GetFlashCount(hwnd);
|
||||
if (maxFlashCount > 0) {
|
||||
// We have a max flash count, if we haven't met it yet, flash again.
|
||||
if (flashCount < maxFlashCount) {
|
||||
::FlashWindow(flashwnd, TRUE);
|
||||
gAttentionTimerMonitor->IncrementFlashCount(hwnd);
|
||||
}
|
||||
else
|
||||
gAttentionTimerMonitor->KillTimer(hwnd);
|
||||
}
|
||||
else {
|
||||
// The caller didn't specify a flash count.
|
||||
::FlashWindow(flashwnd, TRUE);
|
||||
}
|
||||
|
||||
gAttentionTimerMonitor->SetFlashed(hwnd);
|
||||
}
|
||||
else
|
||||
@ -6705,12 +6736,16 @@ static VOID CALLBACK nsGetAttentionTimerFunc(HWND hwnd, UINT uMsg, UINT idEvent,
|
||||
|
||||
// Draw user's attention to this window until it comes to foreground.
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetAttention() {
|
||||
nsWindow::GetAttention(PRInt32 aCycleCount) {
|
||||
|
||||
// Got window?
|
||||
if (!mWnd)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// Don't flash if the flash count is 0.
|
||||
if (aCycleCount == 0)
|
||||
return NS_OK;
|
||||
|
||||
// timer is on the parentmost window; window to flash is its ownermost
|
||||
HWND nextwnd,
|
||||
flashwnd,
|
||||
@ -6727,7 +6762,7 @@ nsWindow::GetAttention() {
|
||||
if (!gAttentionTimerMonitor)
|
||||
gAttentionTimerMonitor = new nsAttentionTimerMonitor;
|
||||
if (gAttentionTimerMonitor) {
|
||||
gAttentionTimerMonitor->AddTimer(timerwnd, flashwnd, NS_FLASH_TIMER_ID);
|
||||
gAttentionTimerMonitor->AddTimer(timerwnd, flashwnd, aCycleCount, NS_FLASH_TIMER_ID);
|
||||
::SetTimer(timerwnd, NS_FLASH_TIMER_ID, GetCaretBlinkTime(), (TIMERPROC)nsGetAttentionTimerFunc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,7 +371,7 @@ public:
|
||||
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
||||
|
||||
NS_IMETHOD GetAttention();
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
NS_IMETHOD GetLastInputEventTime(PRUint32& aTime);
|
||||
|
||||
// nsIKBStateControl interface
|
||||
|
||||
@ -169,7 +169,7 @@ nsWindow::UpdateIdle (void *data)
|
||||
// Just raises the window.
|
||||
// There should probably be checks on this.
|
||||
// FIXME KenF
|
||||
NS_IMETHODIMP nsWindow::GetAttention(void)
|
||||
NS_IMETHODIMP nsWindow::GetAttention(PRInt32 aCycleCount)
|
||||
{
|
||||
XRaiseWindow(mDisplay, mBaseWindow);
|
||||
return NS_OK;
|
||||
|
||||
@ -115,7 +115,7 @@ class nsWindow : public nsWidget
|
||||
|
||||
NS_IMETHOD SetFocus(PRBool aRaise);
|
||||
virtual PRBool OnExpose(nsPaintEvent &event);
|
||||
NS_IMETHOD GetAttention(void);
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
|
||||
protected:
|
||||
virtual long GetEventMask();
|
||||
|
||||
@ -890,7 +890,7 @@ NS_METHOD nsBaseWidget::ModalEventFilter(PRBool aRealEvent, void *aEvent,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseWidget::GetAttention() {
|
||||
nsBaseWidget::GetAttention(PRInt32 aCycleCount) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ public:
|
||||
NS_IMETHOD ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy);
|
||||
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
|
||||
NS_IMETHOD EnableDragDrop(PRBool aEnable);
|
||||
NS_IMETHOD GetAttention();
|
||||
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
||||
NS_IMETHOD GetLastInputEventTime(PRUint32& aTime);
|
||||
NS_IMETHOD SetIcon(const nsAString &anIconSpec);
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||
|
||||
@ -159,6 +159,9 @@ pref("browser.editor.disabled", false);
|
||||
pref("spellchecker.dictionary", "");
|
||||
|
||||
pref("autoupdate.enabled", true);
|
||||
pref("xpinstall.dialog.confirm", "chrome://communicator/content/xpinstall/institems.xul");
|
||||
pref("xpinstall.dialog.progress", "chrome://communicator/content/xpinstall/xpistatus.xul");
|
||||
pref("xpinstall.dialog.progress.type", "");
|
||||
|
||||
// Customizable toolbar stuff
|
||||
pref("custtoolbar.personal_toolbar_folder", "");
|
||||
|
||||
@ -58,7 +58,7 @@ function addTreeItem(num, aName, aUrl, aCertName)
|
||||
function onLoad()
|
||||
{
|
||||
var row = 0;
|
||||
var moduleName, URL, certName, numberOfDialogTreeElements;
|
||||
var moduleName, URL, IconURL, certName, numberOfDialogTreeElements;
|
||||
|
||||
gBundle = document.getElementById("xpinstallBundle");
|
||||
gParam = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
@ -71,6 +71,7 @@ function onLoad()
|
||||
{
|
||||
moduleName = gParam.GetString(i);
|
||||
URL = gParam.GetString(++i);
|
||||
IconURL = gParam.GetString(++i); // Advance the enumeration, parameter is unused just now.
|
||||
certName = gParam.GetString(++i);
|
||||
|
||||
addTreeItem(row++, moduleName, URL, certName);
|
||||
|
||||
@ -122,6 +122,7 @@ function onLoad()
|
||||
{
|
||||
var moduleName = param.GetString(i++);
|
||||
var URL = param.GetString(i++);
|
||||
var IconURL = param.GetString(i++); // Advance the enumeration, parameter is unused just now.
|
||||
var certName = param.GetString(i++);
|
||||
addTreeItem(row++, moduleName, URL);
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ REQUIRES = xpcom \
|
||||
windowwatcher \
|
||||
plugin \
|
||||
unicharutil \
|
||||
appshell \
|
||||
$(ZLIB_REQUIRES) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@ -274,7 +274,7 @@ nsInstallTrigger::StartSoftwareUpdate(nsIScriptGlobalObject* aGlobalObject, cons
|
||||
nsXPITriggerInfo* trigger = new nsXPITriggerInfo();
|
||||
if ( trigger )
|
||||
{
|
||||
nsXPITriggerItem* item = new nsXPITriggerItem(0,aURL.get());
|
||||
nsXPITriggerItem* item = new nsXPITriggerItem(0,aURL.get(),nsnull);
|
||||
if (item)
|
||||
{
|
||||
trigger->Add( item );
|
||||
|
||||
@ -195,6 +195,7 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
||||
{
|
||||
jsval v;
|
||||
const PRUnichar *name, *URL;
|
||||
const PRUnichar *iconURL = nsnull;
|
||||
|
||||
for (int i = 0; i < ida->length; i++ )
|
||||
{
|
||||
@ -202,11 +203,24 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
||||
name = NS_REINTERPRET_CAST(const PRUnichar*, JS_GetStringChars( JS_ValueToString( cx, v ) ));
|
||||
|
||||
JS_GetUCProperty( cx, JSVAL_TO_OBJECT(argv[0]), NS_REINTERPRET_CAST(const jschar*, name), nsCRT::strlen(name), &v );
|
||||
if ( JSVAL_IS_OBJECT(v) )
|
||||
{
|
||||
|
||||
jsval v2;
|
||||
JS_GetProperty( cx, JSVAL_TO_OBJECT(v), "URL", &v2 );
|
||||
URL = NS_REINTERPRET_CAST(const PRUnichar*, JS_GetStringChars( JS_ValueToString( cx, v2 ) ));
|
||||
|
||||
JS_GetProperty( cx, JSVAL_TO_OBJECT(v), "IconURL", &v2 );
|
||||
iconURL = NS_REINTERPRET_CAST(const PRUnichar*, JS_GetStringChars( JS_ValueToString( cx, v2 ) ));
|
||||
}
|
||||
else
|
||||
{
|
||||
URL = NS_REINTERPRET_CAST(const PRUnichar*, JS_GetStringChars( JS_ValueToString( cx, v ) ));
|
||||
}
|
||||
|
||||
if ( name && URL )
|
||||
{
|
||||
nsXPITriggerItem *item = new nsXPITriggerItem( name, URL );
|
||||
nsXPITriggerItem *item = new nsXPITriggerItem( name, URL, iconURL );
|
||||
if ( item )
|
||||
{
|
||||
if ( item->IsRelativeURL() )
|
||||
@ -313,7 +327,8 @@ InstallTriggerGlobalInstallChrome(JSContext *cx, JSObject *obj, uintN argc, jsva
|
||||
{
|
||||
// there's at least one known chrome type
|
||||
nsXPITriggerItem* item = new nsXPITriggerItem(name.get(),
|
||||
sourceURL.get());
|
||||
sourceURL.get(),
|
||||
nsnull);
|
||||
|
||||
if (item && item->IsRelativeURL())
|
||||
item->mURL.Insert( baseURL, 0 );
|
||||
|
||||
@ -38,8 +38,9 @@ MOZ_DECL_CTOR_COUNTER(nsXPITriggerItem)
|
||||
|
||||
nsXPITriggerItem::nsXPITriggerItem( const PRUnichar* aName,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* aIconURL,
|
||||
PRInt32 aFlags)
|
||||
: mName(aName), mURL(aURL), mFlags(aFlags)
|
||||
: mName(aName), mURL(aURL), mIconURL(aIconURL), mFlags(aFlags)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsXPITriggerItem);
|
||||
|
||||
|
||||
@ -54,11 +54,12 @@ typedef struct XPITriggerEvent {
|
||||
class nsXPITriggerItem
|
||||
{
|
||||
public:
|
||||
nsXPITriggerItem( const PRUnichar* name, const PRUnichar* URL, PRInt32 flags = 0);
|
||||
nsXPITriggerItem( const PRUnichar* name, const PRUnichar* URL, const PRUnichar* iconURL, PRInt32 flags = 0);
|
||||
~nsXPITriggerItem();
|
||||
|
||||
nsString mName;
|
||||
nsString mURL;
|
||||
nsString mIconURL;
|
||||
nsString mArguments;
|
||||
nsString mCertName;
|
||||
PRInt32 mFlags;
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "nsInstallResources.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsDirectoryService.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
@ -60,6 +61,10 @@
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
#include "CertReader.h"
|
||||
|
||||
@ -68,6 +73,9 @@ static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
#define PREF_XPINSTALL_CONFIRM_DLG "xpinstall.dialog.confirm"
|
||||
#define PREF_XPINSTALL_STATUS_DLG "xpinstall.dialog.progress"
|
||||
#define PREF_XPINSTALL_STATUS_DLG_TYPE "xpinstall.dialog.progress.type"
|
||||
|
||||
#define UPDATE_DLG(x) (((x) - mLastUpdate) > 250000)
|
||||
|
||||
@ -91,11 +99,17 @@ nsXPInstallManager::nsXPInstallManager()
|
||||
|
||||
// initialize mLastUpdate to the current time
|
||||
mLastUpdate = PR_Now();
|
||||
|
||||
nsCOMPtr<nsIObserverService> os(do_GetService("@mozilla.org/observer-service;1"));
|
||||
os->AddObserver(this, XPI_PROGRESS_TOPIC, PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
nsXPInstallManager::~nsXPInstallManager()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> os(do_GetService("@mozilla.org/observer-service;1"));
|
||||
os->RemoveObserver(this, XPI_PROGRESS_TOPIC);
|
||||
|
||||
if (mTriggers)
|
||||
delete mTriggers;
|
||||
}
|
||||
@ -169,7 +183,7 @@ nsXPInstallManager::InitManagerInternal()
|
||||
|
||||
// --- prepare dialog params
|
||||
PRUint32 numTriggers = mTriggers->Size();
|
||||
PRUint32 numStrings = 3 * numTriggers;
|
||||
PRUint32 numStrings = 4 * numTriggers;
|
||||
const PRUnichar** packageList =
|
||||
(const PRUnichar**)malloc( sizeof(PRUnichar*) * numStrings );
|
||||
|
||||
@ -181,6 +195,7 @@ nsXPInstallManager::InitManagerInternal()
|
||||
nsXPITriggerItem *item = mTriggers->Get(i);
|
||||
packageList[j++] = item->mName.get();
|
||||
packageList[j++] = item->mURL.get();
|
||||
packageList[j++] = item->mIconURL.get();
|
||||
packageList[j++] = item->mCertName.get();
|
||||
}
|
||||
|
||||
@ -266,9 +281,18 @@ nsXPInstallManager::ConfirmInstall(nsIDOMWindow *aParent, const PRUnichar **aPac
|
||||
ifptr->SetData(params);
|
||||
ifptr->SetDataIID(&NS_GET_IID(nsIDialogParamBlock));
|
||||
|
||||
rv = parentWindow->OpenDialog(NS_LITERAL_STRING("chrome://communicator/content/xpinstall/institems.xul"),
|
||||
char* confirmDialogURL;
|
||||
nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (pref) {
|
||||
rv = pref->GetCharPref(PREF_XPINSTALL_CONFIRM_DLG, &confirmDialogURL);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't invoke XPInstall FE without a FE URL! Set xpinstall.dialog.confirm");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = parentWindow->OpenDialog(NS_ConvertASCIItoUCS2(confirmDialogURL),
|
||||
NS_LITERAL_STRING("_blank"),
|
||||
NS_LITERAL_STRING("chrome,centerscreen,modal,titlebar,resizable"),
|
||||
NS_LITERAL_STRING("chrome,centerscreen,modal,titlebar"),
|
||||
ifptr,
|
||||
getter_AddRefs(newWindow));
|
||||
|
||||
@ -377,9 +401,35 @@ nsXPInstallManager::OpenProgressDialog(const PRUnichar **aPackageList, PRUint32
|
||||
// --- open the window
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
|
||||
if (wwatch) {
|
||||
char *statusDialogURL, *statusDialogType;
|
||||
nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (pref) {
|
||||
rv = pref->GetCharPref(PREF_XPINSTALL_STATUS_DLG, &statusDialogURL);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't invoke XPInstall FE without a FE URL! Set xpinstall.dialog.status");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = pref->GetCharPref(PREF_XPINSTALL_STATUS_DLG_TYPE, &statusDialogType);
|
||||
nsAutoString type;
|
||||
type.AssignWithConversion(statusDialogType);
|
||||
if (NS_SUCCEEDED(rv) && !type.IsEmpty()) {
|
||||
nsCOMPtr<nsIWindowMediator> wm = do_GetService(NS_WINDOWMEDIATOR_CONTRACTID);
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> recentWindow;
|
||||
wm->GetMostRecentWindow(type.get(), getter_AddRefs(recentWindow));
|
||||
if (recentWindow) {
|
||||
nsCOMPtr<nsIObserverService> os(do_GetService("@mozilla.org/observer-service;1"));
|
||||
os->NotifyObservers(params, "xpinstall-download-started", nsnull);
|
||||
|
||||
recentWindow->Focus();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = wwatch->OpenWindow(0,
|
||||
"chrome://communicator/content/xpinstall/xpistatus.xul",
|
||||
statusDialogURL,
|
||||
"_blank",
|
||||
"chrome,centerscreen,titlebar,resizable",
|
||||
params,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user