2002-06-11 23:36:42 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2002-06-11 23:36:42 +04:00
|
|
|
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsGetInterface::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
|
|
|
{
|
2005-11-06 21:31:09 +03:00
|
|
|
nsresult status;
|
2002-06-11 23:36:42 +04:00
|
|
|
|
2005-11-06 21:31:09 +03:00
|
|
|
if ( mSource )
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource, &status);
|
2002-06-11 23:36:42 +04:00
|
|
|
|
2005-11-06 21:31:09 +03:00
|
|
|
if ( factoryPtr )
|
|
|
|
status = factoryPtr->GetInterface(aIID, aInstancePtr);
|
|
|
|
else
|
|
|
|
status = NS_ERROR_NO_INTERFACE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
status = NS_ERROR_NULL_POINTER;
|
2002-06-11 23:36:42 +04:00
|
|
|
|
2010-04-16 17:03:00 +04:00
|
|
|
if ( NS_FAILED(status) )
|
|
|
|
*aInstancePtr = 0;
|
2005-11-06 21:31:09 +03:00
|
|
|
if ( mErrorPtr )
|
|
|
|
*mErrorPtr = status;
|
|
|
|
return status;
|
2002-06-11 23:36:42 +04:00
|
|
|
}
|