| Index: Source/core/dom/ResourceProgressEvent.h
|
| diff --git a/Source/modules/webmidi/MIDIPort.cpp b/Source/core/dom/ResourceProgressEvent.h
|
| similarity index 55%
|
| copy from Source/modules/webmidi/MIDIPort.cpp
|
| copy to Source/core/dom/ResourceProgressEvent.h
|
| index c6d587859f267883719afbfcd8e26b9418b10933..50e72263d0f543e2212ece68b72ebff2e8101b1e 100644
|
| --- a/Source/modules/webmidi/MIDIPort.cpp
|
| +++ b/Source/core/dom/ResourceProgressEvent.h
|
| @@ -28,46 +28,43 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#include "config.h"
|
| -#include "modules/webmidi/MIDIPort.h"
|
| +#ifndef ResourceProgressEvent_h
|
| +#define ResourceProgressEvent_h
|
| +
|
| +#include "core/dom/ProgressEvent.h"
|
|
|
| namespace WebCore {
|
|
|
| -PassRefPtr<MIDIPort> MIDIPort::create(ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode type, const String& version)
|
| -{
|
| - RefPtr<MIDIPort> midiPort(adoptRef(new MIDIPort(context, id, manufacturer, name, type, version)));
|
| - midiPort->suspendIfNeeded();
|
| - return midiPort.release();
|
| -}
|
| +// ResourceProgressEvent is a non-standard class that is simply a ProgressEvent
|
| +// with an additional read-only "url" property containing a string URL. This is
|
| +// used by the Chromium NaCl integration to indicate to which resource the
|
| +// event applies. This is useful because the NaCl integration will download
|
| +// (and translate in the case of PNaCl) multiple binary files. It is not
|
| +// constructable by web content at all, and so does not provide the usual
|
| +// EventInit pattern for Event construction.
|
| +class ResourceProgressEvent : public ProgressEvent {
|
| +public:
|
| + static PassRefPtr<ResourceProgressEvent> create()
|
| + {
|
| + return adoptRef(new ResourceProgressEvent);
|
| + }
|
| + static PassRefPtr<ResourceProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, const String& url)
|
| + {
|
| + return adoptRef(new ResourceProgressEvent(type, lengthComputable, loaded, total, url));
|
| + }
|
| +
|
| + const String& url() const;
|
|
|
| -MIDIPort::MIDIPort(ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, MIDIPortTypeCode type, const String& version)
|
| - : ActiveDOMObject(context)
|
| - , m_id(id)
|
| - , m_manufacturer(manufacturer)
|
| - , m_name(name)
|
| - , m_type(type)
|
| - , m_version(version)
|
| -{
|
| - ASSERT(type == MIDIPortTypeInput || type == MIDIPortTypeOutput);
|
| - ScriptWrappable::init(this);
|
| -}
|
| + virtual const AtomicString& interfaceName() const;
|
|
|
| -MIDIPort::~MIDIPort()
|
| -{
|
| - stop();
|
| -}
|
| +protected:
|
| + ResourceProgressEvent();
|
| + ResourceProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, const String& url);
|
|
|
| -String MIDIPort::type() const
|
| -{
|
| - switch (m_type) {
|
| - case MIDIPortTypeInput:
|
| - return ASCIILiteral("input");
|
| - case MIDIPortTypeOutput:
|
| - return ASCIILiteral("output");
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return emptyString();
|
| -}
|
| +private:
|
| + String m_url;
|
| +};
|
|
|
| } // namespace WebCore
|
| +
|
| +#endif // ResourceProgressEvent_h
|
|
|