| Index: Source/modules/geolocation/GeolocationController.cpp
|
| diff --git a/Source/modules/geolocation/GeolocationController.cpp b/Source/modules/geolocation/GeolocationController.cpp
|
| index ae5bc6089d5663066242592240d88d707d91bc49..71dccb88e75be3164882e5e52909b8fdef400e8c 100644
|
| --- a/Source/modules/geolocation/GeolocationController.cpp
|
| +++ b/Source/modules/geolocation/GeolocationController.cpp
|
| @@ -28,6 +28,7 @@
|
| #include "modules/geolocation/GeolocationController.h"
|
|
|
| #include "core/inspector/InspectorController.h"
|
| +#include "core/page/Page.h"
|
| #include "modules/geolocation/GeolocationClient.h"
|
| #include "modules/geolocation/GeolocationError.h"
|
| #include "modules/geolocation/GeolocationInspectorAgent.h"
|
| @@ -35,16 +36,25 @@
|
|
|
| namespace WebCore {
|
|
|
| -GeolocationController::GeolocationController(Page& page, GeolocationClient* client)
|
| - : PageLifecycleObserver(&page)
|
| +GeolocationController::GeolocationController(LocalFrame& frame, GeolocationClient* client)
|
| + : PageLifecycleObserver(frame.page())
|
| , m_client(client)
|
| , m_hasClientForTest(false)
|
| , m_isClientUpdating(false)
|
| , m_inspectorAgent()
|
| {
|
| - OwnPtr<GeolocationInspectorAgent> geolocationAgent(GeolocationInspectorAgent::create(this));
|
| - m_inspectorAgent = geolocationAgent.get();
|
| - page.inspectorController().registerModuleAgent(geolocationAgent.release());
|
| + // FIXME: Once GeolocationInspectorAgent is per frame, there will be a 1:1 relationship between
|
| + // it and this class. Until then, there's one GeolocationInspectorAgent per page that the main
|
| + // frame is responsible for creating.
|
| + if (frame.isMainFrame()) {
|
| + OwnPtr<GeolocationInspectorAgent> geolocationAgent(GeolocationInspectorAgent::create());
|
| + m_inspectorAgent = geolocationAgent.get();
|
| + frame.page()->inspectorController().registerModuleAgent(geolocationAgent.release());
|
| + } else {
|
| + m_inspectorAgent = GeolocationController::from(frame.page()->mainFrame())->m_inspectorAgent;
|
| + }
|
| +
|
| + m_inspectorAgent->AddController(this);
|
| }
|
|
|
| void GeolocationController::startUpdatingIfNeeded()
|
| @@ -66,6 +76,8 @@ void GeolocationController::stopUpdatingIfNeeded()
|
| GeolocationController::~GeolocationController()
|
| {
|
| ASSERT(m_observers.isEmpty());
|
| + if (page())
|
| + m_inspectorAgent->RemoveController(this);
|
| }
|
|
|
| void GeolocationController::willBeDestroyed()
|
| @@ -74,9 +86,9 @@ void GeolocationController::willBeDestroyed()
|
| m_client->geolocationDestroyed();
|
| }
|
|
|
| -PassOwnPtr<GeolocationController> GeolocationController::create(Page& page, GeolocationClient* client)
|
| +PassOwnPtr<GeolocationController> GeolocationController::create(LocalFrame& frame, GeolocationClient* client)
|
| {
|
| - return adoptPtr(new GeolocationController(page, client));
|
| + return adoptPtr(new GeolocationController(frame, client));
|
| }
|
|
|
| void GeolocationController::addObserver(Geolocation* observer, bool enableHighAccuracy)
|
| @@ -179,9 +191,9 @@ const char* GeolocationController::supplementName()
|
| return "GeolocationController";
|
| }
|
|
|
| -void provideGeolocationTo(Page& page, GeolocationClient* client)
|
| +void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client)
|
| {
|
| - Supplement<Page>::provideTo(page, GeolocationController::supplementName(), GeolocationController::create(page, client));
|
| + Supplement<LocalFrame>::provideTo(frame, GeolocationController::supplementName(), GeolocationController::create(frame, client));
|
| }
|
|
|
| } // namespace WebCore
|
|
|