toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 4; 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/. */
     6 #include "nsNetUtil.h"
     7 #include "nsIURI.h"
     9 #include "nsISystemProxySettings.h"
    10 #include "nsIServiceManager.h"
    11 #include "mozilla/ModuleUtils.h"
    12 #include "nsPrintfCString.h"
    13 #include "nsNetUtil.h"
    14 #include "nsISupportsPrimitives.h"
    15 #include "nsIURI.h"
    17 #include "AndroidBridge.h"
    19 class nsAndroidSystemProxySettings : public nsISystemProxySettings
    20 {
    21 public:
    22     NS_DECL_THREADSAFE_ISUPPORTS
    23     NS_DECL_NSISYSTEMPROXYSETTINGS
    25     nsAndroidSystemProxySettings() {};
    26     nsresult Init();
    28 private:
    29     ~nsAndroidSystemProxySettings() {};
    30 };
    32 NS_IMPL_ISUPPORTS(nsAndroidSystemProxySettings, nsISystemProxySettings)
    34 NS_IMETHODIMP
    35 nsAndroidSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly)
    36 {
    37   *aMainThreadOnly = true;
    38   return NS_OK;
    39 }
    42 nsresult
    43 nsAndroidSystemProxySettings::Init()
    44 {
    45     return NS_OK;
    46 }
    48 nsresult
    49 nsAndroidSystemProxySettings::GetPACURI(nsACString& aResult)
    50 {
    51     return NS_OK;
    52 }
    54 nsresult
    55 nsAndroidSystemProxySettings::GetProxyForURI(const nsACString & aSpec,
    56                                              const nsACString & aScheme,
    57                                              const nsACString & aHost,
    58                                              const int32_t      aPort,
    59                                              nsACString & aResult)
    60 {
    61     return mozilla::AndroidBridge::Bridge()->GetProxyForURI(aSpec, aScheme, aHost, aPort, aResult);
    62 }
    64 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAndroidSystemProxySettings, Init)
    66 #define NS_ANDROIDSYSTEMPROXYSERVICE_CID                    \
    67     {0xf01f0060, 0x3708, 0x478e,                            \
    68     {0xb9, 0x35, 0x3e, 0xce, 0x8b, 0xe2, 0x94, 0xb8}}
    70 NS_DEFINE_NAMED_CID(NS_ANDROIDSYSTEMPROXYSERVICE_CID);
    72 void test() {};
    74 static const mozilla::Module::CIDEntry kSysProxyCIDs[] = {
    75     { &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, nullptr, nsAndroidSystemProxySettingsConstructor },
    76     { nullptr }
    77 };
    79 static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
    80     { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID },
    81     { nullptr }
    82 };
    84 static const mozilla::Module kSysProxyModule = {
    85     mozilla::Module::kVersion,
    86     kSysProxyCIDs,
    87     kSysProxyContracts
    88 };
    90 NSMODULE_DEFN(nsAndroidProxyModule) = &kSysProxyModule;

mercurial