This source file includes following definitions.
- reset
- securityOrigin
- ownerDocument
- requestSucceeded
- equals
- assign
#include "config.h"
#include "WebMediaDevicesRequest.h"
#include "WebDocument.h"
#include "WebSecurityOrigin.h"
#include "core/dom/Document.h"
#include "modules/mediastream/MediaDevicesRequest.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/WebMediaDeviceInfo.h"
#include "public/platform/WebString.h"
#include "public/platform/WebVector.h"
#include "wtf/Vector.h"
using namespace WebCore;
namespace blink {
WebMediaDevicesRequest::WebMediaDevicesRequest(const PassRefPtr<MediaDevicesRequest>& request)
: m_private(request)
{
}
WebMediaDevicesRequest::WebMediaDevicesRequest(MediaDevicesRequest* request)
: m_private(request)
{
}
void WebMediaDevicesRequest::reset()
{
m_private.reset();
}
WebSecurityOrigin WebMediaDevicesRequest::securityOrigin() const
{
ASSERT(!isNull() && m_private->executionContext());
return WebSecurityOrigin(m_private->executionContext()->securityOrigin());
}
WebDocument WebMediaDevicesRequest::ownerDocument() const
{
ASSERT(!isNull());
return WebDocument(m_private->ownerDocument());
}
void WebMediaDevicesRequest::requestSucceeded(WebVector<WebMediaDeviceInfo> webDevices)
{
ASSERT(!isNull());
MediaDeviceInfoVector devices(webDevices.size());
for (size_t i = 0; i < webDevices.size(); ++i)
devices[i] = MediaDeviceInfo::create(webDevices[i]);
m_private->succeed(devices);
}
bool WebMediaDevicesRequest::equals(const WebMediaDevicesRequest& other) const
{
if (isNull() || other.isNull())
return false;
return m_private.get() == other.m_private.get();
}
void WebMediaDevicesRequest::assign(const WebMediaDevicesRequest& other)
{
m_private = other.m_private;
}
WebMediaDevicesRequest::operator MediaDevicesRequest*() const
{
return m_private.get();
}
}