2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef PluginStreamWin_H
27 #define PluginStreamWin_H
31 #include <wtf/HashMap.h>
32 #include <wtf/Vector.h>
33 #include <wtf/OwnPtr.h>
34 #include <wtf/RefCounted.h>
37 #include "npfunctions.h"
38 #include "NetscapePlugInStreamLoader.h"
39 #include "PlatformString.h"
40 #include "ResourceRequest.h"
41 #include "ResourceResponse.h"
42 #include "StringHash.h"
49 enum PluginStreamState { StreamBeforeStarted, StreamStarted, StreamStopped };
51 class PluginStreamWin : public RefCounted<PluginStreamWin>, private NetscapePlugInStreamLoaderClient {
53 PluginStreamWin(PluginViewWin*, Frame*, const ResourceRequest&, bool sendNotification, void* notifyData);
61 void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
63 // NetscapePlugInStreamLoaderClient
64 virtual void didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse&);
65 virtual void didReceiveData(NetscapePlugInStreamLoader*, const char*, int);
66 virtual void didFail(NetscapePlugInStreamLoader*, const ResourceError&);
67 virtual void didFinishLoading(NetscapePlugInStreamLoader*);
69 void sendJavaScriptStream(const KURL& requestURL, const CString& resultString);
70 void cancelAndDestroyStream(NPReason);
72 static NPP ownerForStream(NPStream*);
75 void destroyStream(NPReason);
78 ResourceRequest m_resourceRequest;
79 ResourceResponse m_resourceResponse;
82 RefPtr<NetscapePlugInStreamLoader> m_loader;
83 PluginViewWin* m_pluginView;
85 bool m_sendNotification;
86 PluginStreamState m_streamState;
89 Timer<PluginStreamWin> m_delayDeliveryTimer;
90 void delayDeliveryTimerFired(Timer<PluginStreamWin>*);
92 OwnPtr< Vector<char> > m_deliveryData;
94 HANDLE m_tempFileHandle;
96 const NPPluginFuncs* m_pluginFuncs;
98 uint16 m_transferMode;
106 } // namespace WebCore