зеркало из https://github.com/mozilla/gecko-dev.git
Bug 616075 - HTML5 offline event support for Android. r=mwu a=blocking-fennec
This commit is contained in:
Родитель
70c8ea9d9d
Коммит
0a56de0ca0
|
@ -10,6 +10,7 @@
|
|||
android:targetSdkVersion="5"/>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
|
||||
|
@ -21,6 +22,14 @@
|
|||
<application android:label="@MOZ_APP_DISPLAYNAME@"
|
||||
android:icon="@drawable/icon"
|
||||
android:debuggable="true">
|
||||
|
||||
<!-- for network link status -->
|
||||
<receiver android:name="org.mozilla.gecko.GeckoConnectivityReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity android:name="App"
|
||||
android:label="@MOZ_APP_DISPLAYNAME@"
|
||||
android:configChanges="keyboard|keyboardHidden|mcc|mnc"
|
||||
|
|
|
@ -59,6 +59,8 @@ import android.location.*;
|
|||
|
||||
import android.util.*;
|
||||
import android.net.Uri;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
class GeckoAppShell
|
||||
{
|
||||
|
@ -98,6 +100,7 @@ class GeckoAppShell
|
|||
public static native void callObserver(String observerKey, String topic, String data);
|
||||
public static native void removeObserver(String observerKey);
|
||||
public static native void loadLibs(String apkName, boolean shouldExtract);
|
||||
public static native void onChangeNetworkLinkStatus(String status);
|
||||
|
||||
public static File getCacheDir() {
|
||||
if (sCacheFile == null)
|
||||
|
@ -706,4 +709,21 @@ class GeckoAppShell
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isNetworkLinkUp() {
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
GeckoApp.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo info = cm.getActiveNetworkInfo();
|
||||
if (info == null || !info.isConnected())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isNetworkLinkKnown() {
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
GeckoApp.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm.getActiveNetworkInfo() == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* ***** 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 Mozilla Android code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Makoto Kato <m_kato@ga2.so-net.ne.jp> (Original Author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.*;
|
||||
import android.net.*;
|
||||
|
||||
public class GeckoConnectivityReceiver
|
||||
extends BroadcastReceiver
|
||||
{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String status;
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
GeckoApp.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo info = cm.getActiveNetworkInfo();
|
||||
if (info == null)
|
||||
status = "unknown";
|
||||
else if (!info.isConnected())
|
||||
status = "down";
|
||||
else
|
||||
status = "up";
|
||||
|
||||
if (GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning))
|
||||
GeckoAppShell.onChangeNetworkLinkStatus(status);
|
||||
}
|
||||
}
|
|
@ -48,6 +48,7 @@ DIRS = locales
|
|||
JAVAFILES = \
|
||||
GeckoApp.java \
|
||||
GeckoAppShell.java \
|
||||
GeckoConnectivityReceiver.java \
|
||||
GeckoEvent.java \
|
||||
GeckoSurfaceView.java \
|
||||
GeckoInputConnection.java \
|
||||
|
|
|
@ -95,6 +95,11 @@ ifdef MOZ_ENABLE_QTNETWORK
|
|||
../system/qt/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
../system/android/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../base/src \
|
||||
-I$(srcdir)/../dns \
|
||||
|
@ -128,6 +133,10 @@ ifdef MOZ_ENABLE_QTNETWORK
|
|||
LOCAL_INCLUDES += -I$(srcdir)/../system/qt
|
||||
endif
|
||||
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
LOCAL_INCLUDES += -I$(srcdir)/../system/android
|
||||
endif
|
||||
|
||||
ifdef NECKO_COOKIES
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
../cookie/$(LIB_PREFIX)neckocookie_s.$(LIB_SUFFIX) \
|
||||
|
|
|
@ -322,6 +322,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMaemoNetworkLinkService, Init)
|
|||
#elif defined(MOZ_ENABLE_QTNETWORK)
|
||||
#include "nsQtNetworkLinkService.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsQtNetworkLinkService, Init)
|
||||
#elif defined(ANDROID)
|
||||
#include "nsAndroidNetworkLinkService.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidNetworkLinkService)
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -749,6 +752,8 @@ NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
|
||||
#elif defined(MOZ_ENABLE_QTNETWORK)
|
||||
NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
|
||||
#elif defined(ANDROID)
|
||||
NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_SERIALIZATION_HELPER_CID);
|
||||
#ifdef MOZ_IPC
|
||||
|
@ -878,6 +883,8 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
|
|||
{ &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsMaemoNetworkLinkServiceConstructor },
|
||||
#elif defined(MOZ_ENABLE_QTNETWORK)
|
||||
{ &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsQtNetworkLinkServiceConstructor },
|
||||
#elif defined(ANDROID)
|
||||
{ &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsAndroidNetworkLinkServiceConstructor },
|
||||
#endif
|
||||
{ &kNS_SERIALIZATION_HELPER_CID, false, NULL, nsSerializationHelperConstructor },
|
||||
#ifdef MOZ_IPC
|
||||
|
@ -1014,6 +1021,8 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
|
|||
{ NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
|
||||
#elif defined(MOZ_ENABLE_QTNETWORK)
|
||||
{ NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
|
||||
#elif defined(ANDROID)
|
||||
{ NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
|
||||
#endif
|
||||
{ NS_SERIALIZATION_HELPER_CONTRACTID, &kNS_SERIALIZATION_HELPER_CID },
|
||||
#ifdef MOZ_IPC
|
||||
|
|
|
@ -64,4 +64,8 @@ ifdef MOZ_ENABLE_QTNETWORK
|
|||
DIRS += qt
|
||||
endif
|
||||
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
DIRS += android
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -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 mozilla.org.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2011
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Makoto Kato <m_kato@ga2.so-net.ne.jp> (Original Author)
|
||||
#
|
||||
# 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 *****
|
||||
|
||||
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 += \
|
||||
nsAndroidNetworkLinkService.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DIMPL_NS_NET
|
||||
|
||||
LOCAL_INCLUDES += -I$(srcdir)/../../base/src
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** 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 mozilla.org.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Makoto Kato <m_kato@ga2.so-net.ne.jp> (Original Author)
|
||||
*
|
||||
* 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 "nsAndroidNetworkLinkService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "AndroidBridge.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAndroidNetworkLinkService,
|
||||
nsINetworkLinkService)
|
||||
|
||||
nsAndroidNetworkLinkService::nsAndroidNetworkLinkService()
|
||||
{
|
||||
}
|
||||
|
||||
nsAndroidNetworkLinkService::~nsAndroidNetworkLinkService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAndroidNetworkLinkService::GetIsLinkUp(PRBool *aIsUp)
|
||||
{
|
||||
NS_ENSURE_TRUE(mozilla::AndroidBridge::Bridge(), NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
||||
*aIsUp = mozilla::AndroidBridge::Bridge()->IsNetworkLinkUp();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAndroidNetworkLinkService::GetLinkStatusKnown(PRBool *aIsKnown)
|
||||
{
|
||||
NS_ENSURE_TRUE(mozilla::AndroidBridge::Bridge(), NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
||||
*aIsKnown = mozilla::AndroidBridge::Bridge()->IsNetworkLinkKnown();
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** 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 mozilla.org.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Makoto Kato <m_kato@ga2.so-net.ne.jp> (Original Author)
|
||||
*
|
||||
* 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 NSANDROIDNETWORKLINKSERVICE_H_
|
||||
#define NSANDROIDNETWORKLINKSERVICE_H_
|
||||
|
||||
#include "nsINetworkLinkService.h"
|
||||
|
||||
class nsAndroidNetworkLinkService: public nsINetworkLinkService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSINETWORKLINKSERVICE
|
||||
|
||||
nsAndroidNetworkLinkService();
|
||||
virtual ~nsAndroidNetworkLinkService();
|
||||
};
|
||||
|
||||
#endif /* NSANDROIDNETWORKLINKSERVICE_H_ */
|
|
@ -238,6 +238,7 @@ SHELL_WRAPPER0(onResume)
|
|||
SHELL_WRAPPER0(onLowMemory)
|
||||
SHELL_WRAPPER3(callObserver, jstring, jstring, jstring)
|
||||
SHELL_WRAPPER1(removeObserver, jstring)
|
||||
SHELL_WRAPPER1(onChangeNetworkLinkStatus, jstring)
|
||||
|
||||
static void * xul_handle = NULL;
|
||||
static time_t apk_mtime = 0;
|
||||
|
@ -667,6 +668,7 @@ loadLibs(const char *apkName)
|
|||
GETFUNC(onLowMemory);
|
||||
GETFUNC(callObserver);
|
||||
GETFUNC(removeObserver);
|
||||
GETFUNC(onChangeNetworkLinkStatus);
|
||||
#undef GETFUNC
|
||||
gettimeofday(&t1, 0);
|
||||
struct rusage usage2;
|
||||
|
|
|
@ -123,6 +123,8 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
|||
jHideProgressDialog = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "hideProgressDialog", "()V");
|
||||
jPerformHapticFeedback = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "performHapticFeedback", "(Z)V");
|
||||
jSetKeepScreenOn = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "setKeepScreenOn", "(Z)V");
|
||||
jIsNetworkLinkUp = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "isNetworkLinkUp", "()Z");
|
||||
jIsNetworkLinkKnown = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "isNetworkLinkKnown", "()Z");
|
||||
|
||||
jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext"));
|
||||
jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10"));
|
||||
|
@ -564,6 +566,18 @@ AndroidBridge::PerformHapticFeedback(PRBool aIsLongPress)
|
|||
jPerformHapticFeedback, aIsLongPress);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::IsNetworkLinkUp()
|
||||
{
|
||||
return !!mJNIEnv->CallStaticBooleanMethod(mGeckoAppShellClass, jIsNetworkLinkUp);
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::IsNetworkLinkKnown()
|
||||
{
|
||||
return !!mJNIEnv->CallStaticBooleanMethod(mGeckoAppShellClass, jIsNetworkLinkKnown);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetSurfaceView(jobject obj)
|
||||
{
|
||||
|
|
|
@ -180,6 +180,10 @@ public:
|
|||
|
||||
void HideProgressDialogOnce();
|
||||
|
||||
bool IsNetworkLinkUp();
|
||||
|
||||
bool IsNetworkLinkKnown();
|
||||
|
||||
struct AutoLocalJNIFrame {
|
||||
AutoLocalJNIFrame(int nEntries = 128) : mEntries(nEntries) {
|
||||
// Make sure there is enough space to store a local ref to the
|
||||
|
@ -262,6 +266,8 @@ protected:
|
|||
jmethodID jHideProgressDialog;
|
||||
jmethodID jPerformHapticFeedback;
|
||||
jmethodID jSetKeepScreenOn;
|
||||
jmethodID jIsNetworkLinkUp;
|
||||
jmethodID jIsNetworkLinkKnown;
|
||||
|
||||
// stuff we need for CallEglCreateWindowSurface
|
||||
jclass jEGLSurfaceImplClass;
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <android/log.h>
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsINetworkLinkService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -62,6 +63,7 @@ extern "C" {
|
|||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_onLowMemory(JNIEnv *, jclass);
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_callObserver(JNIEnv *, jclass, jstring observerKey, jstring topic, jstring data);
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_removeObserver(JNIEnv *jenv, jclass, jstring jObserverKey);
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_onChangeNetworkLinkStatus(JNIEnv *, jclass, jstring status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,3 +134,16 @@ Java_org_mozilla_gecko_GeckoAppShell_removeObserver(JNIEnv *jenv, jclass, jstrin
|
|||
|
||||
nsAppShell::gAppShell->RemoveObserver(sObserverKey);
|
||||
}
|
||||
|
||||
NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_onChangeNetworkLinkStatus(JNIEnv *jenv, jclass, jstring jStatus)
|
||||
{
|
||||
if (!nsAppShell::gAppShell)
|
||||
return;
|
||||
|
||||
nsJNIString sStatus(jStatus, jenv);
|
||||
|
||||
nsAppShell::gAppShell->NotifyObservers(nsnull,
|
||||
NS_NETWORK_LINK_TOPIC,
|
||||
sStatus.get());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче