michael@0: /* -*- Mode: C++; tab-width: 4; 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 "nsNetUtil.h" michael@0: #include "nsIURI.h" michael@0: michael@0: #include "nsISystemProxySettings.h" michael@0: #include "nsIServiceManager.h" michael@0: #include "mozilla/ModuleUtils.h" michael@0: #include "nsPrintfCString.h" michael@0: #include "nsNetUtil.h" michael@0: #include "nsISupportsPrimitives.h" michael@0: #include "nsIURI.h" michael@0: michael@0: #include "AndroidBridge.h" michael@0: michael@0: class nsAndroidSystemProxySettings : public nsISystemProxySettings michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSISYSTEMPROXYSETTINGS michael@0: michael@0: nsAndroidSystemProxySettings() {}; michael@0: nsresult Init(); michael@0: michael@0: private: michael@0: ~nsAndroidSystemProxySettings() {}; michael@0: }; michael@0: michael@0: NS_IMPL_ISUPPORTS(nsAndroidSystemProxySettings, nsISystemProxySettings) michael@0: michael@0: NS_IMETHODIMP michael@0: nsAndroidSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) michael@0: { michael@0: *aMainThreadOnly = true; michael@0: return NS_OK; michael@0: } michael@0: michael@0: michael@0: nsresult michael@0: nsAndroidSystemProxySettings::Init() michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: nsresult michael@0: nsAndroidSystemProxySettings::GetPACURI(nsACString& aResult) michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: nsresult michael@0: nsAndroidSystemProxySettings::GetProxyForURI(const nsACString & aSpec, michael@0: const nsACString & aScheme, michael@0: const nsACString & aHost, michael@0: const int32_t aPort, michael@0: nsACString & aResult) michael@0: { michael@0: return mozilla::AndroidBridge::Bridge()->GetProxyForURI(aSpec, aScheme, aHost, aPort, aResult); michael@0: } michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAndroidSystemProxySettings, Init) michael@0: michael@0: #define NS_ANDROIDSYSTEMPROXYSERVICE_CID \ michael@0: {0xf01f0060, 0x3708, 0x478e, \ michael@0: {0xb9, 0x35, 0x3e, 0xce, 0x8b, 0xe2, 0x94, 0xb8}} michael@0: michael@0: NS_DEFINE_NAMED_CID(NS_ANDROIDSYSTEMPROXYSERVICE_CID); michael@0: michael@0: void test() {}; michael@0: michael@0: static const mozilla::Module::CIDEntry kSysProxyCIDs[] = { michael@0: { &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, nullptr, nsAndroidSystemProxySettingsConstructor }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = { michael@0: { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module kSysProxyModule = { michael@0: mozilla::Module::kVersion, michael@0: kSysProxyCIDs, michael@0: kSysProxyContracts michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsAndroidProxyModule) = &kSysProxyModule;