UserMediaController.cpp [plain text]
#include "config.h"
#include "UserMediaController.h"
#if ENABLE(MEDIA_STREAM)
#include "DOMWindow.h"
#include "Document.h"
#include "Frame.h"
#include "HTMLIFrameElement.h"
#include "UserMediaRequest.h"
namespace WebCore {
const char* UserMediaController::supplementName()
{
return "UserMediaController";
}
UserMediaController::UserMediaController(UserMediaClient* client)
: m_client(client)
{
}
UserMediaController::~UserMediaController()
{
m_client->pageDestroyed();
}
void provideUserMediaTo(Page* page, UserMediaClient* client)
{
UserMediaController::provideTo(page, UserMediaController::supplementName(), makeUnique<UserMediaController>(client));
}
void UserMediaController::logGetUserMediaDenial(Document& document)
{
if (auto* window = document.domWindow())
window->printErrorMessage(makeString("Not allowed to call getUserMedia."));
}
void UserMediaController::logGetDisplayMediaDenial(Document& document)
{
if (auto* window = document.domWindow())
window->printErrorMessage(makeString("Not allowed to call getDisplayMedia."));
}
void UserMediaController::logEnumerateDevicesDenial(Document& document)
{
isFeaturePolicyAllowedByDocumentAndAllOwners(FeaturePolicy::Type::Camera, document, LogFeaturePolicyFailure::Yes);
isFeaturePolicyAllowedByDocumentAndAllOwners(FeaturePolicy::Type::Microphone, document, LogFeaturePolicyFailure::Yes);
if (auto* window = document.domWindow())
window->printErrorMessage(makeString("Not allowed to call enumerateDevices."));
}
}
#endif // ENABLE(MEDIA_STREAM)