FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
DefaultBrowserStreamHandler.h
1 #pragma once
2 #ifndef DefaultBrowserStreamHandler_h__
3 #define DefaultBrowserStreamHandler_h__
4 
5 /**********************************************************\
6 Original Author: Matthias (nitrogenycs)
7 
8 Created: Feb 28, 2010
9 License: Dual license model; choose one of two:
10  New BSD License
11  http://www.opensource.org/licenses/bsd-license.php
12  - or -
13  GNU Lesser General Public License, version 2.1
14  http://www.gnu.org/licenses/lgpl-2.1.html
15 
16 Copyright 2010 PacketPass, Inc and the Firebreath development team
17 \**********************************************************/
18 
19 #include "BrowserStream.h"
20 #include "PluginEvents/AttachedEvent.h"
21 
22 namespace FB {
37  {
38  public:
39  BEGIN_PLUGIN_EVENT_MAP()
43  EVENTTYPE_CASE(FB::StreamDestroyedEvent, onStreamDestroyed, FB::BrowserStream)
45  EVENTTYPE_CASE(FB::StreamOpenedEvent, onStreamOpened, FB::BrowserStream)
46  EVENTTYPE_CASE(FB::StreamDataArrivedEvent, onStreamDataArrived, FB::BrowserStream)
48  END_PLUGIN_EVENT_MAP()
49 
50 
58 
66  virtual
68 
77  virtual bool onStreamAttached(FB::AttachedEvent *evt, FB::BrowserStream * Stream);
78 
87  virtual bool onStreamDetached(FB::DetachedEvent *evt, FB::BrowserStream * Stream);
88 
96  virtual bool onStreamCreated(FB::StreamCreatedEvent *evt, FB::BrowserStream * Stream);
97 
105  virtual bool onStreamDestroyed(FB::StreamDestroyedEvent *evt, FB::BrowserStream *);
106 
114  virtual bool onStreamDataArrived(FB::StreamDataArrivedEvent *evt, FB::BrowserStream *);
115 
124 
132  virtual bool onStreamOpened(FB::StreamOpenedEvent *evt, FB::BrowserStream *);
133 
142 
150  virtual const FB::BrowserStreamPtr& getStream() const;
151 
160  virtual bool cancel();
161 
162  protected:
170  virtual void setStream(const FB::BrowserStreamPtr& stream);
171 
179  virtual void clearStream();
180 
181  BrowserStreamPtr stream;
182  };
183 }
184 #endif // DefaultBrowserStreamHandler_h__
185 
virtual bool onStreamCompleted(FB::StreamCompletedEvent *evt, FB::BrowserStream *)
Called when the stream finished downloading successfully.
This event is fired when the given stream was created.
Definition: StreamEvents.h:48
virtual bool onStreamAttached(FB::AttachedEvent *evt, FB::BrowserStream *Stream)
Called when the stream is attached to this handler (may have already been created).
virtual bool onStreamDetached(FB::DetachedEvent *evt, FB::BrowserStream *Stream)
Called when the stream is detached from this handler (may not have been destroyed).
This is the abstract base class (interface class) for a browser stream.
Definition: BrowserStream.h:41
virtual void setStream(const FB::BrowserStreamPtr &stream)
Call to set the stream associated with this handler.
virtual bool onStreamFailedOpen(FB::StreamFailedOpenEvent *evt, FB::BrowserStream *)
Called when the stream failed to open.
virtual const FB::BrowserStreamPtr & getStream() const
Call to get the stream associated with this handler. Returns empty shared_ptr if none.
virtual bool onStreamDestroyed(FB::StreamDestroyedEvent *evt, FB::BrowserStream *)
Called when the stream is destroyed.
virtual bool onStreamDataArrived(FB::StreamDataArrivedEvent *evt, FB::BrowserStream *)
Called when data arrives.
Simple implementation of a stream event handler from which you can derive your own stream events hand...
BrowserStreamPtr stream
stream instance, don't use yourself
This event is fired when a stream failed to open, e.g. the url was invalid or a seekable stream was r...
Definition: StreamEvents.h:120
virtual bool onStreamOpened(FB::StreamOpenedEvent *evt, FB::BrowserStream *)
Called when the stream was opened successfully.
Plugin event sink; all objects that can receive PluginEvent s should inherit from this class...
Fired when a PluginEventSink is attached to a PluginEventSource (such as a PluginCore derived plugin ...
Definition: AttachedEvent.h:29
virtual bool cancel()
Cancels the stream.
virtual void clearStream()
Call to clear the stream associated with this handler.
Fired when a PluginEventSink is detached from a PluginEventSource (such as a PluginCore derived plugi...
Definition: AttachedEvent.h:39
This event is fired when a stream has completed downloading.
Definition: StreamEvents.h:148
virtual bool onStreamCreated(FB::StreamCreatedEvent *evt, FB::BrowserStream *Stream)
Called when the stream was created.