/** @file MOMVODManager.h
 *
 * Copyright (C) Espial Limited 2014 - Company confidential - All rights reserved.
 *
 */

#ifndef MOMVODManager_h
#define MOMVODManager_h

#if ENABLE(RMAI)

#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>

#include "ActiveDOMObject.h"
#include "EventTarget.h"

namespace WebCore {

class MOMContentItem;
class ScriptExecutionContext;

class MOMVODManager : public RefCounted<MOMVODManager>, public ActiveDOMObject, public EventTarget {
public:

    static PassRefPtr<MOMVODManager> create(ScriptExecutionContext* context);

    virtual ~MOMVODManager();

    MOMContentItem* catalogues() const;
    void dummy() { }

    // ActiveDOMObject interface
    bool hasPendingActivity() const /*OVERRIDE*/ { return const_cast<MOMVODManager*>(this)->hasEventListeners(); }
    void stop() /*OVERRIDE*/ {};
    virtual const char* activeDOMObjectName() const OVERRIDE { return "MOMVODManager"; }

    // EventTarget interface
    MOMVODManager* toMOMVODManager() { return this; }
    ScriptExecutionContext* scriptExecutionContext() const /*OVERRIDE*/ { return ActiveDOMObject::scriptExecutionContext(); }
    EventTargetData* eventTargetData() /*OVERRIDE*/ { return &m_eventTargetData; }
    EventTargetData* ensureEventTargetData() /*OVERRIDE*/ { return &m_eventTargetData; }
    void refEventTarget() /*OVERRIDE*/ { ref(); }
    void derefEventTarget() /*OVERRIDE*/ { deref(); }

    virtual EventTargetInterface eventTargetInterface() const;

    using RefCounted<MOMVODManager>::ref;
    using RefCounted<MOMVODManager>::deref;

protected:
    MOMVODManager(ScriptExecutionContext* context);

private:
    mutable RefPtr<MOMContentItem> m_catalogues;
    EventTargetData m_eventTargetData;
};

} // namespace WebCore

#endif // ENABLE(RMAI)

#endif // MOMVODManager_h
