#ifndef UserMediaController_h
#define UserMediaController_h
#include "core/page/Page.h"
#include "modules/mediastream/UserMediaClient.h"
#include "wtf/PassOwnPtr.h"
namespace WebCore {
class MediaDevicesRequest;
class UserMediaRequest;
class UserMediaController FINAL : public Supplement<Page> {
public:
virtual ~UserMediaController();
UserMediaClient* client() const { return m_client; }
void requestUserMedia(PassRefPtr<UserMediaRequest>);
void cancelUserMediaRequest(UserMediaRequest*);
void requestMediaDevices(PassRefPtr<MediaDevicesRequest>);
void cancelMediaDevicesRequest(MediaDevicesRequest*);
static PassOwnPtr<UserMediaController> create(UserMediaClient*);
static const char* supplementName();
static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(Supplement<Page>::from(page, supplementName())); }
protected:
explicit UserMediaController(UserMediaClient*);
private:
UserMediaClient* m_client;
};
inline void UserMediaController::requestUserMedia(PassRefPtr<UserMediaRequest> request)
{
m_client->requestUserMedia(request);
}
inline void UserMediaController::cancelUserMediaRequest(UserMediaRequest* request)
{
m_client->cancelUserMediaRequest(request);
}
inline void UserMediaController::requestMediaDevices(PassRefPtr<MediaDevicesRequest> request)
{
m_client->requestMediaDevices(request);
}
inline void UserMediaController::cancelMediaDevicesRequest(MediaDevicesRequest* request)
{
m_client->cancelMediaDevicesRequest(request);
}
}
#endif