mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
more fixes for progress meteors,r=mscott 38598
This commit is contained in:
parent
2daa56f319
commit
c5daa0bb05
@ -113,26 +113,28 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsresult aStatus)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aProgressStateFlags & flag_start)
|
||||
if (aProgressStateFlags & flag_is_network)
|
||||
{
|
||||
m_lastPercent = 0;
|
||||
StartMeteors();
|
||||
nsXPIDLString loadingDocument;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentLoading").GetUnicode(),
|
||||
getter_Copies(loadingDocument));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(loadingDocument);
|
||||
if (aProgressStateFlags & flag_start)
|
||||
{
|
||||
m_lastPercent = 0;
|
||||
StartMeteors();
|
||||
nsXPIDLString loadingDocument;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentLoading").GetUnicode(),
|
||||
getter_Copies(loadingDocument));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(loadingDocument);
|
||||
}
|
||||
else if (aProgressStateFlags & flag_stop)
|
||||
{
|
||||
StopMeteors();
|
||||
nsXPIDLString documentDone;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentDone").GetUnicode(),
|
||||
getter_Copies(documentDone));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(documentDone);
|
||||
}
|
||||
}
|
||||
else if (aProgressStateFlags & flag_stop)
|
||||
{
|
||||
StopMeteors();
|
||||
nsXPIDLString documentDone;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentDone").GetUnicode(),
|
||||
getter_Copies(documentDone));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(documentDone);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -181,8 +183,6 @@ nsMsgStatusFeedback::ShowProgress(PRInt32 percentage)
|
||||
|
||||
if (mStatusFeedback)
|
||||
mStatusFeedback->ShowProgress(percentage);
|
||||
if (mQueuedMeteorStarts <= 0)
|
||||
mQueuedMeteorStarts++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -299,7 +299,8 @@ nsMsgStatusFeedback::notifyStopMeteors(nsITimer *aTimer, void *aClosure)
|
||||
void
|
||||
nsMsgStatusFeedback::NotifyStartMeteors(nsITimer *aTimer)
|
||||
{
|
||||
mQueuedMeteorStarts--;
|
||||
if (mQueuedMeteorStarts > 0)
|
||||
mQueuedMeteorStarts--;
|
||||
|
||||
// meteors already spinning, so noop
|
||||
if (m_meteorsSpinning) return;
|
||||
@ -307,16 +308,17 @@ nsMsgStatusFeedback::NotifyStartMeteors(nsITimer *aTimer)
|
||||
// we'll be stopping them soon, don't bother starting.
|
||||
if (mQueuedMeteorStops > 0) return;
|
||||
|
||||
m_meteorsSpinning = PR_TRUE;
|
||||
// actually start the meteors
|
||||
if (mStatusFeedback)
|
||||
mStatusFeedback->StartMeteors();
|
||||
m_meteorsSpinning = PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nsMsgStatusFeedback::NotifyStopMeteors(nsITimer* aTimer)
|
||||
{
|
||||
mQueuedMeteorStops--;
|
||||
if (mQueuedMeteorStops > 0)
|
||||
mQueuedMeteorStops--;
|
||||
|
||||
// meteors not spinning
|
||||
if (!m_meteorsSpinning) return;
|
||||
|
@ -51,8 +51,8 @@ protected:
|
||||
PRInt32 m_lastPercent;
|
||||
PRInt64 m_lastProgressTime;
|
||||
|
||||
PRBool mQueuedMeteorStarts;
|
||||
PRBool mQueuedMeteorStops;
|
||||
PRInt32 mQueuedMeteorStarts;
|
||||
PRInt32 mQueuedMeteorStops;
|
||||
nsCOMPtr<nsITimer> mStartTimer;
|
||||
nsCOMPtr<nsITimer> mStopTimer;
|
||||
|
||||
|
@ -30,6 +30,9 @@
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
static NS_DEFINE_CID(kUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
@ -81,6 +84,17 @@ nsresult nsMsgMailNewsUrl::SetUrlState(PRBool aRunningUrl, nsresult aExitCode)
|
||||
m_runningUrl = aRunningUrl;
|
||||
nsCOMPtr <nsIMsgStatusFeedback> statusFeedback;
|
||||
|
||||
// put this back - we need it for urls that don't run through the doc loader
|
||||
if (NS_SUCCEEDED(GetStatusFeedback(getter_AddRefs(statusFeedback))) && statusFeedback)
|
||||
{
|
||||
if (m_runningUrl)
|
||||
statusFeedback->StartMeteors();
|
||||
else
|
||||
{
|
||||
statusFeedback->ShowProgress(0);
|
||||
statusFeedback->StopMeteors();
|
||||
}
|
||||
}
|
||||
if (m_urlListeners)
|
||||
{
|
||||
if (m_runningUrl)
|
||||
@ -231,6 +245,29 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetLoadGroup(nsILoadGroup **aLoadGroup)
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
m_msgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
|
||||
|
||||
#if 0 // since we're not going through the doc loader for most mail/news urls,
|
||||
//, this code isn't useful
|
||||
// but I can imagine it could be useful at some point.
|
||||
|
||||
// load group needs status feedback set, since it's
|
||||
// not the main window load group.
|
||||
nsCOMPtr<nsIMsgStatusFeedback> statusFeedback;
|
||||
m_msgWindow->GetStatusFeedback(getter_AddRefs(statusFeedback));
|
||||
|
||||
if (statusFeedback)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(docShell));
|
||||
nsCOMPtr<nsIWebProgressListener> webProgressListener(do_QueryInterface(statusFeedback));
|
||||
|
||||
// register our status feedback object
|
||||
if (statusFeedback && docShell)
|
||||
{
|
||||
webProgressListener = do_QueryInterface(statusFeedback);
|
||||
webProgress->AddProgressListener(webProgressListener);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (webShell)
|
||||
{
|
||||
nsCOMPtr <nsIDocumentLoader> docLoader;
|
||||
|
Loading…
x
Reference in New Issue
Block a user