Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "nsString.h"
7 : #include "nsIServiceManager.h"
8 : #include "nsISocketProvider.h"
9 : #include "nsSocketProviderService.h"
10 : #include "nsError.h"
11 :
12 : ////////////////////////////////////////////////////////////////////////////////
13 :
14 : nsresult
15 0 : nsSocketProviderService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
16 : {
17 : nsresult rv;
18 0 : nsCOMPtr<nsISocketProviderService> inst = new nsSocketProviderService();
19 0 : if (!inst)
20 0 : rv = NS_ERROR_OUT_OF_MEMORY;
21 : else
22 0 : rv = inst->QueryInterface(aIID, aResult);
23 0 : return rv;
24 : }
25 :
26 0 : NS_IMPL_ISUPPORTS(nsSocketProviderService, nsISocketProviderService)
27 :
28 : ////////////////////////////////////////////////////////////////////////////////
29 :
30 : NS_IMETHODIMP
31 0 : nsSocketProviderService::GetSocketProvider(const char *type,
32 : nsISocketProvider **result)
33 : {
34 : nsresult rv;
35 : nsAutoCString contractID(
36 0 : NS_LITERAL_CSTRING(NS_NETWORK_SOCKET_CONTRACTID_PREFIX) +
37 0 : nsDependentCString(type));
38 :
39 0 : rv = CallGetService(contractID.get(), result);
40 0 : if (NS_FAILED(rv))
41 0 : rv = NS_ERROR_UNKNOWN_SOCKET_TYPE;
42 0 : return rv;
43 : }
44 :
45 : ////////////////////////////////////////////////////////////////////////////////
|