michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 "nsString.h" michael@0: #include "nsIServiceManager.h" michael@0: #include "nsISocketProvider.h" michael@0: #include "nsSocketProviderService.h" michael@0: #include "nsError.h" michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: nsresult michael@0: nsSocketProviderService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) michael@0: { michael@0: nsresult rv; michael@0: nsCOMPtr inst = new nsSocketProviderService(); michael@0: if (!inst) michael@0: rv = NS_ERROR_OUT_OF_MEMORY; michael@0: else michael@0: rv = inst->QueryInterface(aIID, aResult); michael@0: return rv; michael@0: } michael@0: michael@0: NS_IMPL_ISUPPORTS(nsSocketProviderService, nsISocketProviderService) michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: NS_IMETHODIMP michael@0: nsSocketProviderService::GetSocketProvider(const char *type, michael@0: nsISocketProvider **result) michael@0: { michael@0: nsresult rv; michael@0: nsAutoCString contractID( michael@0: NS_LITERAL_CSTRING(NS_NETWORK_SOCKET_CONTRACTID_PREFIX) + michael@0: nsDependentCString(type)); michael@0: michael@0: rv = CallGetService(contractID.get(), result); michael@0: if (NS_FAILED(rv)) michael@0: rv = NS_ERROR_UNKNOWN_SOCKET_TYPE; michael@0: return rv; michael@0: } michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////////