2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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/. */
|
1999-08-22 18:40:41 +04:00
|
|
|
|
2000-03-31 14:13:22 +04:00
|
|
|
#include "nsString.h"
|
1999-08-22 18:40:41 +04:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsISocketProvider.h"
|
2003-09-12 00:32:33 +04:00
|
|
|
#include "nsSocketProviderService.h"
|
2012-07-27 18:03:27 +04:00
|
|
|
#include "nsError.h"
|
1999-08-22 18:40:41 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-06-10 22:11:40 +04:00
|
|
|
nsresult
|
1999-08-22 18:40:41 +04:00
|
|
|
nsSocketProviderService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
2003-09-12 00:32:33 +04:00
|
|
|
nsCOMPtr<nsISocketProviderService> inst = new nsSocketProviderService();
|
|
|
|
if (!inst)
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
else
|
|
|
|
rv = inst->QueryInterface(aIID, aResult);
|
1999-08-22 18:40:41 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsSocketProviderService, nsISocketProviderService)
|
1999-08-22 18:40:41 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2003-09-12 00:32:33 +04:00
|
|
|
nsSocketProviderService::GetSocketProvider(const char *type,
|
|
|
|
nsISocketProvider **result)
|
1999-08-22 18:40:41 +04:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString contractID(
|
2003-09-12 00:32:33 +04:00
|
|
|
NS_LITERAL_CSTRING(NS_NETWORK_SOCKET_CONTRACTID_PREFIX) +
|
|
|
|
nsDependentCString(type));
|
1999-08-22 18:40:41 +04:00
|
|
|
|
2003-09-12 00:32:33 +04:00
|
|
|
rv = CallGetService(contractID.get(), result);
|
1999-08-22 18:40:41 +04:00
|
|
|
if (NS_FAILED(rv))
|
2003-09-12 00:32:33 +04:00
|
|
|
rv = NS_ERROR_UNKNOWN_SOCKET_TYPE;
|
|
|
|
return rv;
|
1999-08-22 18:40:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|