FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
NpapiStream.h
1 /**********************************************************\
2 Original Author: Matthias (nitrogenycs)
3 
4 Created: Feb 28, 2010
5 License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2010 Richard Bateman, Firebreath development team
13 \**********************************************************/
14 
15 #pragma once
16 #ifndef H_FB_NPAPI_NPAPISTREAM
17 #define H_FB_NPAPI_NPAPISTREAM
18 
19 #include "NpapiTypes.h"
20 #include "NpapiBrowserHost.h"
21 #include "BrowserStream.h"
22 
23 namespace FB { namespace Npapi {
24 
25  FB_FORWARD_PTR(NpapiPlugin);
26  FB_FORWARD_PTR(NpapiStream);
27 
28  class NpapiStream : public FB::BrowserStream
29  {
30  public:
31  NpapiStream( const std::string& url, bool cache, bool seekable, size_t internalBufferSize, const NpapiBrowserHostConstPtr &host );
32  virtual ~NpapiStream();
33 
34  //virtual bool is_open();
35  virtual bool readRanges( const std::vector<Range>& ranges );
36  virtual bool write(const char* data, size_t dataLength, size_t& written);
37  virtual bool close();
38  virtual void setCreated();
39  virtual void setDestroyed();
40  virtual void setNotified();
41 
42  protected:
43  virtual int32_t signalDataArrived(void* buffer, int32_t len, int32_t offset);
44  virtual void signalOpened();
45  virtual void signalFailedOpen();
46  virtual void signalCompleted(bool success);
47  virtual void signalCacheFilename(const std::wstring& cacheFilename);
48 
49  virtual void setStream(NPStream* stream);
50  virtual NPStream* getStream() const;
51  virtual NpapiBrowserHostConstPtr getHost() const;
52  private:
53  NPStream* stream;
54  NpapiBrowserHostWeakConstPtr host;
55  NpapiStreamPtr m_selfReference;
56  bool m_streamDestroyed;
57  bool m_streamNotified;
58  friend class NpapiPlugin;
59  };
60 
61 }; }; // FB::Npapi
62 
63 #endif
64 
This is the abstract base class (interface class) for a browser stream.
Definition: BrowserStream.h:41