本文整理汇总了C++中ContentChild::SendAddGeolocationListener方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentChild::SendAddGeolocationListener方法的具体用法?C++ ContentChild::SendAddGeolocationListener怎么用?C++ ContentChild::SendAddGeolocationListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentChild
的用法示例。
在下文中一共展示了ContentChild::SendAddGeolocationListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDisconnectTimer
nsresult
nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal, bool aRequestPrivate)
{
if (!sGeoEnabled || sGeoInitPending) {
return NS_ERROR_NOT_AVAILABLE;
}
// we do not want to keep the geolocation devices online
// indefinitely. Close them down after a reasonable period of
// inactivivity
SetDisconnectTimer();
if (XRE_GetProcessType() == GeckoProcessType_Content) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendAddGeolocationListener(IPC::Principal(aPrincipal),
HighAccuracyRequested());
return NS_OK;
}
// Start them up!
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs) {
return NS_ERROR_FAILURE;
}
for (int32_t i = 0; i < mProviders.Count(); i++) {
mProviders[i]->Startup();
mProviders[i]->Watch(this, aRequestPrivate);
obs->NotifyObservers(mProviders[i],
"geolocation-device-events",
NS_LITERAL_STRING("starting").get());
}
return NS_OK;
}
示例2: SetDisconnectTimer
nsresult
nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal)
{
if (!sGeoEnabled || sGeoInitPending) {
return NS_ERROR_NOT_AVAILABLE;
}
// we do not want to keep the geolocation devices online
// indefinitely. Close them down after a reasonable period of
// inactivivity
SetDisconnectTimer();
if (XRE_GetProcessType() == GoannaProcessType_Content) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendAddGeolocationListener(IPC::Principal(aPrincipal),
HighAccuracyRequested());
return NS_OK;
}
// Start them up!
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs) {
return NS_ERROR_FAILURE;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
nsresult rv;
if (NS_FAILED(rv = mProvider->Startup()) ||
NS_FAILED(rv = mProvider->Watch(this))) {
NotifyError(nsIDOMGeoPositionError::POSITION_UNAVAILABLE);
return rv;
}
obs->NotifyObservers(mProvider,
"geolocation-device-events",
NS_LITERAL_STRING("starting").get());
return NS_OK;
}