michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIInterfaceRequestor.h" michael@0: #include "nsIInterfaceRequestorUtils.h" michael@0: michael@0: nsresult michael@0: nsGetInterface::operator()( const nsIID& aIID, void** aInstancePtr ) const michael@0: { michael@0: nsresult status; michael@0: michael@0: if ( mSource ) michael@0: { michael@0: nsCOMPtr factoryPtr = do_QueryInterface(mSource, &status); michael@0: michael@0: if ( factoryPtr ) michael@0: status = factoryPtr->GetInterface(aIID, aInstancePtr); michael@0: else michael@0: status = NS_ERROR_NO_INTERFACE; michael@0: } michael@0: else michael@0: status = NS_ERROR_NULL_POINTER; michael@0: michael@0: if ( NS_FAILED(status) ) michael@0: *aInstancePtr = 0; michael@0: if ( mErrorPtr ) michael@0: *mErrorPtr = status; michael@0: return status; michael@0: }