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
parent c459fcacd1
commit ac6891b4f6
5 changed files with 15 additions and 29 deletions

View File

@@ -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(),