void Geolocation::startRequest(GeoNotifier* notifier) { if (shouldBlockGeolocationRequests()) { notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, originCannotRequestGeolocationErrorMessage)); return; } document()->setGeolocationAccessed(); // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (notifier->hasZeroTimeout()) notifier->startTimerIfNeeded(); else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else if (startUpdating(notifier)) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); }
PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { RefPtr<GeoNotifier> notifier = GeoNotifier::create(this, successCallback, errorCallback, options); // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->m_options.get())) notifier->setUseCachedPosition(); else if (notifier->hasZeroTimeout()) notifier->startTimerIfNeeded(); #if USE(PREEMPT_GEOLOCATION_PERMISSION) else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } #endif else if (startUpdating(notifier.get())) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); return notifier.release(); }
void Geolocation::startRequest(GeoNotifier *notifier) { if (frame()->settings()->strictPowerfulFeatureRestrictions()) { String errorMessage; if (!executionContext()->securityOrigin()->canAccessFeatureRequiringSecureOrigin(errorMessage)) { notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, errorMessage)); return; } } // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (!notifier->options().timeout()) notifier->startTimer(); else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else if (startUpdating(notifier)) notifier->startTimer(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); }
void Geolocation::startRequest(GeoNotifier* notifier) { recordOriginTypeAccess(); String errorMessage; if (!frame()->settings()->allowGeolocationOnInsecureOrigins() && !getExecutionContext()->isSecureContext(errorMessage)) { notifier->setFatalError( PositionError::create(PositionError::kPermissionDenied, errorMessage)); return; } // Check whether permissions have already been denied. Note that if this is // the case, the permission state can not change again in the lifetime of // this page. if (isDenied()) notifier->setFatalError(PositionError::create( PositionError::kPermissionDenied, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (!notifier->options().timeout()) notifier->startTimer(); else if (!isAllowed()) { // If we don't yet have permission, request for permission before calling // startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else { startUpdating(notifier); notifier->startTimer(); } }
PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { RefPtr<GeoNotifier> notifier = GeoNotifier::create(this, successCallback, errorCallback, options); // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->m_options.get())) notifier->setUseCachedPosition(); else if (notifier->hasZeroTimeout() || startUpdating(notifier.get())) { #if ENABLE(CLIENT_BASED_GEOLOCATION) // Only start timer if we're not waiting for user permission. if (!m_startRequestPermissionNotifier) #endif notifier->startTimerIfNeeded(); } else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); return notifier.release(); }
void Geolocation::startRequest(GeoNotifier *notifier) { if (frame()->settings()->strictPowerfulFeatureRestrictions()) { String errorMessage; if (!executionContext()->isSecureContext(errorMessage)) { notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, errorMessage)); return; } } if (RuntimeEnabledFeatures::restrictIFramePermissionsEnabled()) { // TODO(keenanb): kill the request if the parent is blocking the requester Element* owner = document()->ownerElement(); if (owner && owner->hasAttribute(HTMLNames::permissionsAttr)) { String errorMessage = "A cross-origin iframe needs its permissions attribute properly set in order to use the geolocation API."; notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, errorMessage)); return; } } // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (!notifier->options().timeout()) notifier->startTimer(); else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else if (startUpdating(notifier)) notifier->startTimer(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); }