LCOV - code coverage report
Current view: directory - toolkit/components/statusfilter - nsBrowserStatusFilter.h (source / functions) Found Hit Coverage
Test: app.info Lines: 1 0 0.0 %
Date: 2012-06-02 Functions: 1 0 0.0 %

       1                 : /* ***** BEGIN LICENSE BLOCK *****
       2                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       3                 :  *
       4                 :  * The contents of this file are subject to the Mozilla Public License Version
       5                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       6                 :  * the License. You may obtain a copy of the License at
       7                 :  * http://www.mozilla.org/MPL/
       8                 :  *
       9                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      10                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      11                 :  * for the specific language governing rights and limitations under the
      12                 :  * License.
      13                 :  *
      14                 :  * The Original Code is Mozilla.
      15                 :  *
      16                 :  * The Initial Developer of the Original Code is
      17                 :  * Netscape Communications Corporation.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2002
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Darin Fisher <darin@netscape.com>
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      26                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #ifndef nsBrowserStatusFilter_h__
      39                 : #define nsBrowserStatusFilter_h__
      40                 : 
      41                 : #include "nsIWebProgressListener.h"
      42                 : #include "nsIWebProgressListener2.h"
      43                 : #include "nsIWebProgress.h"
      44                 : #include "nsWeakReference.h"
      45                 : #include "nsITimer.h"
      46                 : #include "nsCOMPtr.h"
      47                 : #include "nsString.h"
      48                 : 
      49                 : //-----------------------------------------------------------------------------
      50                 : // nsBrowserStatusFilter - a web progress listener implementation designed to 
      51                 : // sit between nsDocLoader and nsBrowserStatusHandler to filter out and limit
      52                 : // the frequency of certain events to improve page load performance.
      53                 : //-----------------------------------------------------------------------------
      54                 : 
      55                 : class nsBrowserStatusFilter : public nsIWebProgress
      56                 :                             , public nsIWebProgressListener2
      57                 :                             , public nsSupportsWeakReference
      58                 : {
      59                 : public:
      60                 :     nsBrowserStatusFilter();
      61                 :     virtual ~nsBrowserStatusFilter();
      62                 : 
      63                 :     NS_DECL_ISUPPORTS
      64                 :     NS_DECL_NSIWEBPROGRESS
      65                 :     NS_DECL_NSIWEBPROGRESSLISTENER
      66                 :     NS_DECL_NSIWEBPROGRESSLISTENER2
      67                 : 
      68                 : private:
      69                 :     nsresult StartDelayTimer();
      70                 :     void ProcessTimeout();
      71                 :     void MaybeSendProgress();
      72                 :     void MaybeSendStatus();
      73                 :     void ResetMembers();
      74               0 :     bool DelayInEffect() { return mDelayedStatus || mDelayedProgress; }
      75                 : 
      76                 :     static void TimeoutHandler(nsITimer *aTimer, void *aClosure);
      77                 : 
      78                 : private:
      79                 :     nsCOMPtr<nsIWebProgressListener> mListener;
      80                 :     nsCOMPtr<nsITimer>               mTimer;
      81                 : 
      82                 :     // delayed values
      83                 :     nsString                         mStatusMsg;
      84                 :     PRInt64                          mCurProgress;
      85                 :     PRInt64                          mMaxProgress;
      86                 : 
      87                 :     nsString                         mCurrentStatusMsg;
      88                 :     bool                             mStatusIsDirty;
      89                 :     PRInt32                          mCurrentPercentage;
      90                 : 
      91                 :     // used to convert OnStart/OnStop notifications into progress notifications
      92                 :     PRInt32                          mTotalRequests;
      93                 :     PRInt32                          mFinishedRequests;
      94                 :     bool                             mUseRealProgressFlag;
      95                 : 
      96                 :     // indicates whether a timeout is pending
      97                 :     bool                             mDelayedStatus;
      98                 :     bool                             mDelayedProgress;
      99                 : };
     100                 : 
     101                 : #define NS_BROWSERSTATUSFILTER_CLASSNAME \
     102                 :     "nsBrowserStatusFilter"
     103                 : #define NS_BROWSERSTATUSFILTER_CONTRACTID \
     104                 :     "@mozilla.org/appshell/component/browser-status-filter;1"
     105                 : #define NS_BROWSERSTATUSFILTER_CID                   \
     106                 : { /* 6356aa16-7916-4215-a825-cbc2692ca87a */         \
     107                 :     0x6356aa16,                                      \
     108                 :     0x7916,                                          \
     109                 :     0x4215,                                          \
     110                 :     {0xa8, 0x25, 0xcb, 0xc2, 0x69, 0x2c, 0xa8, 0x7a} \
     111                 : }
     112                 : 
     113                 : #endif // !nsBrowserStatusFilter_h__

Generated by: LCOV version 1.7