Bug 1285570 - Implement VISITED event as native method; r=snorp

Convert the VISITED event in GeckoEvent to a native method call in
GeckoAppShell.
This commit is contained in:
Jim Chen 2016-07-11 18:07:35 -04:00
Родитель 71a6e62f73
Коммит 247c8dadf2
5 изменённых файлов: 15 добавлений и 29 удалений

Просмотреть файл

@ -249,9 +249,8 @@ public class GeckoAppShell
private static native void reportJavaCrash(String stackTrace);
public static void notifyUriVisited(String uri) {
sendEventToGecko(GeckoEvent.createVisitedEvent(uri));
}
@WrapForJNI
public static native void notifyUriVisited(String uri);
public static native void notifyBatteryChange(double aLevel, boolean aCharging, double aRemainingTime);

Просмотреть файл

@ -69,7 +69,6 @@ public class GeckoEvent {
LOAD_URI(12),
NOOP(15),
VIEWPORT(20),
VISITED(21),
NETWORK_CHANGED(22),
THUMBNAIL(25),
SCREENORIENTATION_CHANGED(27),
@ -366,12 +365,6 @@ public class GeckoEvent {
return event;
}
public static GeckoEvent createVisitedEvent(String data) {
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.VISITED);
event.mCharacters = data;
return event;
}
public static GeckoEvent createNetworkEvent(int connectionType, boolean isWifi, int DHCPGateway, String status) {
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.NETWORK_CHANGED);
event.mConnectionType = connectionType;

Просмотреть файл

@ -333,11 +333,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
break;
}
case VISITED: {
ReadCharactersField(jenv);
break;
}
case THUMBNAIL: {
mMetaState = jenv->GetIntField(jobj, jMetaStateField);
ReadPointArray(mPoints, jenv, jPoints, 1);

Просмотреть файл

@ -608,7 +608,6 @@ public:
NOOP = 15,
APZ_INPUT_EVENT = 17, // used internally in AndroidJNI/nsAppShell/nsWindow
VIEWPORT = 20,
VISITED = 21,
NETWORK_CHANGED = 22,
THUMBNAIL = 25,
SCREENORIENTATION_CHANGED = 27,

Просмотреть файл

@ -373,6 +373,19 @@ public:
aAccuracy, aBearing, aSpeed, aTime));
gLocationCallback->Update(geoPosition);
}
static void NotifyUriVisited(jni::String::Param aUri)
{
#ifdef MOZ_ANDROID_HISTORY
nsCOMPtr<IHistory> history = services::GetHistoryService();
nsCOMPtr<nsIURI> visitedURI;
if (history &&
NS_SUCCEEDED(NS_NewURI(getter_AddRefs(visitedURI),
aUri->ToString()))) {
history->NotifyVisited(visitedURI);
}
#endif
}
};
nsAppShell::nsAppShell()
@ -823,19 +836,6 @@ nsAppShell::LegacyGeckoEvent::Run()
break;
}
case AndroidGeckoEvent::VISITED: {
#ifdef MOZ_ANDROID_HISTORY
nsCOMPtr<IHistory> history = services::GetHistoryService();
nsCOMPtr<nsIURI> visitedURI;
if (history &&
NS_SUCCEEDED(NS_NewURI(getter_AddRefs(visitedURI),
curEvent->Characters()))) {
history->NotifyVisited(visitedURI);
}
#endif
break;
}
case AndroidGeckoEvent::NETWORK_CHANGED: {
hal::NotifyNetworkChange(hal::NetworkInformation(curEvent->ConnectionType(),
curEvent->IsWifi(),