Bug 495674: Internet connection should be initiated if needed [r=biesi]

This commit is contained in:
Mark Finkle 2009-11-18 10:20:45 -05:00
parent 3d19ba525b
commit 2a60c72d7a
18 changed files with 650 additions and 14 deletions

View File

@ -630,6 +630,10 @@ LIBOSSO_LIBS = @LIBOSSO_LIBS@
LIBHILDONFM_CFLAGS = @LIBHILDONFM_CFLAGS@
LIBHILDONFM_LIBS = @LIBHILDONFM_LIBS@
MOZ_ENABLE_LIBCONIC = @MOZ_ENABLE_LIBCONIC@
LIBCONIC_CFLAGS = @LIBCONIC_CFLAGS@
LIBCONIC_LIBS = @LIBCONIC_LIBS@
MACOS_SDK_DIR = @MACOS_SDK_DIR@
NEXT_ROOT = @NEXT_ROOT@
GCC_VERSION = @GCC_VERSION@

View File

@ -6202,6 +6202,28 @@ MOZ_ARG_DISABLE_BOOL(zipwriter,
MOZ_ZIPWRITER=1 )
AC_SUBST(MOZ_ZIPWRITER)
dnl ========================================================
dnl = Disable libconic
dnl ========================================================
MOZ_ENABLE_LIBCONIC=1
MOZ_ARG_DISABLE_BOOL(libconic,
[ --disable-libconic Disable libconic],
MOZ_ENABLE_LIBCONIC=,
MOZ_ENABLE_LIBCONIC=1 )
if test -n "$MOZ_ENABLE_LIBCONIC"; then
PKG_CHECK_MODULES(LIBCONIC, conic,
MOZ_ENABLE_LIBCONIC=1,
MOZ_ENABLE_LIBCONIC=)
fi
if test "$MOZ_ENABLE_LIBCONIC"; then
AC_DEFINE(MOZ_ENABLE_LIBCONIC)
fi
AC_SUBST(MOZ_ENABLE_LIBCONIC)
AC_SUBST(LIBCONIC_CFLAGS)
AC_SUBST(LIBCONIC_LIBS)
dnl ========================================================
dnl = Hildon and OSSO checks
dnl ========================================================

View File

@ -92,6 +92,11 @@ CPPSRCS = \
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
CPPSRCS += nsURLHelperOS2.cpp
else
ifdef MOZ_ENABLE_LIBCONIC
CPPSRCS += nsAutodialMaemo.cpp
CPPSRCS += nsNativeConnectionHelper.cpp
LOCAL_INCLUDES += -I$(srcdir)/../../system/maemo
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
CPPSRCS += nsURLHelperWin.cpp
CPPSRCS += nsNativeConnectionHelper.cpp
@ -124,3 +129,7 @@ FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
DEFINES += -DIMPL_NS_NET
ifdef MOZ_ENABLE_LIBCONIC
OS_INCLUDES += $(GLIB_CFLAGS) $(LIBCONIC_CFLAGS)
endif

View File

@ -0,0 +1,77 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MaemoAutodial.
*
* The Initial Developer of the Original Code is
* Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremias Bosch <jeremias.bosch@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAutodialMaemo.h"
#include "nsNetCID.h"
#include "nsCOMPtr.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIServiceManager.h"
#include "nsMaemoNetworkManager.h"
nsAutodial::nsAutodial()
{
}
nsAutodial::~nsAutodial()
{
}
nsresult
nsAutodial::Init()
{
return NS_OK;
}
nsresult
nsAutodial::DialDefault(const PRUnichar* hostName)
{
if (nsMaemoNetworkManager::OpenConnectionSync())
return NS_OK;
return NS_ERROR_FAILURE;
}
PRBool
nsAutodial::ShouldDialOnNetworkError()
{
if (nsMaemoNetworkManager::IsConnected())
return PR_FALSE;
return PR_TRUE;
}

View File

@ -0,0 +1,59 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MaemoAutodial.
*
* The Initial Developer of the Original Code is
* Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremias Bosch <jeremias.bosch@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsAutodialMaemo_h__
#define nsAutodialMaemo_h__
#include "nspr.h"
#include "nscore.h"
class nsAutodial
{
public:
nsAutodial();
~nsAutodial();
nsresult Init();
// Dial the default RAS dialup connection.
nsresult DialDefault(const PRUnichar* hostName);
// Should we try to dial on network error?
PRBool ShouldDialOnNetworkError();
};
#endif /* nsAutodialMaemo_h__ */

View File

@ -73,7 +73,7 @@
#include "nsIPermissionManager.h"
#include "nsTArray.h"
#if defined(XP_WIN)
#if defined(XP_WIN) || defined(MOZ_ENABLE_LIBCONIC)
#include "nsNativeConnectionHelper.h"
#endif
@ -986,11 +986,10 @@ nsIOService::TrackNetworkLinkStatusForOffline()
// option is set to always autodial. If so, then we are
// always up for the purposes of offline management.
if (autodialEnabled) {
#if defined(XP_WIN)
// On Windows, need to do some registry checking to see if
// autodial is enabled at the OS level. Only if that is
// enabled are we always up for the purposes of offline
// management.
#if defined(XP_WIN) || defined(MOZ_ENABLE_LIBCONIC)
// On Windows and Maemo (libconic) we should first check with the OS
// to see if autodial is enabled. If it is enabled then we are
// allowed to manage the offline state.
if(nsNativeConnectionHelper::IsAutodialEnabled())
return SetOffline(PR_FALSE);
#else
@ -998,7 +997,7 @@ nsIOService::TrackNetworkLinkStatusForOffline()
#endif
}
}
PRBool isUp;
nsresult rv = mNetworkLinkService->GetIsLinkUp(&isUp);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -37,11 +37,15 @@
* ***** END LICENSE BLOCK ***** */
#include "nsNativeConnectionHelper.h"
#ifdef WINCE
#if defined(MOZ_ENABLE_LIBCONIC)
#include "nsAutodialMaemo.h"
#elif defined(WINCE)
#include "nsAutodialWinCE.h"
#else
#include "nsAutodialWin.h"
#endif
#include "nsIOService.h"
//-----------------------------------------------------------------------------
@ -51,15 +55,20 @@
PRBool
nsNativeConnectionHelper::OnConnectionFailed(const PRUnichar* hostName)
{
// On mobile platforms, instead of relying on the link service, we
// should ask the dialer directly. This allows the dialer to update
// link status more forcefully rather than passively watching link
// status changes.
#if !defined(MOZ_ENABLE_LIBCONIC) && !defined(WINCE_WINDOWS_MOBILE)
if (gIOService->IsLinkUp())
return PR_FALSE;
#endif
nsAutodial autodial;
if (autodial.ShouldDialOnNetworkError())
if (autodial.ShouldDialOnNetworkError())
return NS_SUCCEEDED(autodial.DialDefault(hostName));
else
return PR_FALSE;
return PR_FALSE;
}
PRBool

View File

@ -71,7 +71,7 @@
#include "nsIProgrammingLanguage.h"
#include "nsIClassInfoImpl.h"
#if defined(XP_WIN)
#if defined(XP_WIN) || defined(MOZ_ENABLE_LIBCONIC)
#include "nsNativeConnectionHelper.h"
#endif
@ -1265,7 +1265,7 @@ nsSocketTransport::RecoverFromError()
}
}
#if defined(XP_WIN)
#if defined(XP_WIN) || defined(MOZ_ENABLE_LIBCONIC)
// If not trying next address, try to make a connection using dialup.
// Retry if that connection is made.
if (!tryAgain) {

View File

@ -82,6 +82,11 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
../system/mac/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
endif
ifdef MOZ_ENABLE_LIBCONIC
SHARED_LIBRARY_LIBS += \
../system/maemo/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
endif
LOCAL_INCLUDES = \
-I$(srcdir)/../base/src \
-I$(srcdir)/../dns/src \
@ -107,6 +112,10 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
LOCAL_INCLUDES += -I$(srcdir)/../system/mac
endif
ifdef MOZ_ENABLE_LIBCONIC
LOCAL_INCLUDES += -I$(srcdir)/../system/maemo
endif
ifdef NECKO_COOKIES
SHARED_LIBRARY_LIBS += \
../cookie/src/$(LIB_PREFIX)neckocookie_s.$(LIB_SUFFIX) \

View File

@ -295,6 +295,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNotifyAddrListener, Init)
#elif defined(MOZ_WIDGET_COCOA)
#include "nsNetworkLinkService.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetworkLinkService, Init)
#elif defined(MOZ_ENABLE_LIBCONIC)
#include "nsMaemoNetworkLinkService.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMaemoNetworkLinkService, Init)
#endif
///////////////////////////////////////////////////////////////////////////////
@ -1160,6 +1163,12 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
NS_NETWORK_LINK_SERVICE_CONTRACTID,
nsNetworkLinkServiceConstructor
},
#elif defined(MOZ_ENABLE_LIBCONIC)
{ NS_NETWORK_LINK_SERVICE_CLASSNAME,
NS_NETWORK_LINK_SERVICE_CID,
NS_NETWORK_LINK_SERVICE_CONTRACTID,
nsMaemoNetworkLinkServiceConstructor
},
#endif
};

View File

@ -56,4 +56,8 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
DIRS += mac
endif
ifdef MOZ_ENABLE_LIBCONIC
DIRS += maemo
endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,51 @@
#
# * ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is MaemoAutodial.
#
# The Initial Developer of the Original Code is
# Nokia Corporation.
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jeremias Bosch <jeremias.bosch@gmail.com>
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = necko
LIBRARY_NAME = neckosystem_s
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
CPPSRCS += \
nsMaemoNetworkLinkService.cpp \
nsMaemoNetworkManager.cpp \
$(NULL)
include $(topsrcdir)/config/rules.mk
DEFINES += -DIMPL_NS_NET
OS_INCLUDES += $(GLIB_CFLAGS) $(LIBCONIC_CFLAGS)
LOCAL_INCLUDES += -I$(srcdir)/../../base/src

View File

@ -0,0 +1,93 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MaemoAutodial.
*
* The Initial Developer of the Original Code is
* Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremias Bosch <jeremias.bosch@gmail.com>
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaemoNetworkLinkService.h"
#include "nsCOMPtr.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsMaemoNetworkManager.h"
NS_IMPL_ISUPPORTS2(nsMaemoNetworkLinkService,
nsINetworkLinkService,
nsIObserver)
nsMaemoNetworkLinkService::nsMaemoNetworkLinkService()
{
}
nsMaemoNetworkLinkService::~nsMaemoNetworkLinkService()
{
}
NS_IMETHODIMP
nsMaemoNetworkLinkService::GetIsLinkUp(PRBool *aIsUp)
{
*aIsUp = nsMaemoNetworkManager::IsConnected();
return NS_OK;
}
NS_IMETHODIMP
nsMaemoNetworkLinkService::GetLinkStatusKnown(PRBool *aIsKnown)
{
*aIsKnown = nsMaemoNetworkManager::GetLinkStatusKnown();
return NS_OK;
}
NS_IMETHODIMP
nsMaemoNetworkLinkService::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *aData)
{
if (!strcmp(aTopic, "xpcom-shutdown"))
Shutdown();
return NS_OK;
}
nsresult
nsMaemoNetworkLinkService::Init(void)
{
nsresult rv;
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = observerService->AddObserver(this, "xpcom-shutdown", PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
if (!nsMaemoNetworkManager::Startup())
return NS_ERROR_FAILURE;
return NS_OK;
}
nsresult
nsMaemoNetworkLinkService::Shutdown()
{
nsMaemoNetworkManager::Shutdown();
return NS_OK;
}

View File

@ -0,0 +1,47 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MaemoAutodial.
*
* The Initial Developer of the Original Code is
* Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremias Bosch <jeremias.bosch@gmail.com>
*
* ***** END LICENSE BLOCK ***** */
#ifndef NSMAEMONETWORKLINKSERVICE_H_
#define NSMAEMONETWORKLINKSERVICE_H_
#include "nsINetworkLinkService.h"
#include "nsIObserver.h"
class nsMaemoNetworkLinkService: public nsINetworkLinkService,
public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSINETWORKLINKSERVICE
NS_DECL_NSIOBSERVER
nsMaemoNetworkLinkService();
virtual ~nsMaemoNetworkLinkService();
nsresult Init();
nsresult Shutdown();
};
#endif /* NSMAEMONETWORKLINKSERVICE_H_ */

View File

@ -0,0 +1,191 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MaemoAutodial.
*
* The Initial Developer of the Original Code is
* Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremias Bosch <jeremias.bosch@gmail.com>
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaemoNetworkManager.h"
#include "mozilla/Monitor.h"
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <conic/conicconnection.h>
#include <conic/conicconnectionevent.h>
#include <conicstatisticsevent.h>
#include <stdio.h>
#include <unistd.h>
#include "nsIOService.h"
#include "nsIObserverService.h"
#include "nsIOService.h"
#include "nsCOMPtr.h"
#include "nsThreadUtils.h"
#include "nsINetworkLinkService.h"
enum InternalState
{
InternalState_Invalid = -1,
InternalState_Disconnected,
InternalState_Connected
};
static InternalState gInternalState = InternalState_Invalid;
static ConIcConnection* gConnection = nsnull;
static PRBool gConnectionCallbackInvoked = PR_FALSE;
using namespace mozilla;
static Monitor* gMonitor = nsnull;
static void NotifyNetworkLinkObservers()
{
nsCOMPtr<nsIIOService> ioService = do_GetService("@mozilla.org/network/io-service;1");
if (!ioService)
return;
ioService->SetOffline(gInternalState != InternalState_Connected);
}
static void
connection_event_callback(ConIcConnection *aConnection,
ConIcConnectionEvent *aEvent,
gpointer aUser_data)
{
ConIcConnectionStatus status = con_ic_connection_event_get_status(aEvent);
{
MonitorAutoEnter mon(*gMonitor);
// When we are not connected, we are always disconnected.
gInternalState = (CON_IC_STATUS_CONNECTED == status ?
InternalState_Connected : InternalState_Disconnected);
gConnectionCallbackInvoked = PR_TRUE;
mon.Notify();
}
NotifyNetworkLinkObservers();
}
PRBool
nsMaemoNetworkManager::OpenConnectionSync()
{
if (NS_IsMainThread() || !gConnection)
return PR_FALSE;
// protect gInternalState. This also allows us
// to block and wait in this method on this thread
// until our callback on the main thread.
MonitorAutoEnter mon(*gMonitor);
gConnectionCallbackInvoked = PR_FALSE;
if (!con_ic_connection_connect(gConnection,
CON_IC_CONNECT_FLAG_NONE))
g_error("openConnectionSync: Error while connecting. %p \n",
(void*) PR_GetCurrentThread());
while (!gConnectionCallbackInvoked)
mon.Wait();
if (gInternalState == InternalState_Connected)
return PR_TRUE;
return PR_FALSE;
}
void
nsMaemoNetworkManager::CloseConnection()
{
if (gConnection)
con_ic_connection_disconnect(gConnection);
}
PRBool
nsMaemoNetworkManager::IsConnected()
{
return gInternalState == InternalState_Connected;
}
PRBool
nsMaemoNetworkManager::GetLinkStatusKnown()
{
return gInternalState != InternalState_Invalid;
}
PRBool
nsMaemoNetworkManager::Startup()
{
if (gConnection)
return PR_TRUE;
gMonitor = new Monitor("MaemoAutodialer");
if (!gMonitor)
return PR_FALSE;
DBusError error;
dbus_error_init(&error);
DBusConnection* dbusConnection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
NS_ASSERTION(dbusConnection, "Error when connecting to the session bus");
dbus_connection_setup_with_g_main(dbusConnection, nsnull);
// grab a connection:
gConnection = con_ic_connection_new();
NS_ASSERTION(gConnection, "Error when creating connection");
if (!gConnection) {
delete gMonitor;
gMonitor = nsnull;
return PR_FALSE;
}
g_signal_connect(G_OBJECT(gConnection),
"connection-event",
G_CALLBACK(connection_event_callback),
nsnull);
g_object_set(G_OBJECT(gConnection),
"automatic-connection-events",
PR_TRUE,
nsnull);
return PR_TRUE;
}
void
nsMaemoNetworkManager::Shutdown()
{
gConnection = nsnull;
if (gMonitor) {
// notify anyone waiting
MonitorAutoEnter mon(*gMonitor);
gInternalState = InternalState_Invalid;
mon.Notify();
}
// We are leaking the gMonitor because a race condition could occur. We need
// a notification after xpcom-shutdown-threads so we can safely delete the monitor
}

View File

@ -0,0 +1,46 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is MaemoAutodial.
*
* The Initial Developer of the Original Code is
* Nokia Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremias Bosch <jeremias.bosch@gmail.com>
*
* ***** END LICENSE BLOCK ***** */
#ifndef NSMAEMONETWORKMANAGER_H_
#define NSMAEMONETWORKMANAGER_H_
#include "nscore.h"
class nsMaemoNetworkManager
{
public:
// Can be called from any thread, most likely the socket transport thread
static PRBool OpenConnectionSync();
static void CloseConnection();
static PRBool IsConnected();
static PRBool GetLinkStatusKnown();
// Called from the nsMaemoNetworkLinkService (main thread only)
static PRBool Startup();
static void Shutdown();
};
#endif /* NSMAEMONETWORKMANAGER_H_ */

View File

@ -201,6 +201,10 @@ ifdef MOZ_PLATFORM_HILDON
EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS) $(LIBHILDONFM_LIBS)
endif
ifdef MOZ_ENABLE_LIBCONIC
EXTRA_DSO_LDOPTS += $(LIBCONIC_LIBS)
endif
ifdef NS_OSSO
EXTRA_DSO_LDOPTS += $(LIBOSSO_LIBS)
endif

View File

@ -240,9 +240,12 @@ ifdef MOZ_ENABLE_GNOME_COMPONENT
tier_toolkit_dirs += toolkit/system/gnome
endif
ifndef MOZ_ENABLE_LIBCONIC
# if libconic is present, it will do its own network monitoring
ifdef MOZ_ENABLE_DBUS
tier_toolkit_dirs += toolkit/system/dbus
endif
endif
ifdef MOZ_LEAKY
tier_toolkit_dirs += tools/leaky