1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/*
* Copyright (C) 2001 Philip Langdale, Matthew Aubury
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef PROGRESSLISTENER2_H__
#define PROGRESSLISTENER2_H__
#include "downloader-view.h"
#include "ephy-embed-persist.h"
#include "ephy-embed-shell.h"
#include <gtk/gtkwidget.h>
#include "nsIWebProgressListener.h"
#include "nsIHelperAppLauncherDialog.h"
#include "nsIExternalHelperAppService.h"
#include "nsCExternalHandlerService.h"
#include "nsIWebBrowserPersist.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsIURI.h"
#include "nsILocalFile.h"
#include "nsIDOMWindow.h"
#include "nsIRequest.h"
#include "nsIMIMEInfo.h"
#include "nsIDownload.h"
#include "nsIObserver.h"
#include "nsIProgressDialog.h"
#include "ContentHandler.h"
#define G_PROGRESSDIALOG_CID \
{ /* d2a2f743-f126-4f1f-1234-d4e50490f112 */ \
0xd2a2f743, \
0xf126, \
0x4f1f, \
{0x12, 0x34, 0xd4, 0xe5, 0x04, 0x90, 0xf1, 0x12} \
}
#define G_PROGRESSDIALOG_CLASSNAME "Ephy's Download Progress Dialog"
#define G_PROGRESSDIALOG_CONTRACTID "@mozilla.org/progressdialog;1"
class GProgressListener : public nsIProgressDialog,
public nsIWebProgressListener,
public nsSupportsWeakReference
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIPROGRESSDIALOG
NS_DECL_NSIDOWNLOAD
GProgressListener ();
virtual ~GProgressListener ();
NS_METHOD InitForPersist (nsIWebBrowserPersist *aPersist,
nsIDOMWindow *aParent, nsIURI *aURI,
nsIFile *aFile,
DownloadAction aAction,
EphyEmbedPersist *ephyPersist,
PRBool noDialog,
PRInt64 aTimeDownloadStarted = 0);
nsresult Pause (void);
nsresult Resume (void);
nsresult Abort (void);
GTimer *mTimer;
private:
NS_METHOD PrivateInit (void);
NS_METHOD LaunchHelperApp (void);
NS_METHOD LaunchHandler (PersistHandlerInfo *handler);
nsCOMPtr<nsIHelperAppLauncher> mLauncher;
nsCOMPtr<nsIWebBrowserPersist> mPersist;
nsCOMPtr<GContentHandler> mHandler;
nsCOMPtr<nsIDOMWindow> mParent;
nsCOMPtr<nsIRequest> mRequest;
EphyEmbedPersist *mEphyPersist;
nsCOMPtr<nsIURI> mUri;
PRInt64 mTimeDownloadStarted;
nsCOMPtr<nsIFile> mFile;
PRInt64 mStartTime;
PRInt64 mElapsed;
PRInt64 mLastUpdate;
PRInt32 mInterval;
PRFloat64 mPriorKRate;
PRInt32 mRateChanges;
PRInt32 mRateChangeLimit;
PRBool mIsPaused;
gboolean mNoDialog;
PRBool mAbort;
DownloadAction mAction;
DownloaderView *mDownloaderView;
EphyEmbedShell *ephy_shell;
guint mTimeoutFunc;
nsCOMPtr<nsIObserver> mObserver;
nsCOMPtr<nsIMIMEInfo> mMIMEInfo;
PRInt32 mPercentComplete;
};
extern nsresult NS_NewProgressListenerFactory(nsIFactory** aFactory);
#endif // PROGRESSLISTENER2_H__
|