/* */ #ifndef D_NOTIFIER_H #define D_NOTIFIER_H #include "common.h" #include "SharedHandle.h" namespace aria2 { class RequestGroup; class Option; struct Pref; namespace rpc { class WebSocketSessionMan; class WebSocketSession; } // namespace rpc class Notifier { public: // The string constants for download events. static const std::string ON_DOWNLOAD_START; static const std::string ON_DOWNLOAD_PAUSE; static const std::string ON_DOWNLOAD_STOP; static const std::string ON_DOWNLOAD_COMPLETE; static const std::string ON_DOWNLOAD_ERROR; static const std::string ON_BT_DOWNLOAD_COMPLETE; Notifier(const SharedHandle& wsSessionMan); ~Notifier(); void addWebSocketSession(const SharedHandle& wsSes); void removeWebSocketSession(const SharedHandle& wsSes); // Notifies the download event to all listeners. void notifyDownloadEvent(const std::string& event, const RequestGroup* group); void notifyDownloadEvent(const std::string& event, const SharedHandle& group) { notifyDownloadEvent(event, group.get()); } private: SharedHandle wsSessionMan_; }; } // namespace aria2 #endif // D_NOTIFIER_H