void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback)
{
    if (dumpNotification)
        printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData());

    NotificationClient::Permission permission = checkPermission(context);
    if (permission != NotificationClient::PermissionNotAllowed) {
        if (callback)
            callback->handleEvent(Notification::permissionString(permission));
        return;
    }

    QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context);
    if (iter != m_pendingPermissionRequests.end())
        iter.value().m_callbacks.append(callback);
    else {
        RefPtr<NotificationPermissionCallback> cb = callback;
        CallbacksInfo info;
        info.m_frame = toFrame(context);
        info.m_callbacks.append(cb);

        if (toPage(context) && toFrame(context)) {
            m_pendingPermissionRequests.insert(context, info);
            toPage(context)->notificationsPermissionRequested(toFrame(context));
        }
    }
}
예제 #2
0
void MainThreadDebugger::reportConsoleMessage(ExecutionContext* context,
                                              MessageSource source,
                                              MessageLevel level,
                                              const String& message,
                                              SourceLocation* location) {
  if (LocalFrame* frame = toFrame(context))
    frame->console().reportMessageToClient(source, level, message, location);
}
void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback)
{  
    if (dumpNotification)
        printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData());

    QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context);
    if (iter != m_pendingPermissionRequests.end())
        iter.value().m_callbacks.append(callback);
    else {
        RefPtr<VoidCallback> cb = callback;
        CallbacksInfo info;
        info.m_frame = toFrame(context);
        info.m_callbacks.append(cb);
        m_pendingPermissionRequests.insert(context, info);

        if (toPage(context) && toFrame(context)) {
            m_pendingPermissionRequests.insert(context, info);
            emit toPage(context)->featurePermissionRequested(toFrame(context), QWebPage::Notifications);
        }
    }
}
예제 #4
0
DgProjFullerFwd::DgProjFullerFwd (const DgRF<DgGeoCoord, long double>& from,
                    const DgRF<DgProjTriCoord, long double>& to)
         : DgConverter<DgGeoCoord, long double, DgProjTriCoord, long double>(from, to) 
{ 
   pProjTriRF_= dynamic_cast<const DgProjTriRF*>(&toFrame());

   if (!pProjTriRF_)
   {
      report("DgProjFullerFwd::DgProjFullerFwd(): "
        " toFrame not of type DgProjTriRF", DgBase::Fatal);
   }

} // DgProjFullerFwd::DgProjFullerFwd 
예제 #5
0
int MainThreadDebugger::contextGroupId(ExecutionContext* context) {
  LocalFrame* frame = toFrame(context);
  return frame ? contextGroupId(frame) : 0;
}