void Geolocation::setIsAllowed(bool allowed) { // Protect the Geolocation object from garbage collection during a callback. RefPtr<Geolocation> protect(this); // This may be due to either a new position from the service, or a cached // position. m_allowGeolocation = allowed ? Yes : No; // Permission request was made during the startRequest process if (!m_pendingForPermissionNotifiers.isEmpty()) { handlePendingPermissionNotifiers(); m_pendingForPermissionNotifiers.clear(); return; } if (!isAllowed()) { RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage); error->setIsFatal(true); handleError(error.get()); m_requestsAwaitingCachedPosition.clear(); return; } // If the service has a last position, use it to call back for all requests. // If any of the requests are waiting for permission for a cached position, // the position from the service will be at least as fresh. if (lastPosition()) makeSuccessCallbacks(); else makeCachedPositionCallbacks(); }
void Geolocation::positionChanged() { DCHECK(isAllowed()); // Stop all currently running timers. stopTimers(); makeSuccessCallbacks(); }
void Geolocation::positionChanged() { ASSERT(isAllowed()); m_cachedPosition = lastPosition(); // Stop all currently running timers. stopTimers(); makeSuccessCallbacks(); }
void Geolocation::positionChanged() { ASSERT(isAllowed()); // Stop all currently running timers. stopTimers(); if (m_isSuspended) { m_hasChangedPosition = true; return; } makeSuccessCallbacks(); }
void Geolocation::positionChanged(PassRefPtr<Geoposition> newPosition) { m_positionCache->setCachedPosition(newPosition.get()); // Stop all currently running timers. stopTimers(); if (!isAllowed()) { // requestPermission() will ask the chrome for permission. This may be // implemented synchronously or asynchronously. In both cases, // makeSuccessCallbacks() will be called if permission is granted, so // there's nothing more to do here. requestPermission(); return; } makeSuccessCallbacks(); }
void Geolocation::setIsAllowed(bool allowed) { // This may be due to either a new position from the service, or a cached // position. m_allowGeolocation = allowed ? Yes : No; #if ENABLE(CLIENT_BASED_GEOLOCATION) if (m_startRequestPermissionNotifier) { if (isAllowed()) { // Permission request was made during the startUpdating process m_startRequestPermissionNotifier->startTimerIfNeeded(); m_startRequestPermissionNotifier = 0; if (!m_frame) return; Page* page = m_frame->page(); if (!page) return; page->geolocationController()->addObserver(this); } else { m_startRequestPermissionNotifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); m_oneShots.add(m_startRequestPermissionNotifier); m_startRequestPermissionNotifier = 0; } return; } #endif if (!isAllowed()) { RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage); error->setIsFatal(true); handleError(error.get()); m_requestsAwaitingCachedPosition.clear(); return; } // If the service has a last position, use it to call back for all requests. // If any of the requests are waiting for permission for a cached position, // the position from the service will be at least as fresh. if (lastPosition()) makeSuccessCallbacks(); else makeCachedPositionCallbacks(); }