NS_IMETHODIMP CBrowserShellProgressListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus)
NS_IMETHODIMP CBrowserShellProgressListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus)
NS_IMETHODIMP CBrowserShellProgressListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus){    NS_ENSURE_TRUE(mpOwner, NS_ERROR_NULL_POINTER);    if (aStateFlags & STATE_START)    {        if (aStateFlags & STATE_IS_NETWORK)        {            MsgNetStartInfo startInfo(mpOwner);            mpOwner->BroadcastMessage(msg_OnNetStartChange, &startInfo);                        mLoading = true;                        // Init progress vars            mUseRealProgFlag = false;            mTotalRequests = 0;            mFinishedRequests = 0;        }        if (aStateFlags & STATE_IS_REQUEST)            mTotalRequests++;    }    else if (aStateFlags & STATE_STOP)    {        if (aStateFlags & STATE_IS_REQUEST)        {            mFinishedRequests += 1;                    if (!mUseRealProgFlag)            {                MsgOnProgressChangeInfo progInfo(mpOwner, mFinishedRequests, mTotalRequests);                    mpOwner->BroadcastMessage(msg_OnProgressChange, &progInfo);            }        }        if (aStateFlags & STATE_IS_NETWORK)        {            MsgNetStopInfo stopInfo(mpOwner);            mpOwner->BroadcastMessage(msg_OnNetStopChange, &stopInfo);            mLoading = false;        }    }    else if (aStateFlags & STATE_TRANSFERRING)    {        if (aStateFlags & STATE_IS_DOCUMENT)        {            nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));            NS_ENSURE_TRUE(channel, NS_ERROR_FAILURE);            nsCAutoString contentType;            channel->GetContentType(contentType);            if (contentType.Equals(NS_LITERAL_CSTRING("text/html")))                mUseRealProgFlag = true;        }                if (aStateFlags & STATE_IS_REQUEST)        {            if (!mUseRealProgFlag)            {                MsgOnProgressChangeInfo progInfo(mpOwner, mFinishedRequests, mTotalRequests);                    mpOwner->BroadcastMessage(msg_OnProgressChange, &progInfo);            }        }    }    return NS_OK;}