UserMediaRequest.h [plain text]
#ifndef UserMediaRequest_h
#define UserMediaRequest_h
#if ENABLE(MEDIA_STREAM)
#include "ActiveDOMObject.h"
#include "MediaDevices.h"
#include "MediaStreamCreationClient.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class Dictionary;
class Document;
class Frame;
class MediaConstraints;
class MediaStreamPrivate;
class NavigatorUserMediaErrorCallback;
class NavigatorUserMediaSuccessCallback;
class UserMediaController;
class SecurityOrigin;
typedef int ExceptionCode;
class UserMediaRequest : public MediaStreamCreationClient, public ContextDestructionObserver {
public:
static void start(Document*, const Dictionary&, MediaDevices::Promise&&, ExceptionCode&);
~UserMediaRequest();
WEBCORE_EXPORT SecurityOrigin* securityOrigin() const;
void start();
WEBCORE_EXPORT void userMediaAccessGranted();
WEBCORE_EXPORT void userMediaAccessDenied();
bool requiresAudio() const { return m_audioConstraints; }
bool requiresVideo() const { return m_videoConstraints; }
private:
UserMediaRequest(ScriptExecutionContext*, UserMediaController*, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints, MediaDevices::Promise&&);
virtual void constraintsValidated() override final;
virtual void constraintsInvalid(const String& constraintName) override final;
virtual void didCreateStream(PassRefPtr<MediaStreamPrivate>) override final;
virtual void failedToCreateStreamWithConstraintsError(const String& constraintName) override final;
virtual void failedToCreateStreamWithPermissionError() override final;
virtual void contextDestroyed() override final;
RefPtr<MediaConstraints> m_audioConstraints;
RefPtr<MediaConstraints> m_videoConstraints;
UserMediaController* m_controller;
MediaDevices::Promise m_promise;
};
}
#endif // ENABLE(MEDIA_STREAM)
#endif // UserMediaRequest_h