Exemplo n.º 1
0
bool EditorClientImpl::canPaste(LocalFrame* frame, bool defaultValue) const {
  WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
  if (!webFrame->contentSettingsClient())
    return defaultValue;
  return webFrame->contentSettingsClient()->allowReadFromClipboard(
      defaultValue);
}
bool ContextFeaturesClientImpl::askIfIsEnabled(Document* document, ContextFeatures::FeatureType type, bool defaultValue)
{
    WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(document->frame());
    if (!frame || !frame->contentSettingsClient())
        return defaultValue;

    switch (type) {
    case ContextFeatures::MutationEvents:
        return frame->contentSettingsClient()->allowMutationEvents(defaultValue);
    default:
        return defaultValue;
    }
}
Exemplo n.º 3
0
bool DatabaseClientImpl::allowDatabase(ExecutionContext* executionContext,
                                       const String& name,
                                       const String& displayName,
                                       unsigned estimatedSize) {
  DCHECK(executionContext->isContextThread());
  Document* document = toDocument(executionContext);
  WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame());
  if (!webFrame)
    return false;
  if (webFrame->contentSettingsClient())
    return webFrame->contentSettingsClient()->allowDatabase(name, displayName,
                                                            estimatedSize);
  return true;
}
bool IndexedDBClientImpl::allowIndexedDB(ExecutionContext* context, const String& name)
{
    ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument() || context->isWorkerGlobalScope());

    if (context->isDocument()) {
        WebSecurityOrigin origin(context->getSecurityOrigin());
        Document* document = toDocument(context);
        WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame());
        // FIXME: webFrame->contentSettingsClient() returns 0 in test_shell and content_shell http://crbug.com/137269
        return !webFrame->contentSettingsClient() || webFrame->contentSettingsClient()->allowIndexedDB(name, origin);
    }

    WorkerGlobalScope& workerGlobalScope = *toWorkerGlobalScope(context);
    return WorkerContentSettingsClient::from(workerGlobalScope)->allowIndexedDB(name);
}
Exemplo n.º 5
0
bool IndexedDBClientImpl::allowIndexedDB(ExecutionContext* context,
                                         const String& name) {
  DCHECK(context->isContextThread());
  SECURITY_DCHECK(context->isDocument() || context->isWorkerGlobalScope());

  if (context->isDocument()) {
    WebSecurityOrigin origin(context->getSecurityOrigin());
    Document* document = toDocument(context);
    WebLocalFrameImpl* webFrame =
        WebLocalFrameImpl::fromFrame(document->frame());
    if (!webFrame)
      return false;
    if (webFrame->contentSettingsClient())
      return webFrame->contentSettingsClient()->allowIndexedDB(name, origin);
    return true;
  }

  WorkerGlobalScope& workerGlobalScope = *toWorkerGlobalScope(context);
  return WorkerContentSettingsClient::from(workerGlobalScope)
      ->allowIndexedDB(name);
}