netwerk/socket/nsSocketProviderService.cpp

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

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

mercurial