Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: third_party/WebKit/Source/modules/geolocation/Geolocation.cpp

Issue 1367853002: Move GeolocationDispatcher into blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()

Powered by Google App Engine
This is Rietveld 408576698