Keep ours for maximumAge code.
Take theirs for client-based Geolocation code.
Change-Id: I72baa0026b1cd1bec617843a992dfb6008ca774d
m_errorCallback->handleEvent(m_fatalError.get());
// This will cause this notifier to be deleted.
m_geolocation->fatalErrorOccurred(this);
-<<<<<<< HEAD
return;
}
// will continue to run.
m_useCachedPosition = false;
m_geolocation->requestUsesCachedPosition(this);
-=======
->>>>>>> webkit.org at r54127
return;
}
}
Geolocation::Geolocation(Frame* frame)
-<<<<<<< HEAD
: EventListener(GeolocationEventListenerType)
, m_frame(frame)
-=======
- : m_frame(frame)
->>>>>>> webkit.org at r54127
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
, m_service(GeolocationService::create(this))
#endif
m_frame->domWindow()->removeEventListener(eventNames().unloadEvent, this, false);
}
-Geolocation::~Geolocation()
-{
-}
-
void Geolocation::disconnectFrame()
{
stopUpdating();
if (isDenied())
notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage));
else {
-<<<<<<< HEAD
if (haveSuitableCachedPosition(notifier->m_options.get()))
notifier->setUseCachedPosition();
else {
} else
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, "Failed to start Geolocation service"));
}
-=======
- 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, "Failed to start Geolocation service"));
->>>>>>> webkit.org at r54127
}
return notifier.release();
if (!hasListeners())
stopUpdating();
-<<<<<<< HEAD
}
void Geolocation::requestUsesCachedPosition(GeoNotifier* notifier)
return false;
DOMTimeStamp currentTimeMillis = currentTime() * 1000.0;
return m_positionCache->cachedPosition()->timestamp() > currentTimeMillis - options->maximumAge();
-=======
->>>>>>> webkit.org at r54127
}
void Geolocation::clearWatch(int watchId)
return;
}
#endif
-<<<<<<< HEAD
if (!isAllowed()) {
-=======
-
- if (isAllowed())
- makeSuccessCallbacks();
- else {
->>>>>>> webkit.org at r54127
RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage);
error->setIsFatal(true);
handleError(error.get());
void Geolocation::positionChanged(PassRefPtr<Geoposition> newPosition)
{
m_currentPosition = newPosition;
-<<<<<<< HEAD
m_positionCache->setCachedPosition(m_currentPosition.get());
-=======
->>>>>>> webkit.org at r54127
// Stop all currently running timers.
stopTimers();
{
ASSERT(service->lastError());
-<<<<<<< HEAD
// Note that we do not stop timers here. For one-shots, the request is
// cleared in handleError. For watchers, the spec requires that the timer is
// not cleared.
-=======
->>>>>>> webkit.org at r54127
handleError(service->lastError());
}
}
-<<<<<<< HEAD
bool Geolocation::operator==(const EventListener& listener)
{
if (listener.type() != GeolocationEventListenerType)
m_watchers.clear();
}
-=======
->>>>>>> webkit.org at r54127
} // namespace WebCore
class GeolocationError;
#endif
-<<<<<<< HEAD
class Geolocation : public EventListener
-=======
-class Geolocation : public RefCounted<Geolocation>
->>>>>>> webkit.org at r54127
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
, public GeolocationServiceClient
#endif
bool shouldClearCache() const { return m_shouldClearCache; }
#if ENABLE(CLIENT_BASED_GEOLOCATION)
-<<<<<<< HEAD
- void setPostion(GeolocationPosition*);
-=======
void setPosition(GeolocationPosition*);
->>>>>>> webkit.org at r54127
void setError(GeolocationError*);
#endif
GeolocationController::~GeolocationController()
{
-<<<<<<< HEAD
-=======
if (m_client)
m_client->geolocationDestroyed();
->>>>>>> webkit.org at r54127
}
void GeolocationController::addObserver(Geolocation* observer)
bool wasEmpty = m_observers.isEmpty();
m_observers.add(observer);
-<<<<<<< HEAD
- if (wasEmpty)
-=======
if (wasEmpty && m_client)
->>>>>>> webkit.org at r54127
m_client->startUpdating();
}
return;
m_observers.remove(observer);
-<<<<<<< HEAD
- if (m_observers.isEmpty())
-=======
if (m_observers.isEmpty() && m_client)
->>>>>>> webkit.org at r54127
m_client->stopUpdating();
}
void GeolocationController::positionChanged(GeolocationPosition* position)
{
-<<<<<<< HEAD
- HashSet<RefPtr<Geolocation> >::const_iterator end = m_observers.end();
- for (HashSet<RefPtr<Geolocation> >::const_iterator it = m_observers.begin(); it != end; ++it)
- (*it)->setPosition(position);
-=======
Vector<RefPtr<Geolocation> > observersVector;
copyToVector(m_observers, observersVector);
for (size_t i = 0; i < observersVector.size(); ++i)
observersVector[i]->setPosition(position);
->>>>>>> webkit.org at r54127
}
void GeolocationController::errorOccurred(GeolocationError* error)
{
-<<<<<<< HEAD
- HashSet<RefPtr<Geolocation> >::const_iterator end = m_observers.end();
- for (HashSet<RefPtr<Geolocation> >::const_iterator it = m_observers.begin(); it != end; ++it)
- (*it)->setError(error);
-=======
Vector<RefPtr<Geolocation> > observersVector;
copyToVector(m_observers, observersVector);
for (size_t i = 0; i < observersVector.size(); ++i)
observersVector[i]->setError(error);
->>>>>>> webkit.org at r54127
}
GeolocationPosition* GeolocationController::lastPosition()
{
-<<<<<<< HEAD
-=======
if (!m_client)
return 0;
->>>>>>> webkit.org at r54127
return m_client->lastPosition();
}
class GeolocationControllerClient {
public:
-<<<<<<< HEAD
-=======
virtual void geolocationDestroyed() = 0;
->>>>>>> webkit.org at r54127
virtual void startUpdating() = 0;
virtual void stopUpdating() = 0;
virtual GeolocationPosition* lastPosition() = 0;
#include "PlatformString.h"
#include <wtf/PassRefPtr.h>
-<<<<<<< HEAD
-=======
#include <wtf/RefCounted.h>
->>>>>>> webkit.org at r54127
#include <wtf/RefPtr.h>
namespace WebCore {
const String& message() const { return m_message; }
private:
-<<<<<<< HEAD
- GeolocationError(ErrorCode code, const String& message);
-=======
GeolocationError(ErrorCode code, const String& message)
: m_code(code)
, m_message(message)
{
}
->>>>>>> webkit.org at r54127
ErrorCode m_code;
String m_message;
#if ENABLE(CLIENT_BASED_GEOLOCATION)
#include <wtf/PassRefPtr.h>
-<<<<<<< HEAD
-=======
#include <wtf/RefCounted.h>
->>>>>>> webkit.org at r54127
#include <wtf/RefPtr.h>
namespace WebCore {
didOneTimeInitialization = true;
}
-<<<<<<< HEAD
- _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), 0);
-=======
#if ENABLE(CLIENT_BASED_GEOLOCATION)
WebGeolocationControllerClient* geolocationControllerClient = new WebGeolocationControllerClient(self);
#else
WebGeolocationControllerClient* geolocationControllerClient = 0;
#endif
_private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient);
->>>>>>> webkit.org at r54127
_private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
if (SUCCEEDED(m_preferences->shouldUseHighResolutionTimers(&useHighResolutionTimer)))
Settings::setShouldUseHighResolutionTimers(useHighResolutionTimer);
-<<<<<<< HEAD
- m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), 0);
-=======
m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), geolocationControllerClient);
->>>>>>> webkit.org at r54127
BSTR localStoragePath;
if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) {