bool GNonPreSetPageLoaderManager::CanProcessRequest(GAbsPageLoadRequest* pRequest)
{
	LOG_LEVEL4("CanProcessRequest()");

	bool bSomePageLoaderIsActive(false);
	bool bSomePageLoaderIsLoadingAPage(false);

	if( !GetActivePageLoader().isNull() )
	{
		bSomePageLoaderIsActive = true;
	}

	if( !GetWaitingForLoadingPagePageLoader().isNull() )
	{
		bSomePageLoaderIsLoadingAPage = true;
	}

	if( pRequest->GetTypeOfRequest() == GAbsPageLoadRequest::eLoadEntirePageRequest )
	{
		if( bSomePageLoaderIsActive && bSomePageLoaderIsLoadingAPage )
		{
			return false;
		}
	}
	else if( (pRequest->GetTypeOfRequest() == GAbsPageLoadRequest::eUpdateCurrentPageRequest) ||
			 (pRequest->GetTypeOfRequest() == GAbsPageLoadRequest::eUpdateURLCurrentPageRequest) )
	{
		if( !bSomePageLoaderIsActive )
		{
			return false;
		}
		else
		{
			if( GetCurrentSessionId() != pRequest->GetSessionId() )
			{
				static QString const strTemp("Warning request has a diferent session_id, current session id (%1), request session id (%2).");
				LOG_LEVEL1(QString(strTemp).arg(GetCurrentSessionId()).arg(pRequest->GetSessionId()));

				// We need to accept all types of request at any time.
				// 14/01/2010
				//return false;
			}
		}
	}
	else
	{
		LOG_LEVEL1("This type of request is unsupported(eSetPreloadedPagesRequest or eUpdatePreloadedPageRequest).");
		return false;
	}

	return true;
}
示例#2
0
文件: device.c 项目: dokan-dev/dokany
NTSTATUS
GlobalDeviceControl(__in PDEVICE_OBJECT DeviceObject, __in PIRP Irp) {
  PIO_STACK_LOCATION irpSp;
  PDOKAN_GLOBAL dokanGlobal;
  NTSTATUS status = STATUS_NOT_IMPLEMENTED;

  DDbgPrint("   => DokanGlobalDeviceControl\n");
  irpSp = IoGetCurrentIrpStackLocation(Irp);
  dokanGlobal = DeviceObject->DeviceExtension;

  switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {
  case IOCTL_EVENT_START:
    DDbgPrint("  IOCTL_EVENT_START\n");
    status = DokanEventStart(DeviceObject, Irp);
    break;
  case IOCTL_SERVICE_WAIT:
    status = DokanRegisterPendingIrpForService(DeviceObject, Irp);
    break;
  case IOCTL_MOUNTPOINT_CLEANUP:
    RemoveSessionDevices(dokanGlobal, GetCurrentSessionId(Irp));
    status = STATUS_SUCCESS;
    break;
  case IOCTL_SET_DEBUG_MODE:
    if (irpSp->Parameters.DeviceIoControl.InputBufferLength >= sizeof(ULONG)) {
      g_Debug = *(ULONG *)Irp->AssociatedIrp.SystemBuffer;
      status = STATUS_SUCCESS;
    }
    DDbgPrint("  IOCTL_SET_DEBUG_MODE: %d\n", g_Debug);
    break;
  case IOCTL_EVENT_MOUNTPOINT_LIST:
    if (GetIdentifierType(dokanGlobal) != DGL) {
      return STATUS_INVALID_PARAMETER;
    }
    status = DokanGetMountPointList(DeviceObject, Irp, dokanGlobal);
    break;
  case IOCTL_TEST:
    if (irpSp->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(ULONG)) {
      *(ULONG *)Irp->AssociatedIrp.SystemBuffer = DOKAN_DRIVER_VERSION;
      Irp->IoStatus.Information = sizeof(ULONG);
      status = STATUS_SUCCESS;
    }
    break;
  case IOCTL_EVENT_RELEASE:
    DDbgPrint("  IOCTL_EVENT_RELEASE\n");
    status = DokanGlobalEventRelease(DeviceObject, Irp);
    break;
  default:
    PrintUnknownDeviceIoctlCode(
        irpSp->Parameters.DeviceIoControl.IoControlCode);
    status = STATUS_INVALID_PARAMETER;
    break;
  }

  DDbgPrint("   <= DokanGlobalDeviceControl\n");
  return status;
}
示例#3
0
//
//  Sync's the "Pause On Duck" state for the media player.
//
//  Either registers or unregisters for ducking notification.
//
void CMediaPlayer::SyncPauseOnDuck(bool PauseOnDuckChecked)
{
    LPWSTR sessionId = NULL;

    HRESULT hr = GetSessionManager2();

    //
    //  Retrieve the current session ID.  We'll use that to request that the ducking manager
    //  filter our notifications (so we only see ducking notifications for our session).
    //
    if (SUCCEEDED(hr))
    {
        hr = GetCurrentSessionId(&sessionId);

        //
        //  And either register or unregister for ducking notifications based on whether or not the Pause On Duck state is checked.
        //
        if (SUCCEEDED(hr))
        {
            if (PauseOnDuckChecked)
            {
                if (!_DuckingRegistered)
                {
                    hr = _SessionManager2->RegisterDuckNotification(sessionId, this);
                    if (SUCCEEDED(hr))
                    {
                        _DuckingRegistered = TRUE;
                    }
                }
            }
            else
            {
                if (_DuckingRegistered)
                {
                    hr = _SessionManager2->UnregisterDuckNotification(this);
                    if (SUCCEEDED(hr))
                    {
                        _DuckingRegistered = FALSE;
                    }
                }
            }

            if (FAILED(hr))
            {
                MessageBox(_AppWindow, L"Unable to register or unregister for ducking notifications", L"Sync Ducking Pause Error", MB_OK);
            }

            CoTaskMemFree(sessionId);
        }
    }
}