1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/telephony/TelephonyFactory.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "mozilla/dom/telephony/TelephonyFactory.h" 1.10 +#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL) 1.11 +#include "nsIGonkTelephonyProvider.h" 1.12 +#endif 1.13 +#include "nsServiceManagerUtils.h" 1.14 +#include "nsXULAppAPI.h" 1.15 +#include "ipc/TelephonyIPCProvider.h" 1.16 + 1.17 +USING_TELEPHONY_NAMESPACE 1.18 + 1.19 +/* static */ already_AddRefed<nsITelephonyProvider> 1.20 +TelephonyFactory::CreateTelephonyProvider() 1.21 +{ 1.22 + nsCOMPtr<nsITelephonyProvider> provider; 1.23 + 1.24 + if (XRE_GetProcessType() == GeckoProcessType_Content) { 1.25 + provider = new TelephonyIPCProvider(); 1.26 +#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL) 1.27 + } else { 1.28 + provider = do_CreateInstance(GONK_TELEPHONY_PROVIDER_CONTRACTID); 1.29 +#endif 1.30 + } 1.31 + 1.32 + return provider.forget(); 1.33 +}