This source file includes following definitions.
- create
- allowDatabase
- allowFileSystem
- requestFileSystemAccess
- allowIndexedDB
- supplementName
- from
- providePermissionClientToWorker
#include "config.h"
#include "WorkerPermissionClient.h"
#include "core/workers/WorkerGlobalScope.h"
#include "public/platform/WebPermissionCallbacks.h"
#include "public/platform/WebString.h"
#include "public/web/WebWorkerPermissionClientProxy.h"
#include "wtf/PassOwnPtr.h"
using namespace WebCore;
namespace blink {
PassOwnPtr<WorkerPermissionClient> WorkerPermissionClient::create(PassOwnPtr<WebWorkerPermissionClientProxy> proxy)
{
return adoptPtr(new WorkerPermissionClient(proxy));
}
WorkerPermissionClient::~WorkerPermissionClient()
{
}
bool WorkerPermissionClient::allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize)
{
if (!m_proxy)
return true;
return m_proxy->allowDatabase(name, displayName, estimatedSize);
}
bool WorkerPermissionClient::allowFileSystem()
{
if (!m_proxy)
return true;
return m_proxy->allowFileSystem();
}
void WorkerPermissionClient::requestFileSystemAccess(const WebPermissionCallbacks& callbacks)
{
if (!m_proxy) {
WebPermissionCallbacks permissionCallbacks(callbacks);
permissionCallbacks.doAllow();
return;
}
m_proxy->requestFileSystemAccess(callbacks);
}
bool WorkerPermissionClient::allowIndexedDB(const WebString& name)
{
if (!m_proxy)
return true;
return m_proxy->allowIndexedDB(name);
}
const char* WorkerPermissionClient::supplementName()
{
return "WorkerPermissionClient";
}
WorkerPermissionClient* WorkerPermissionClient::from(ExecutionContext& context)
{
WorkerClients* clients = toWorkerGlobalScope(context).clients();
ASSERT(clients);
return static_cast<WorkerPermissionClient*>(Supplement<WorkerClients>::from(*clients, supplementName()));
}
WorkerPermissionClient::WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionClientProxy> proxy)
: m_proxy(proxy)
{
}
void providePermissionClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorkerPermissionClientProxy> proxy)
{
ASSERT(clients);
WorkerPermissionClient::provideTo(*clients, WorkerPermissionClient::supplementName(), WorkerPermissionClient::create(proxy));
}
}