Bug 704691 - Fire STATE_IS_NETWORK notifications with print status so that the download manager can track "Save as PDF" prints. r=bz
☠☠ backed out by af3ceb7d6902 ☠ ☠
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 28 Nov 2011 13:43:33 -0800
changeset 82539 af0a7f54f4830fc493bb34197bff4c1641799369
parent 82538 9541ced017f75264955fd69f1f0c61cf3b49ab06
child 82540 af3ceb7d6902100b215620fa813d447d197f3f76
push idunknown
push userunknown
push dateunknown
reviewersbz
bugs704691
milestone11.0a1
Bug 704691 - Fire STATE_IS_NETWORK notifications with print status so that the download manager can track "Save as PDF" prints. r=bz
layout/printing/nsPrintData.cpp
layout/printing/nsPrintData.h
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -129,35 +129,34 @@ nsPrintData::~nsPrintData()
   if (mBrandName) {
     NS_Free(mBrandName);
   }
 }
 
 void nsPrintData::OnStartPrinting()
 {
   if (!mOnStartSent) {
-    DoOnProgressChange(0, 0, true, nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT);
+    DoOnProgressChange(0, 0, true, nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT|nsIWebProgressListener::STATE_IS_NETWORK);
     mOnStartSent = true;
   }
 }
 
 void nsPrintData::OnEndPrinting()
 {
   DoOnProgressChange(100, 100, true, nsIWebProgressListener::STATE_STOP|nsIWebProgressListener::STATE_IS_DOCUMENT);
+  DoOnProgressChange(100, 100, true, nsIWebProgressListener::STATE_STOP|nsIWebProgressListener::STATE_IS_NETWORK);
 }
 
 void
-nsPrintData::DoOnProgressChange(PRInt32      aProgess,
+nsPrintData::DoOnProgressChange(PRInt32      aProgress,
                                 PRInt32      aMaxProgress,
                                 bool         aDoStartStop,
                                 PRInt32      aFlag)
 {
-  if (aProgess == 0) return;
-
   for (PRInt32 i=0;i<mPrintProgressListeners.Count();i++) {
     nsIWebProgressListener* wpl = mPrintProgressListeners.ObjectAt(i);
-    wpl->OnProgressChange(nsnull, nsnull, aProgess, aMaxProgress, aProgess, aMaxProgress);
+    wpl->OnProgressChange(nsnull, nsnull, aProgress, aMaxProgress, aProgress, aMaxProgress);
     if (aDoStartStop) {
       wpl->OnStateChange(nsnull, nsnull, aFlag, 0);
     }
   }
 }
 
--- a/layout/printing/nsPrintData.h
+++ b/layout/printing/nsPrintData.h
@@ -80,17 +80,17 @@ public:
 
 
   nsPrintData(ePrintDataType aType);
   ~nsPrintData(); // non-virtual
 
   // Listener Helper Methods
   void OnEndPrinting();
   void OnStartPrinting();
-  void DoOnProgressChange(PRInt32      aProgess,
+  void DoOnProgressChange(PRInt32      aProgress,
                           PRInt32      aMaxProgress,
                           bool         aDoStartStop,
                           PRInt32      aFlag);
 
 
   ePrintDataType               mType;            // the type of data this is (Printing or Print Preview)
   nsRefPtr<nsDeviceContext>   mPrintDC;
   FILE                        *mDebugFilePtr;    // a file where information can go to when printing