Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / modules / plugin / base / src / nsNPAPIPluginStreamListener.h
blobec67ef3aeb64adf367121aa73372bb42f95c585d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
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.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsNPAPIPluginStreamListener_h_
39 #define nsNPAPIPluginStreamListener_h_
41 #include "nsIPluginStreamListener.h"
42 #include "nsIPluginStreamInfo.h"
43 #include "nsIHTTPHeaderListener.h"
44 #include "nsIRequest.h"
45 #include "nsITimer.h"
46 #include "nsCOMPtr.h"
48 #define MAX_PLUGIN_NECKO_BUFFER 16384
50 class nsNPAPIPluginInstance;
51 class nsINPAPIPluginStreamInfo;
53 class nsNPAPIPluginStreamListener : public nsIPluginStreamListener,
54 public nsITimerCallback,
55 public nsIHTTPHeaderListener
57 public:
58 NS_DECL_ISUPPORTS
59 NS_DECL_NSIPLUGINSTREAMLISTENER
60 NS_DECL_NSITIMERCALLBACK
61 NS_DECL_NSIHTTPHEADERLISTENER
63 // nsNPAPIPluginStreamListener specific methods:
64 nsNPAPIPluginStreamListener(nsNPAPIPluginInstance* inst, void* notifyData,
65 const char* aURL);
66 virtual ~nsNPAPIPluginStreamListener();
67 PRBool IsStarted();
68 nsresult CleanUpStream(NPReason reason);
69 void CallURLNotify(NPReason reason);
70 void SetCallNotify(PRBool aCallNotify)
72 mCallNotify = aCallNotify;
74 nsresult SuspendRequest();
75 void ResumeRequest();
76 nsresult StartDataPump();
77 void StopDataPump();
79 PRBool PluginInitJSLoadInProgress();
81 protected:
82 void* mNotifyData;
83 char* mStreamBuffer;
84 char* mNotifyURL;
85 nsNPAPIPluginInstance* mInst;
86 NPStream mNPStream;
87 PRUint32 mStreamBufferSize;
88 PRInt32 mStreamBufferByteCount;
89 nsPluginStreamType mStreamType;
90 PRPackedBool mStreamStarted;
91 PRPackedBool mStreamCleanedUp;
92 PRPackedBool mCallNotify;
93 PRPackedBool mIsSuspended;
94 PRPackedBool mIsPluginInitJSStream;
95 nsCString mResponseHeaders;
96 char* mResponseHeaderBuf;
98 nsCOMPtr<nsITimer> mDataPumpTimer;
100 public:
101 nsCOMPtr<nsIPluginStreamInfo> mStreamInfo;
104 // nsINPAPIPluginStreamInfo is an internal helper interface that exposes
105 // the underlying necko request to consumers of nsIPluginStreamInfo's.
106 #define NS_INPAPIPLUGINSTREAMINFO_IID \
107 { 0x097fdaaa, 0xa2a3, 0x49c2, \
108 {0x91, 0xee, 0xeb, 0xc5, 0x7d, 0x6c, 0x9c, 0x97} }
110 class nsINPAPIPluginStreamInfo : public nsIPluginStreamInfo
112 public:
113 NS_DECLARE_STATIC_IID_ACCESSOR(NS_INPAPIPLUGINSTREAMINFO_IID)
115 nsIRequest *GetRequest()
117 return mRequest;
120 protected:
121 nsCOMPtr<nsIRequest> mRequest;
124 NS_DEFINE_STATIC_IID_ACCESSOR(nsINPAPIPluginStreamInfo,
125 NS_INPAPIPLUGINSTREAMINFO_IID)
127 #endif // nsNPAPIPluginStreamListener_h_