NS_IMETHODIMP
nsBaseCommandController::GetInterface(const nsIID& aIID, void** aResult)
{
  NS_ENSURE_ARG_POINTER(aResult);

  if (NS_SUCCEEDED(QueryInterface(aIID, aResult))) {
    return NS_OK;
  }

  if (aIID.Equals(NS_GET_IID(nsIControllerCommandTable))) {
    if (mCommandTable) {
      return mCommandTable->QueryInterface(aIID, aResult);
    }
    return NS_ERROR_NOT_INITIALIZED;
  }

  return NS_NOINTERFACE;
}
NS_IMETHODIMP sbSeekableChannel::GetInterface(
    const nsIID                 &iid,
    void                        **ppInterface)
{
    void                        *pInterface = nsnull;
    nsresult                    result = NS_OK;

    /* Validate parameters. */
    NS_ENSURE_ARG_POINTER(ppInterface);

    /* Query component for the interface. */
    result = QueryInterface(iid, &pInterface);

    /* Return results. */
    *ppInterface = pInterface;

    return (result);
}
Exemple #3
0
extern "C" HRESULT STDMETHODCALLTYPE DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
    // {67fb642f-51cd-4745-8b21-aacd2ec74e62}
    const GUID CLSID_CorProfiler = { 0x67fb642f, 0x51cd, 0x4745, { 0x8b, 0x21, 0xaa, 0xcd, 0x2e, 0xc7, 0x4e, 0x62 } };

    if (ppv == nullptr || rclsid != CLSID_CorProfiler)
    {
        return E_FAIL;
    }

    auto factory = new ClassFactory;
    if (factory == nullptr)
    {
        return E_FAIL;
    }

    return factory->QueryInterface(riid, ppv);
}
HRESULT tomEditCallback::GetClipboardData(THIS_ CHARRANGE FAR * lpchrg, DWORD reco,
                                          LPDATAOBJECT FAR * lplpdataobj) 
{
    // 没有选中任何东西
    if (lpchrg->cpMin == lpchrg->cpMax)
        return E_NOTIMPL ;

    // 获得当前选择内容类型:纯文本、单个图像对象、图文混合
    WORD selection_type = m_edit->GetSelectionType() ;

    if ((selection_type & SEL_TEXT) && !(selection_type & SEL_OBJECT))
    {
        // 纯文本,执行缺省操作即可
        // 但缺省操作会复制富文本的格式、颜色等,所以还得自行处理
        return E_NOTIMPL ;
    }
    else if (selection_type == SEL_OBJECT)
    {
        // 单个图像对象,要提供CF_BITMAP/CF_DIB、CF_HTML、CF_HDROP和内部标准格式
        // 获得图像对象
        REOBJECT reo ;
        reo.cbStruct = sizeof(reo) ;
        reo.cp = lpchrg->cpMin ;
        if (S_OK == m_edit->GetObject(REO_IOB_USE_CP, &reo, REO_GETOBJ_POLEOBJ))
        {
            *lplpdataobj = NULL ;
            reo.poleobj->QueryInterface(IID_IDataObject, (void**)lplpdataobj) ;
            reo.poleobj->Release() ;
            if (*lplpdataobj != NULL)
                return S_OK ;
        }
    }
    else if ((selection_type & (SEL_OBJECT)) && (selection_type & SEL_TEXT))
    {
        // 图文混合
        if (PrepareClipboardData() && S_OK == QueryInterface(IID_IDataObject, (void**)lplpdataobj))
        {
            if (*lplpdataobj != NULL)
                return S_OK ;
        }
    }

    return E_NOTIMPL ;
}
Exemple #5
0
VALUE CRScriptCore::GetOleObject(VALUE self, LPCOLESTR pstrName)
{
	ItemMapIter it = m_mapItem.find(pstrName);
	if (it == m_mapItem.end())
	{
		it = (m_mapItem.insert(ItemMap::value_type(pstrName, new CItemHolder))).first;
	}

	VALUE obj = Qnil;
	IDispatch* pDisp = NULL;
	IActiveScriptSite* pSite = GetSite();
	if (pSite)
	{
		pDisp = (*it).second->GetDispatch(pSite, const_cast<LPOLESTR>(pstrName), (m_dwThreadID == GetCurrentThreadId()));
		pSite->Release();
	}
	if (pDisp)
	{
		oledataex *pole;
		// setting free function is not required. because ScriptEngine hold it.
		obj = Data_Make_Struct(self, oledataex, 0, 0, pole);
#ifdef __IRubyWrapper_INTERFACE_DEFINED__
		IDispatchEx* pEx;
		if (QueryInterface(IID_IRubyEngine, (void**)&pole->pEngine) == S_OK)
		{
			// adjust ref count (because never release the ptr in WIN32OLEEX)
			pole->pEngine->Release();
		}
		if (pDisp->QueryInterface(IID_IDispatchEx, (void**)&pEx) == S_OK)
		{
			pole->pDispatch = pEx;
			pole->pServiceProvider = this;
			pDisp->Release();
		}
		else
#endif
		{
			pole->pDispatch = pDisp;
		}
		ATLTRACE(_T("add OLE Object into list:%08X\n"), pole);
		m_listOleObj.push_back(reinterpret_cast<oledata*>(pole));
	}
	return obj;
}
Exemple #6
0
entity_id_t CComponentManager::AddEntity(const std::wstring& templateName, entity_id_t ent)
{
	ICmpTemplateManager *cmpTemplateManager = static_cast<ICmpTemplateManager*> (QueryInterface(SYSTEM_ENTITY, IID_TemplateManager));
	if (!cmpTemplateManager)
	{
		debug_warn(L"No ICmpTemplateManager loaded");
		return INVALID_ENTITY;
	}

	// TODO: should assert that ent doesn't exist

	const CParamNode* tmpl = cmpTemplateManager->LoadTemplate(ent, utf8_from_wstring(templateName), -1);
	if (!tmpl)
		return INVALID_ENTITY; // LoadTemplate will have reported the error

	// Construct a component for each child of the root element
	const CParamNode::ChildrenMap& tmplChilds = tmpl->GetChildren();
	for (CParamNode::ChildrenMap::const_iterator it = tmplChilds.begin(); it != tmplChilds.end(); ++it)
	{
		// Ignore attributes on the root element
		if (it->first.length() && it->first[0] == '@')
			continue;

		CComponentManager::ComponentTypeId cid = LookupCID(it->first);
		if (cid == CID__Invalid)
		{
			LOGERROR(L"Unrecognised component type name '%hs' in entity template '%ls'", it->first.c_str(), templateName.c_str());
			return INVALID_ENTITY;
		}

		if (!AddComponent(ent, cid, it->second))
		{
			LOGERROR(L"Failed to construct component type name '%hs' in entity template '%ls'", it->first.c_str(), templateName.c_str());
			return INVALID_ENTITY;
		}

		// TODO: maybe we should delete already-constructed components if one of them fails?
	}

	CMessageCreate msg(ent);
	PostMessage(ent, msg);

	return ent;
}
Exemple #7
0
int DX11Engine::getOutput(IUnknown* pDevice, IUnknown** pOutputs, int sz) const {
    auto ptr = reinterpret_cast<ID3D11Device*>(pDevice);
    HRESULT hr = S_OK;
    std::unique_ptr<IDXGIDevice, COMDeleter>    pDXGIDevice;
    std::unique_ptr<IDXGIAdapter, COMDeleter>   pDXGIAdapter;

    V(ptr->QueryInterface(__uuidof(IDXGIDevice), ref(pDXGIDevice)));
    V(pDXGIDevice->GetParent(__uuidof(IDXGIAdapter), ref(pDXGIAdapter)));

    UINT i = 0;
    std::unique_ptr<IDXGIOutput, COMDeleter> pOutput;
    while (pDXGIAdapter->EnumOutputs(i, ref(pOutput)) != DXGI_ERROR_NOT_FOUND && 
        i < uint32_t(sz))
    {
        pOutputs[i] = pOutput.release();
        ++i;
    }
    return i;
}
NS_INTERFACE_MAP_END


///////////////////////////////////////////////////////////////////////////////
// nsIInterfaceRequestor

NS_IMETHODIMP CWebBrowserContainer::GetInterface(const nsIID & aIID, void * *result)
{
    *result = 0;
    if (aIID.Equals(NS_GET_IID(nsIDOMWindow)))
    {
        if (mOwner && mOwner->mWebBrowser)
        {
            return mOwner->mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) result);
        }
        return NS_ERROR_NOT_INITIALIZED;
    }
    return QueryInterface(aIID, result);
}
NS_INTERFACE_MAP_END

////////////////////////////////////////////////////////////////////////////////


/* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
NS_IMETHODIMP 
BrowserWindow::GetInterface(const nsIID & aIID, void * *aInstancePtr)
{
	if ( aIID.Equals( NS_GET_IID( nsIDOMWindow ) ) ) {
		if ( webBrowser ) {
			return webBrowser->GetContentDOMWindow( ( nsIDOMWindow** )aInstancePtr );
		};

		return NS_ERROR_NOT_INITIALIZED;
	};

	return QueryInterface( aIID, aInstancePtr );
}
Exemple #10
0
HRESULT CDwnDoc::QueryService(BOOL fBindOnApt, REFGUID rguid, REFIID riid, void** ppvObj)
{
    HRESULT hr;

    if((rguid==IID_IAuthenticate || rguid==IID_IWindowForBindingUI) && (rguid==riid))
    {
        hr = QueryInterface(rguid, ppvObj);
    }
    else if(fBindOnApt && IsDocThread() && _pDoc)
    {
        hr = _pDoc->QueryService(rguid, riid, ppvObj);
    }
    else
    {
        *ppvObj = NULL;
        hr = E_NOINTERFACE;
    }

    return hr;
}
    HRESULT PendingBreakpoint::SendBoundEvent( IEnumDebugBoundBreakpoints2* enumBPs )
    {
        HRESULT hr = S_OK;
        CComPtr<IDebugPendingBreakpoint2>       pendBP;
        CComPtr<IDebugEngine2>                  engine;
        RefPtr<BreakpointBoundEvent>            event;

        hr = QueryInterface( __uuidof( IDebugPendingBreakpoint2 ), (void**) &pendBP );
        _ASSERT( hr == S_OK );

        hr = mEngine->QueryInterface( __uuidof( IDebugEngine2 ), (void**) &engine );
        _ASSERT( hr == S_OK );

        hr = MakeCComObject( event );
        if ( FAILED( hr ) )
            return hr;

        event->Init( enumBPs, pendBP );

        return event->Send( mCallback, engine, NULL, NULL );
    }
NS_INTERFACE_MAP_END

//*****************************************************************************
// WebBrowserChrome::nsIInterfaceRequestor
//*****************************************************************************   

NS_IMETHODIMP WebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstancePtr)
{
    NS_ENSURE_ARG_POINTER(aInstancePtr);

    *aInstancePtr = 0;
    if (aIID.Equals(NS_GET_IID(nsIDOMWindow)))
    {
        if (mWebBrowser)
        {
            return mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr);
        }
        return NS_ERROR_NOT_INITIALIZED;
    }
    return QueryInterface(aIID, aInstancePtr);
}
Exemple #13
0
NS_IMETHODIMP
FetchDriver::GetInterface(const nsIID& aIID, void **aResult)
{
  if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
    *aResult = static_cast<nsIChannelEventSink*>(this);
    NS_ADDREF_THIS();
    return NS_OK;
  }
  if (aIID.Equals(NS_GET_IID(nsIStreamListener))) {
    *aResult = static_cast<nsIStreamListener*>(this);
    NS_ADDREF_THIS();
    return NS_OK;
  }
  if (aIID.Equals(NS_GET_IID(nsIRequestObserver))) {
    *aResult = static_cast<nsIRequestObserver*>(this);
    NS_ADDREF_THIS();
    return NS_OK;
  }

  return QueryInterface(aIID, aResult);
}
HRESULT FFmpegDecodeFilter::GetService(REFIID riid, void** ppv)
{
	std::lock_guard<decltype(_mutex)> lock(_mutex);

	if (_services == NULL) {
		avcodec_register_all();
		av_lockmgr_register(&AVCodecMTLockCallback); //or to use InitOnceExecuteOnce.

		auto p = new(std::nothrow) FFmpegDecodeServices();
		if (p == NULL)
			return E_OUTOFMEMORY;
		p->QueryInterface(IID_PPV_ARGS(&_services));
		p->Release();
	}

	if (ppv == NULL)
		return E_POINTER;
	if (_services == NULL)
		return E_ABORT;
	return _services->QueryInterface(riid, ppv);
}
Exemple #15
0
STDMETHODIMP CVideoViewControl::OnInitialized(IServiceProvider *pServiceProvider)
{
	CHECK_E_POINTER(pServiceProvider);
	m_pServiceProvider = pServiceProvider;

	CComPtr<IUnknown> pUnk;
	RETURN_IF_FAILED(QueryInterface(__uuidof(IUnknown), (LPVOID*)&pUnk));

	STARTUPINFO si = { 0 };
	PROCESS_INFORMATION pi = { 0 };
	auto wstrParams = std::to_wstring((long long)m_hWnd);
	CString strCmdLine(L"minitwivp.exe");
	strCmdLine += CString(L" ") + wstrParams.c_str();
	TCHAR lpszCmdLine[100];
	wcscpy(lpszCmdLine, strCmdLine);
	auto res = CreateProcess(
		NULL,
		lpszCmdLine,
		NULL,
		NULL,
		FALSE,
		NULL,
		NULL,
		NULL,
		&si,
		&pi
		);
	
	if (!res)
	{
		HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
		HandleError(hr);
	}

    CloseHandle(pi.hThread);
	m_hProcess = pi.hProcess;
	SetTimer(1, 10 * 1000); //waiting for child process init

	return S_OK;
}
// Retrieves a service interface.
HRESULT STDMETHODCALLTYPE EVRCustomPresenter::GetService(REFGUID guidService, REFIID riid, LPVOID *ppvObject)
{
  HRESULT hr = S_OK;

  CheckPointer(ppvObject, E_POINTER);

  // The only service GUID that we support is MR_VIDEO_RENDER_SERVICE.
  if (guidService != MR_VIDEO_RENDER_SERVICE)
  {
    return MF_E_UNSUPPORTED_SERVICE;
  }

  // First try to get the service interface from the D3DPresentEngine object.
  hr = m_pD3DPresentEngine->GetService(guidService, riid, ppvObject);
  if (FAILED(hr))
  {
     // Next, query interface to check if this object supports the interface.
     hr = QueryInterface(riid, ppvObject);
  }

  return hr;
}
void SingleCellViewSimulationData::newIntegrationRun()
{
    if (!mRuntime || !mRuntime->isValid())
        return;
    if (isDAETypeSolver() ? !mRuntime->daeCompiledModel() :
        !mRuntime->odeCompiledModel())
        return;

    ObjRef<iface::cellml_services::CellMLIntegrationService> cis(CreateIntegrationService());
    if (isDAETypeSolver())
        mIntegrationRun = cis->createDAEIntegrationRun(mRuntime->daeCompiledModel());
    else
    {
        mIntegrationRun = cis->createODEIntegrationRun(mRuntime->odeCompiledModel());
        ObjRef<iface::cellml_services::ODESolverRun>
            odeRun(QueryInterface(mIntegrationRun));

        // TODO have more options than just 'CVODE', allowing user to specify
        // which CVODE solver.
        odeRun->stepType(iface::cellml_services::BDF_IMPLICIT_1_5_SOLVE);
    }
}
BOOL CSampleIME::_InitFunctionProviderSink()
{
    ITfSourceSingle* pSourceSingle = nullptr;
    BOOL ret = FALSE;
    if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_ITfSourceSingle, (void **)&pSourceSingle)))
    {
        IUnknown* punk = nullptr;
        if (SUCCEEDED(QueryInterface(IID_IUnknown, (void **)&punk)))
        {
            if (SUCCEEDED(pSourceSingle->AdviseSingleSink(_tfClientId, IID_ITfFunctionProvider, punk)))
            {
                if (SUCCEEDED(CSearchCandidateProvider::CreateInstance(&_pITfFnSearchCandidateProvider, (ITfTextInputProcessorEx*)this)))
                {
                    ret = TRUE;
                }
            }
            punk->Release();
        }
        pSourceSingle->Release();
    }
    return ret;
}
STDMETHODIMP CTimelineLoadingService::OnInitialized(IServiceProvider *pServiceProvider)
{
	CHECK_E_POINTER(pServiceProvider);
	m_pServiceProvider = pServiceProvider;

	CComQIPtr<ITimelineControlSupport> pTimelineControlSupport = m_pControl;
	ATLASSERT(pTimelineControlSupport);
	RETURN_IF_FAILED(pTimelineControlSupport->GetTimelineControl(&m_pTimelineControl));

	CComPtr<IUnknown> pUnk;
	RETURN_IF_FAILED(QueryInterface(__uuidof(IUnknown), (LPVOID*)&pUnk));

	RETURN_IF_FAILED(pServiceProvider->QueryService(SERVICE_TIMELINE_UPDATE_THREAD, &m_pThreadServiceUpdateService));
	RETURN_IF_FAILED(AtlAdvise(m_pThreadServiceUpdateService, pUnk, __uuidof(IThreadServiceEventSink), &m_dwAdviceThreadServiceUpdateService));

	RETURN_IF_FAILED(pServiceProvider->QueryService(SERVICE_TIMELINE_SHOWMORE_THREAD, &m_pThreadServiceShowMoreService));
	if (m_pThreadServiceShowMoreService)
	{
		RETURN_IF_FAILED(AtlAdvise(m_pThreadServiceShowMoreService, pUnk, __uuidof(IThreadServiceEventSink), &m_dwAdviceThreadServiceShowMoreService));
	}

	return S_OK;
}
Exemple #20
0
// IOMEventHandler
STDMETHODIMP CEventHandler::Init(DOCSObjects::IApplication * piApp)
{
	CComQIPtr<DOCSObjects::IApplication> pApp( piApp );
	
	try
	{
		VHELPERLib::IVBConnectorPtr pVBConnector;		
		HRESULT hr = pVBConnector.CreateInstance( __uuidof( VHELPERLib::VBConnector ));		
		
		if( SUCCEEDED( hr ))
		{
			IUnknown* pUnk;
			QueryInterface( IID_IUnknown, (void **)&pUnk );
			
			pVBConnector->Connect( pApp, pUnk );		
		}
	}
	catch(...)
	{
		LOG_WS_ERROR(_T("Failed to connect to events source"));
	}
	return S_OK;
}
Exemple #21
0
STDMETHODIMP VLCPersistStorage::Load(LPSTORAGE pStg)
{
    if( NULL == pStg )
        return E_INVALIDARG;

    LPSTREAM pStm = NULL;
    HRESULT result = pStg->OpenStream(L"VideoLAN ActiveX Plugin Data", NULL,
                        STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &pStm);

    if( FAILED(result) )
        return result;

    LPPERSISTSTREAMINIT pPersistStreamInit;
    if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit, (void **)&pPersistStreamInit)) )
    {
        result = pPersistStreamInit->Load(pStm);
        pPersistStreamInit->Release();
    }

    pStm->Release();

    return result;
};
NS_INTERFACE_MAP_END

//*****************************************************************************
// nsChromeTreeOwner::nsIInterfaceRequestor
//*****************************************************************************   

NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
{
  NS_ENSURE_ARG_POINTER(aSink);

  if(aIID.Equals(NS_GET_IID(nsIPrompt))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if(aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if(aIID.Equals(NS_GET_IID(nsIWebBrowserChrome))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow2))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->GetInterface(aIID, aSink);
  }
  if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->QueryInterface(aIID, aSink);
  }

  return QueryInterface(aIID, aSink);
}
STDMETHODIMP
CRNGenericContext::GetService( REFIID iid, void** ppIService )
{
    HX_ASSERT( ppIService );
    
    HX_RESULT result = HXR_FAIL;
    if ( ppIService )
    {
	*ppIService = NULL;

	result = QueryInterface( iid, ppIService );
	if( FAILED( result ) )
	{
	    // Look in the parent context
	    SPIHXContext spParentContext = m_pFactory;

	    if ( spParentContext.IsValid() )
	    {
		result = spParentContext->GetService( iid, ppIService );
	    }
	}
    }
    return result;
}
Exemple #24
0
STDMETHODIMP
nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
{
  static const GUID IID_SimpleDOMDeprecated = {0x0c539790,0x12e4,0x11cf,0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8};
  if (guidService != IID_ISimpleDOMNode &&
      guidService != IID_SimpleDOMDeprecated &&
      guidService != IID_IAccessible &&  guidService != IID_IAccessible2 &&
      guidService != IID_IAccessibleApplication)
    return E_INVALIDARG;

  // Can get to IAccessibleApplication from any node via QS
  if (iid == IID_IAccessibleApplication) {
    nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
    if (!applicationAcc)
      return E_NOINTERFACE;

    nsresult rv = applicationAcc->QueryNativeInterface(iid, ppv);
    return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE;
  }

  /**
   * To get an ISimpleDOMNode, ISimpleDOMDocument, ISimpleDOMText
   * or any IAccessible2 interface on should use IServiceProvider like this:
   * -----------------------------------------------------------------------
   * ISimpleDOMDocument *pAccDoc = NULL;
   * IServiceProvider *pServProv = NULL;
   * pAcc->QueryInterface(IID_IServiceProvider, (void**)&pServProv);
   * if (pServProv) {
   *   const GUID unused;
   *   pServProv->QueryService(unused, IID_ISimpleDOMDocument, (void**)&pAccDoc);
   *   pServProv->Release();
   * }
   */

  return QueryInterface(iid, ppv);
}
HRESULT HDMediaSource::GetService(REFGUID guidService,REFIID riid,LPVOID *ppvObject)
{
	if (ppvObject == nullptr)
		return E_POINTER;

	if (guidService == MF_RATE_CONTROL_SERVICE) { //针对Store应用必须提供IMFRateControl接口
		return QueryInterface(riid,ppvObject);
	}else if (guidService == MF_METADATA_PROVIDER_SERVICE) {
#if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
		return QueryInterface(riid,ppvObject);
#else
		CHAR szBuffer[MAX_PATH] = {};
		GetModuleFileNameA(nullptr,szBuffer,ARRAYSIZE(szBuffer));
		PathStripPathA(szBuffer);
		if (GetModuleHandleA("wmp.dll"))
		{
			if (_pMetadata)
			{
				ComPtr<IMFMetadata> pMetadata;
				if (SUCCEEDED(GetMFMetadata(_pPresentationDescriptor.Get(),0,0,pMetadata.GetAddressOf())))
					return QueryInterface(riid,ppvObject);
			}
		}else{
			return QueryInterface(riid,ppvObject);
		}
#endif
	}else if (guidService == MFNETSOURCE_STATISTICS_SERVICE) {
		if (_network_mode)
			return QueryInterface(riid,ppvObject);
	}else if (guidService == MF_SCRUBBING_SERVICE) {
		if (FAILED(MakeKeyFramesIndex()))
			return MF_E_UNSUPPORTED_SERVICE;
		return QueryInterface(riid,ppvObject);
	}

	return MF_E_UNSUPPORTED_SERVICE;
}
NS_IMETHODIMP
nsXFormsInstanceElement::GetInterface(const nsIID & aIID, void **aResult)
{
  *aResult = nsnull;
  return QueryInterface(aIID, aResult);
}
NS_IMETHODIMP nsMimeBaseEmitter::GetInterface(const nsIID & aIID, void * *aInstancePtr)
{
  NS_ENSURE_ARG_POINTER(aInstancePtr);
  return QueryInterface(aIID, aInstancePtr);
}
STDMETHODIMP
nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
{
  *ppv = nsnull;

  static const GUID IID_SimpleDOMDeprecated = {0x0c539790,0x12e4,0x11cf,0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8};

  // Provide a special service ID for getting the accessible for the browser tab
  // document that contains this accessible object. If this accessible object
  // is not inside a browser tab then the service fails with E_NOINTERFACE.
  // A use case for this is for screen readers that need to switch context or
  // 'virtual buffer' when focus moves from one browser tab area to another.
  static const GUID SID_IAccessibleContentDocument = {0xa5d8e1f3,0x3571,0x4d8f,0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e};

  if (guidService != IID_ISimpleDOMNode &&
      guidService != IID_SimpleDOMDeprecated &&
      guidService != IID_IAccessible &&  guidService != IID_IAccessible2 &&
      guidService != IID_IAccessibleApplication &&
      guidService != SID_IAccessibleContentDocument)
    return E_INVALIDARG;

  if (guidService == SID_IAccessibleContentDocument) {
    if (iid != IID_IAccessible)
      return E_NOINTERFACE;

    nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = 
      nsCoreUtils::GetDocShellTreeItemFor(mContent);
    if (!docShellTreeItem)
      return E_UNEXPECTED;

    // Walk up the parent chain without crossing the boundary at which item
    // types change, preventing us from walking up out of tab content.
    nsCOMPtr<nsIDocShellTreeItem> root;
    docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
    if (!root)
      return E_UNEXPECTED;


    // If the item type is typeContent, we assume we are in browser tab content.
    // Note this includes content such as about:addons, for consistency.
    PRInt32 itemType;
    root->GetItemType(&itemType);
    if (itemType != nsIDocShellTreeItem::typeContent)
      return E_NOINTERFACE;

    // Make sure this is a document.
    nsDocAccessible* docAcc = nsAccUtils::GetDocAccessibleFor(root);
    if (!docAcc)
      return E_UNEXPECTED;

    *ppv = static_cast<IAccessible*>(docAcc);

    (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
    return NS_OK;
  }

  // Can get to IAccessibleApplication from any node via QS
  if (iid == IID_IAccessibleApplication) {
    nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
    if (!applicationAcc)
      return E_NOINTERFACE;

    nsresult rv = applicationAcc->QueryNativeInterface(iid, ppv);
    return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE;
  }

  /**
   * To get an ISimpleDOMNode, ISimpleDOMDocument, ISimpleDOMText
   * or any IAccessible2 interface on should use IServiceProvider like this:
   * -----------------------------------------------------------------------
   * ISimpleDOMDocument *pAccDoc = NULL;
   * IServiceProvider *pServProv = NULL;
   * pAcc->QueryInterface(IID_IServiceProvider, (void**)&pServProv);
   * if (pServProv) {
   *   const GUID unused;
   *   pServProv->QueryService(unused, IID_ISimpleDOMDocument, (void**)&pAccDoc);
   *   pServProv->Release();
   * }
   */

  return QueryInterface(iid, ppv);
}
NS_IMETHODIMP
nsAccessNodeWrap::QueryNativeInterface(REFIID aIID, void** aInstancePtr)
{
  return QueryInterface(aIID, aInstancePtr);
}
Exemple #30
0
STDMETHODIMP CBaseGraph::FindInterface(REFIID iid, void** ppv, BOOL bRemove)
{
    return QueryInterface(iid, ppv);
}