Index: third_party/WebKit/Source/modules/geolocation/Geolocation.cpp |
diff --git a/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp b/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp |
index e23275993c4aafe13db18c74016de70ae3c97801..82bb87db32525650dfda89675ad6dd616a01b22a 100644 |
--- a/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp |
+++ b/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp |
@@ -93,6 +93,7 @@ Geolocation* Geolocation::create(ExecutionContext* context) |
Geolocation::Geolocation(ExecutionContext* context) |
: ActiveDOMObject(context) |
, m_geolocationPermission(PermissionUnknown) |
+ , m_controller(new GeolocationController(this)) |
Marijn Kruisselbrink
2015/09/30 19:56:55
Unless I'm missing something, the change to lifeti
Sam McNally
2015/10/01 01:54:50
For a real CL it's worth splitting this up, but I
Marijn Kruisselbrink
2015/10/01 03:36:09
But changing the ownership and lifetime management
Sam McNally
2015/10/02 05:12:37
Changing ownership of GeolocationController depend
|
{ |
} |
@@ -108,6 +109,7 @@ DEFINE_TRACE(Geolocation) |
visitor->trace(m_pendingForPermissionNotifiers); |
visitor->trace(m_lastPosition); |
visitor->trace(m_requestsAwaitingCachedPosition); |
+ visitor->trace(m_controller); |
ActiveDOMObject::trace(visitor); |
} |
@@ -125,7 +127,7 @@ void Geolocation::stop() |
{ |
LocalFrame* frame = this->frame(); |
if (frame && m_geolocationPermission == PermissionRequested) |
- GeolocationController::from(frame)->cancelPermissionRequest(this); |
+ m_controller->cancelPermissionRequest(); |
// The frame may be moving to a new page and we want to get the permissions from the new page's client. |
m_geolocationPermission = PermissionUnknown; |
@@ -136,11 +138,7 @@ void Geolocation::stop() |
Geoposition* Geolocation::lastPosition() |
{ |
- LocalFrame* frame = this->frame(); |
- if (!frame) |
- return 0; |
- |
- m_lastPosition = createGeoposition(GeolocationController::from(frame)->lastPosition()); |
+ m_lastPosition = createGeoposition(m_controller->lastPosition()); |
return m_lastPosition.get(); |
} |
@@ -467,14 +465,10 @@ void Geolocation::requestPermission() |
if (m_geolocationPermission != PermissionUnknown) |
return; |
- LocalFrame* frame = this->frame(); |
- if (!frame) |
- return; |
- |
m_geolocationPermission = PermissionRequested; |
// Ask the embedder: it maintains the geolocation challenge policy itself. |
- GeolocationController::from(frame)->requestPermission(this); |
+ m_controller->requestPermission(); |
} |
void Geolocation::makeSuccessCallbacks() |
@@ -522,21 +516,13 @@ void Geolocation::setError(GeolocationError* error) |
bool Geolocation::startUpdating(GeoNotifier* notifier) |
{ |
- LocalFrame* frame = this->frame(); |
- if (!frame) |
- return false; |
- |
- GeolocationController::from(frame)->addObserver(this, notifier->options().enableHighAccuracy()); |
+ m_controller->startUpdating(notifier->options().enableHighAccuracy()); |
return true; |
} |
void Geolocation::stopUpdating() |
{ |
- LocalFrame* frame = this->frame(); |
- if (!frame) |
- return; |
- |
- GeolocationController::from(frame)->removeObserver(this); |
+ m_controller->stopUpdating(); |
} |
void Geolocation::handlePendingPermissionNotifiers() |