void NotificationPresenter::requestPermission(
    const WebSecurityOrigin& origin,
    WebNotificationPermissionCallback* callback)
{
    m_delegate->printMessage("DESKTOP NOTIFICATION PERMISSION REQUESTED: " + string(origin.toString().utf8()) + "\n");
    callback->permissionRequestComplete();
}
Пример #2
0
void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(
    int eventID,
    const WebString& message,
    const WebSecurityOrigin& sourceOrigin,
    const WebMessagePortChannelArray& webChannels,
    const WebServiceWorkerClientInfo& client) {
  WebSerializedScriptValue value =
      WebSerializedScriptValue::fromString(message);
  MessagePortArray* ports =
      MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels);
  String origin;
  if (!sourceOrigin.isUnique())
    origin = sourceOrigin.toString();
  ServiceWorkerClient* source = nullptr;
  if (client.clientType == WebServiceWorkerClientTypeWindow)
    source = ServiceWorkerWindowClient::create(client);
  else
    source = ServiceWorkerClient::create(client);
  WaitUntilObserver* observer = WaitUntilObserver::create(
      workerGlobalScope(), WaitUntilObserver::Message, eventID);

  Event* event =
      ExtendableMessageEvent::create(value, origin, ports, source, observer);
  workerGlobalScope()->dispatchExtendableEvent(event, observer);
}
void NotificationPresenter::requestPermission(
    const WebSecurityOrigin& origin,
    WebNotificationPermissionCallback* callback)
{
    printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n",
           origin.toString().utf8().data());
    callback->permissionRequestComplete();
}
WebNotificationPresenter::Permission NotificationPresenter::checkPermission(const WebSecurityOrigin& origin)
{
    // Check with the layout test controller
    WebString originString = origin.toString();
    bool allowed = m_allowedOrigins.find(string(originString.utf8())) != m_allowedOrigins.end();
    return allowed ? WebNotificationPresenter::PermissionAllowed
        : WebNotificationPresenter::PermissionDenied;
}
Пример #5
0
void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(
    int eventID,
    const WebString& message,
    const WebSecurityOrigin& sourceOrigin,
    const WebMessagePortChannelArray& webChannels,
    std::unique_ptr<WebServiceWorker::Handle> handle) {
  WebSerializedScriptValue value =
      WebSerializedScriptValue::fromString(message);
  MessagePortArray* ports =
      MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels);
  String origin;
  if (!sourceOrigin.isUnique())
    origin = sourceOrigin.toString();
  ServiceWorker* source =
      ServiceWorker::from(m_workerGlobalScope->getExecutionContext(),
                          WTF::wrapUnique(handle.release()));
  WaitUntilObserver* observer = WaitUntilObserver::create(
      workerGlobalScope(), WaitUntilObserver::Message, eventID);

  Event* event =
      ExtendableMessageEvent::create(value, origin, ports, source, observer);
  workerGlobalScope()->dispatchExtendableEvent(event, observer);
}