GEOLOCATION should be implemented as Page Supplement
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2012 20:50:09 +0000 (20:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2012 20:50:09 +0000 (20:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82228

Patch by Mark Pilgrim <pilgrim@chromium.org> on 2012-03-30
Reviewed by Adam Barth.

Source/WebCore:

Geolocation now uses the Supplement interface instead of
keeping an instance variable on Page. This allows us to
remove all geolocation-related functions, variables, and
ifdefs out of Page and into Modules/geolocation/.

* Modules/geolocation/Geolocation.cpp:
(WebCore::Geolocation::stop):
(WebCore::Geolocation::lastPosition):
(WebCore::Geolocation::requestPermission):
(WebCore::Geolocation::startUpdating):
(WebCore::Geolocation::stopUpdating):
* Modules/geolocation/Geolocation.h:
(WebCore):
* Modules/geolocation/GeolocationController.cpp:
(WebCore::GeolocationController::supplementName):
(WebCore):
(WebCore::provideGeolocationTo):
* Modules/geolocation/GeolocationController.h:
(GeolocationController):
(WebCore::GeolocationController::from):
* WebCore.exp.in:
* page/GeolocationClient.h:
(WebCore):
(GeolocationClient):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::PageClients::PageClients):
* page/Page.h:
(WebCore):
(PageClients):
(Page):

Source/WebKit/blackberry:

Geolocation is now a Supplement in Page so the interface
has changed for setting up the page's geolocation client
initially and accessing the controller later.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
(BlackBerry::WebKit::WebPagePrivate::init):
* WebCoreSupport/GeolocationControllerClientBlackBerry.cpp:
(GeolocationControllerClientBlackBerry::onLocationUpdate):
(GeolocationControllerClientBlackBerry::onLocationError):
* WebKitSupport/DumpRenderTreeSupport.cpp:
(DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests):
(DumpRenderTreeSupport::resetGeolocationMock):
(DumpRenderTreeSupport::setMockGeolocationError):
(DumpRenderTreeSupport::setMockGeolocationPermission):
(DumpRenderTreeSupport::setMockGeolocationPosition):

Source/WebKit/chromium:

Geolocation is now a Supplement in Page so the interface
has changed for setting up the page's geolocation client
initially and accessing the controller later.

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):

Source/WebKit/gtk:

Geolocation is now a Supplement in Page so the interface
has changed for setting up the page's geolocation client
initially and accessing the controller later.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::resetGeolocationClientMock):
(DumpRenderTreeSupportGtk::setMockGeolocationPermission):
(DumpRenderTreeSupportGtk::setMockGeolocationPosition):
(DumpRenderTreeSupportGtk::setMockGeolocationError):
(DumpRenderTreeSupportGtk::numberOfPendingGeolocationPermissionRequests):
* WebCoreSupport/GeolocationClientGtk.cpp:
(WebKit::GeolocationClient::updatePosition):
(WebKit::GeolocationClient::errorOccured):
* webkit/webkitwebview.cpp:
(webkit_web_view_init):

Source/WebKit/mac:

Geolocation is now a Supplement in Page so the interface
has changed for setting up the page's geolocation client
initially and accessing the controller later.

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _geolocationDidChangePosition:]):
(-[WebView _geolocationDidFailWithError:]):

Source/WebKit/qt:

Geolocation is now a Supplement in Page so the interface
has changed for setting up the page's geolocation client
initially and accessing the controller later.

* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::resetGeolocationMock):
(DumpRenderTreeSupportQt::setMockGeolocationPermission):
(DumpRenderTreeSupportQt::setMockGeolocationPosition):
(DumpRenderTreeSupportQt::setMockGeolocationError):
(DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests):
* WebCoreSupport/GeolocationClientQt.cpp:
(WebCore::GeolocationClientQt::positionUpdated):
(WebCore::GeolocationClientQt::startUpdating):

Source/WebKit/win:

Geolocation is now a Supplement in Page so the interface
has changed for setting up the page's geolocation client
initially and accessing the controller later.

* WebView.cpp:
(WebView::initWithFrame):
(WebView::geolocationDidChangePosition):
(WebView::geolocationDidFailWithError):

Source/WebKit2:

Geolocation is now a Supplement in Page so the interface
has changed for setting up the page's geolocation client
initially and accessing the controller later.

* WebProcess/Geolocation/WebGeolocationManager.cpp:
(WebKit::WebGeolocationManager::didChangePosition):
(WebKit::WebGeolocationManager::didFailToDeterminePosition):
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setGeoLocationPermission):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112720 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/geolocation/Geolocation.cpp
Source/WebCore/Modules/geolocation/Geolocation.h
Source/WebCore/Modules/geolocation/GeolocationController.cpp
Source/WebCore/Modules/geolocation/GeolocationController.h
Source/WebCore/WebCore.exp.in
Source/WebCore/page/GeolocationClient.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp
Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
Source/WebKit/gtk/WebCoreSupport/GeolocationClientGtk.cpp
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index cd81c52..02bd0be 100644 (file)
@@ -1,3 +1,42 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation now uses the Supplement interface instead of
+        keeping an instance variable on Page. This allows us to
+        remove all geolocation-related functions, variables, and
+        ifdefs out of Page and into Modules/geolocation/.
+
+        * Modules/geolocation/Geolocation.cpp:
+        (WebCore::Geolocation::stop):
+        (WebCore::Geolocation::lastPosition):
+        (WebCore::Geolocation::requestPermission):
+        (WebCore::Geolocation::startUpdating):
+        (WebCore::Geolocation::stopUpdating):
+        * Modules/geolocation/Geolocation.h:
+        (WebCore):
+        * Modules/geolocation/GeolocationController.cpp:
+        (WebCore::GeolocationController::supplementName):
+        (WebCore):
+        (WebCore::provideGeolocationTo):
+        * Modules/geolocation/GeolocationController.h:
+        (GeolocationController):
+        (WebCore::GeolocationController::from):
+        * WebCore.exp.in:
+        * page/GeolocationClient.h:
+        (WebCore):
+        (GeolocationClient):
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::PageClients::PageClients):
+        * page/Page.h:
+        (WebCore):
+        (PageClients):
+        (Page):
+
 2012-03-30  Anders Carlsson  <andersca@apple.com>
 
         This is fun.
index aa50945..e2cc89c 100644 (file)
@@ -275,7 +275,7 @@ void Geolocation::stop()
 {
     Page* page = this->page();
     if (page && m_allowGeolocation == InProgress)
-        page->geolocationController()->cancelPermissionRequest(this);
+        GeolocationController::from(page)->cancelPermissionRequest(this);
     // The frame may be moving to a new page and we want to get the permissions from the new page's client.
     m_allowGeolocation = Unknown;
     cancelAllRequests();
@@ -291,7 +291,7 @@ Geoposition* Geolocation::lastPosition()
     if (!page)
         return 0;
 
-    m_lastPosition = createGeoposition(page->geolocationController()->lastPosition());
+    m_lastPosition = createGeoposition(GeolocationController::from(page)->lastPosition());
 
     return m_lastPosition.get();
 }
@@ -614,7 +614,7 @@ void Geolocation::requestPermission()
     m_allowGeolocation = InProgress;
 
     // Ask the embedder: it maintains the geolocation challenge policy itself.
-    page->geolocationController()->requestPermission(this);
+    GeolocationController::from(page)->requestPermission(this);
 }
 
 void Geolocation::makeSuccessCallbacks()
@@ -671,7 +671,7 @@ bool Geolocation::startUpdating(GeoNotifier* notifier)
     if (!page)
         return false;
 
-    page->geolocationController()->addObserver(this, notifier->options()->enableHighAccuracy());
+    GeolocationController::from(page)->addObserver(this, notifier->options()->enableHighAccuracy());
     return true;
 }
 
@@ -681,7 +681,7 @@ void Geolocation::stopUpdating()
     if (!page)
         return;
 
-    page->geolocationController()->removeObserver(this);
+    GeolocationController::from(page)->removeObserver(this);
 }
 
 #if USE(PREEMPT_GEOLOCATION_PERMISSION)
index 79b8fef..8b63c7f 100644 (file)
@@ -41,8 +41,9 @@ namespace WebCore {
 
 class Document;
 class Frame;
-class GeolocationPosition;
+class GeolocationController;
 class GeolocationError;
+class GeolocationPosition;
 class Page;
 class ScriptExecutionContext;
 
index c91f318..d64e8b6 100644 (file)
@@ -125,6 +125,17 @@ GeolocationPosition* GeolocationController::lastPosition()
     return m_client->lastPosition();
 }
 
+const AtomicString& GeolocationController::supplementName()
+{
+    DEFINE_STATIC_LOCAL(AtomicString, name, ("GeolocationController"));
+    return name;
+}
+
+void provideGeolocationTo(Page* page, GeolocationClient* client)
+{
+    Supplement<Page>::provideTo(page, GeolocationController::supplementName(), GeolocationController::create(page, client));
+}
+    
 } // namespace WebCore
 
 #endif // ENABLE(GEOLOCATION)
index 9b10397..b5f4f61 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(GEOLOCATION)
 
 #include "Geolocation.h"
+#include "Page.h"
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RefPtr.h>
@@ -40,7 +41,7 @@ class GeolocationError;
 class GeolocationPosition;
 class Page;
 
-class GeolocationController {
+class GeolocationController : public Supplement<Page> {
     WTF_MAKE_NONCOPYABLE(GeolocationController);
 public:
     ~GeolocationController();
@@ -60,6 +61,9 @@ public:
 
     GeolocationClient* client() { return m_client; }
 
+    static const AtomicString& supplementName();
+    static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); }
+
 private:
     GeolocationController(Page*, GeolocationClient*);
 
index 663b8be..bc49b10 100644 (file)
@@ -1721,8 +1721,10 @@ __ZN7WebCore8DragDataC1ERKN3WTF6StringERKNS_8IntPointES7_NS_13DragOperationENS_2
 __ZN7WebCore11Geolocation12setIsAllowedEb
 __ZN7WebCore11GeolocationD1Ev
 __ZNK7WebCore11Geolocation5frameEv
+__ZN7WebCore20provideGeolocationToEPNS_4PageEPNS_17GeolocationClientE
 __ZN7WebCore21GeolocationClientMock13setPermissionEb
 __ZN7WebCore21GeolocationController13errorOccurredEPNS_16GeolocationErrorE
+__ZN7WebCore21GeolocationController14supplementNameEv
 __ZN7WebCore21GeolocationController15positionChangedEPNS_19GeolocationPositionE
 #endif
 
index 44cb909..d893871 100644 (file)
@@ -30,6 +30,7 @@ namespace WebCore {
 
 class Geolocation;
 class GeolocationPosition;
+class Page;
 
 class GeolocationClient {
 public:
@@ -47,10 +48,14 @@ public:
     virtual void requestPermission(Geolocation*) = 0;
     virtual void cancelPermissionRequest(Geolocation*) = 0;
 
+    void provideGeolocationTo(Page*, GeolocationClient*);
+
 protected:
     virtual ~GeolocationClient() { }
 };
 
+void provideGeolocationTo(Page*, GeolocationClient*);
+
 } // namespace WebCore
 
 #endif // GeolocationClient_h
index d72b5fb..23dbad0 100644 (file)
@@ -43,7 +43,6 @@
 #include "FrameSelection.h"
 #include "FrameTree.h"
 #include "FrameView.h"
-#include "GeolocationController.h"
 #include "HTMLElement.h"
 #include "HistoryItem.h"
 #include "InspectorController.h"
@@ -122,9 +121,6 @@ Page::Page(PageClients& pageClients)
 #if ENABLE(INSPECTOR)
     , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient))
 #endif
-#if ENABLE(GEOLOCATION)
-    , m_geolocationController(GeolocationController::create(this, pageClients.geolocationClient))
-#endif
 #if ENABLE(POINTER_LOCK)
     , m_pointerLockController(PointerLockController::create(this))
 #endif
@@ -1120,7 +1116,6 @@ Page::PageClients::PageClients()
     , editorClient(0)
     , dragClient(0)
     , inspectorClient(0)
-    , geolocationClient(0)
 {
 }
 
index d2a7616..d57e853 100644 (file)
@@ -63,8 +63,6 @@ namespace WebCore {
     class FocusController;
     class Frame;
     class FrameSelection;
-    class GeolocationClient;
-    class GeolocationController;
     class HaltablePlugin;
     class HistoryItem;
     class InspectorClient;
@@ -108,7 +106,6 @@ namespace WebCore {
             EditorClient* editorClient;
             DragClient* dragClient;
             InspectorClient* inspectorClient;
-            GeolocationClient* geolocationClient;
             RefPtr<BackForwardList> backForwardClient;
         };
 
@@ -167,9 +164,6 @@ namespace WebCore {
 #if ENABLE(INSPECTOR)
         InspectorController* inspectorController() const { return m_inspectorController.get(); }
 #endif
-#if ENABLE(GEOLOCATION)
-        GeolocationController* geolocationController() const { return m_geolocationController.get(); }
-#endif
 #if ENABLE(POINTER_LOCK)
         PointerLockController* pointerLockController() const { return m_pointerLockController.get(); }
 #endif
@@ -362,9 +356,6 @@ namespace WebCore {
 #if ENABLE(INSPECTOR)
         OwnPtr<InspectorController> m_inspectorController;
 #endif
-#if ENABLE(GEOLOCATION)
-        OwnPtr<GeolocationController> m_geolocationController;
-#endif
 #if ENABLE(POINTER_LOCK)
         OwnPtr<PointerLockController> m_pointerLockController;
 #endif
index 19c914f..391300a 100644 (file)
@@ -325,7 +325,6 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In
     , m_lastUserEventTimestamp(0.0)
     , m_pluginMouseButtonPressed(false)
     , m_pluginMayOpenNewTab(false)
-    , m_geolocationClient(0)
     , m_inRegionScrollStartingNode(0)
 #if USE(ACCELERATED_COMPOSITING)
     , m_rootLayerCommitTimer(adoptPtr(new Timer<WebPagePrivate>(this, &WebPagePrivate::rootLayerCommitTimerFired)))
@@ -428,17 +427,17 @@ void WebPagePrivate::init(const WebString& pageGroupName)
     pageClients.dragClient = dragClient;
     pageClients.inspectorClient = inspectorClient;
 
-    // Note the object will be destroyed when the page is destroyed.
+    m_page = new Page(pageClients);
 #if ENABLE_DRT
-    if (getenv("drtRun"))
-        pageClients.geolocationClient = new GeolocationClientMock();
-    else
-#endif
-        pageClients.geolocationClient = m_geolocationClient = new GeolocationControllerClientBlackBerry(this);
+    if (getenv("drtRun")) {
+        // In case running in DumpRenderTree mode set the controller to mock provider.
+        GeolocationClientMock* mock = new GeolocationClientMock();
+        WebCore::provideGeolocationTo(m_page, mock);
+        mock->setController(WebCore::GeolocationController::from(m_page));
+    } else
 #else
-    pageClients.geolocationClient = m_geolocationClient;
-
-    m_page = new Page(pageClients);
+        WebCore::provideGeolocationTo(m_page, new GeolocationControllerClientBlackBerry(this));
+#endif
     WebCore::provideDeviceOrientationTo(m_page, new DeviceOrientationClientBlackBerry(this));
     WebCore::provideDeviceMotionTo(m_page, new DeviceMotionClientBlackBerry(this));
 
@@ -446,12 +445,6 @@ void WebPagePrivate::init(const WebString& pageGroupName)
     WebCore::provideNotification(m_page, NotificationPresenterImpl::instance());
 #endif
 
-#if ENABLE_DRT
-    // In case running in DumpRenderTree mode set the controller to mock provider.
-    if (getenv("drtRun"))
-        static_cast<GeolocationClientMock*>(pageClients.geolocationClient)->setController(m_page->geolocationController());
-#endif
-
     m_page->setCustomHTMLTokenizerChunkSize(256);
     m_page->setCustomHTMLTokenizerTimeDelay(0.3);
 
index 39ca7ea..0ee1cc3 100644 (file)
@@ -1,3 +1,27 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation is now a Supplement in Page so the interface
+        has changed for setting up the page's geolocation client
+        initially and accessing the controller later.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+        (BlackBerry::WebKit::WebPagePrivate::init):
+        * WebCoreSupport/GeolocationControllerClientBlackBerry.cpp:
+        (GeolocationControllerClientBlackBerry::onLocationUpdate):
+        (GeolocationControllerClientBlackBerry::onLocationError):
+        * WebKitSupport/DumpRenderTreeSupport.cpp:
+        (DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests):
+        (DumpRenderTreeSupport::resetGeolocationMock):
+        (DumpRenderTreeSupport::setMockGeolocationError):
+        (DumpRenderTreeSupport::setMockGeolocationPermission):
+        (DumpRenderTreeSupport::setMockGeolocationPosition):
+
 2012-03-30  Keishi Hattori  <keishi@webkit.org>
 
         Change ENABLE_INPUT_COLOR to ENABLE_INPUT_TYPE_COLOR and enable it for chromium
index ba22043..b337d03 100644 (file)
@@ -82,13 +82,13 @@ void GeolocationControllerClientBlackBerry::onLocationUpdate(double timestamp, d
 {
     m_lastPosition = GeolocationPosition::create(timestamp, latitude, longitude, accuracy, altitudeValid, altitude, altitudeAccuracyValid,
                                                  altitudeAccuracy, headingValid, heading, speedValid, speed);
-    m_webPagePrivate->m_page->geolocationController()->positionChanged(m_lastPosition.get());
+    GeolocationController::from(m_webPagePrivate->m_page)->positionChanged(m_lastPosition.get());
 }
 
 void GeolocationControllerClientBlackBerry::onLocationError(const char* errorStr)
 {
     RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, String::fromUTF8(errorStr));
-    m_webPagePrivate->m_page->geolocationController()->errorOccurred(error.get());
+    GeolocationController::from(m_webPagePrivate->m_page)->errorOccurred(error.get());
 }
 
 void GeolocationControllerClientBlackBerry::onPermission(void* context, bool isAllowed)
index 8c7d2b8..d2f4859 100644 (file)
@@ -96,13 +96,13 @@ void DumpRenderTreeSupport::dumpConfigurationForViewport(Frame* mainFrame, int d
 
 int DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(WebPage* webPage)
 {
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController(corePage(webPage))->client());
     return mockClient->numberOfPendingPermissionRequests();
 }
 
 void DumpRenderTreeSupport::resetGeolocationMock(WebPage* webPage)
 {
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage(webPage))->client());
     mockClient->reset();
 }
 
@@ -118,19 +118,19 @@ void DumpRenderTreeSupport::setMockGeolocationError(WebPage* webPage, int errorC
         break;
     }
 
-    GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(corePage(webPage)->geolocationController()->client());
+    GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage(webPage))->client());
     mockClient->setError(GeolocationError::create(code, message));
 }
 
 void DumpRenderTreeSupport::setMockGeolocationPermission(WebPage* webPage, bool allowed)
 {
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage(webPage))->client());
     mockClient->setPermission(allowed);
 }
 
 void DumpRenderTreeSupport::setMockGeolocationPosition(WebPage* webPage, double latitude, double longitude, double accuracy)
 {
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage(webPage))->client());
     mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
 }
 
index dbdc91a..3889573 100644 (file)
@@ -1,3 +1,17 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation is now a Supplement in Page so the interface
+        has changed for setting up the page's geolocation client
+        initially and accessing the controller later.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+
 2012-03-30  Ian Vollick  <vollick@chromium.org>
 
         [chromium] Flaky animation unit test CCLayerTreeHostTestSynchronizeAnimationStartTimes
index dcb52bf..61e80a8 100644 (file)
@@ -63,6 +63,7 @@
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "GeolocationClientProxy.h"
+#include "GeolocationController.h"
 #include "GraphicsContext.h"
 #include "GraphicsContext3D.h"
 #include "GraphicsContext3DPrivate.h"
@@ -387,7 +388,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
     pageClients.editorClient = &m_editorClientImpl;
     pageClients.dragClient = &m_dragClientImpl;
     pageClients.inspectorClient = &m_inspectorClientImpl;
-    pageClients.geolocationClient = m_geolocationClientProxy.get();
     pageClients.backForwardClient = BackForwardListChromium::create(this);
 
     m_page = adoptPtr(new Page(pageClients));
@@ -405,8 +405,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
 #endif
 
     provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
-    m_geolocationClientProxy->setController(m_page->geolocationController());
-
+    provideGeolocationTo(m_page.get(), m_geolocationClientProxy.get());
+    m_geolocationClientProxy->setController(GeolocationController::from(m_page.get()));
+    
     m_page->setGroupName(pageGroupName);
 
 #if ENABLE(PAGE_VISIBILITY_API)
index 33db84b..685d794 100644 (file)
@@ -1,3 +1,26 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation is now a Supplement in Page so the interface
+        has changed for setting up the page's geolocation client
+        initially and accessing the controller later.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::resetGeolocationClientMock):
+        (DumpRenderTreeSupportGtk::setMockGeolocationPermission):
+        (DumpRenderTreeSupportGtk::setMockGeolocationPosition):
+        (DumpRenderTreeSupportGtk::setMockGeolocationError):
+        (DumpRenderTreeSupportGtk::numberOfPendingGeolocationPermissionRequests):
+        * WebCoreSupport/GeolocationClientGtk.cpp:
+        (WebKit::GeolocationClient::updatePosition):
+        (WebKit::GeolocationClient::errorOccured):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_init):
+
 2012-03-29  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r112553.
index 300f1db..1a00739 100644 (file)
@@ -794,7 +794,7 @@ void DumpRenderTreeSupportGtk::scalePageBy(WebKitWebView* webView, float scaleFa
 void DumpRenderTreeSupportGtk::resetGeolocationClientMock(WebKitWebView* webView)
 {
 #if ENABLE(GEOLOCATION)
-    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
+    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
     mock->reset();
 #endif
 }
@@ -802,7 +802,7 @@ void DumpRenderTreeSupportGtk::resetGeolocationClientMock(WebKitWebView* webView
 void DumpRenderTreeSupportGtk::setMockGeolocationPermission(WebKitWebView* webView, bool allowed)
 {
 #if ENABLE(GEOLOCATION)
-    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
+    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
     mock->setPermission(allowed);
 #endif
 }
@@ -810,7 +810,7 @@ void DumpRenderTreeSupportGtk::setMockGeolocationPermission(WebKitWebView* webVi
 void DumpRenderTreeSupportGtk::setMockGeolocationPosition(WebKitWebView* webView, double latitude, double longitude, double accuracy)
 {
 #if ENABLE(GEOLOCATION)
-    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
+    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
 
     double timestamp = g_get_real_time() / 1000000.0;
     mock->setPosition(GeolocationPosition::create(timestamp, latitude, longitude, accuracy));
@@ -820,7 +820,7 @@ void DumpRenderTreeSupportGtk::setMockGeolocationPosition(WebKitWebView* webView
 void DumpRenderTreeSupportGtk::setMockGeolocationError(WebKitWebView* webView, int errorCode, const gchar* errorMessage)
 {
 #if ENABLE(GEOLOCATION)
-    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
+    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
 
     GeolocationError::ErrorCode code;
     switch (errorCode) {
@@ -840,7 +840,7 @@ void DumpRenderTreeSupportGtk::setMockGeolocationError(WebKitWebView* webView, i
 int DumpRenderTreeSupportGtk::numberOfPendingGeolocationPermissionRequests(WebKitWebView* webView)
 {
 #if ENABLE(GEOLOCATION)
-    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
+    GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
     return mock->numberOfPendingPermissionRequests();
 #endif
 }
index 2b90618..9f6915c 100644 (file)
@@ -175,13 +175,13 @@ void GeolocationClient::updatePosition()
 {
     m_lastPosition = WebCore::GeolocationPosition::create(static_cast<double>(m_timestamp), m_latitude, m_longitude, m_accuracy,
                                                           true, m_altitude, true, m_altitudeAccuracy, false, 0, false, 0);
-    core(m_webView)->geolocationController()->positionChanged(m_lastPosition.get());
+    WebCore::GeolocationController::from(core(m_webView))->positionChanged(m_lastPosition.get());
 }
 
 void GeolocationClient::errorOccured(const char* message)
 {
     RefPtr<WebCore::GeolocationError> error = WebCore::GeolocationError::create(WebCore::GeolocationError::PositionUnavailable, message);
-    core(m_webView)->geolocationController()->errorOccurred(error.get());
+    WebCore::GeolocationController::from(core(m_webView))->errorOccurred(error.get());
 }
 
 }
index 51fcdee..69bf6f3 100644 (file)
 #include "FrameLoaderClient.h"
 #include "FrameLoaderTypes.h"
 #include "FrameView.h"
+#include "GOwnPtrGtk.h"
 #include "GeolocationClientGtk.h"
 #include "GeolocationClientMock.h"
-#include "GOwnPtrGtk.h"
+#include "GeolocationController.h"
 #include "GraphicsContext.h"
 #include "GtkUtilities.h"
 #include "GtkVersioning.h"
@@ -3567,15 +3568,17 @@ static void webkit_web_view_init(WebKitWebView* webView)
     pageClients.editorClient = new WebKit::EditorClient(webView);
     pageClients.dragClient = new WebKit::DragClient(webView);
     pageClients.inspectorClient = new WebKit::InspectorClient(webView);
-#if ENABLE(GEOLOCATION)
-    if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled())
-        pageClients.geolocationClient = new GeolocationClientMock;
-    else
-        pageClients.geolocationClient = new WebKit::GeolocationClient(webView);
-#endif
 
     priv->corePage = new Page(pageClients);
 
+#if ENABLE(GEOLOCATION)
+    if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) {
+        GeolocationClientMock* mock = new GeolocationClientMock;
+        WebCore::provideGeolocationTo(priv->corePage, mock);
+        mock->setController(GeolocationController::from(priv->corePage));
+    } else
+        WebCore::provideGeolocationTo(priv->corePage, new WebKit::GeolocationClient(webView));
+#endif
 #if ENABLE(DEVICE_ORIENTATION)
     WebCore::provideDeviceMotionTo(priv->corePage, new DeviceMotionClientGtk);
     WebCore::provideDeviceOrientationTo(priv->corePage, new DeviceOrientationClientGtk);
@@ -3586,9 +3589,6 @@ static void webkit_web_view_init(WebKitWebView* webView)
 #endif
 
     if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) {
-#if ENABLE(GEOLOCATION)
-        static_cast<GeolocationClientMock*>(pageClients.geolocationClient)->setController(priv->corePage->geolocationController());
-#endif
         // Set some testing-specific settings
         priv->corePage->settings()->setInteractiveFormValidationEnabled(true);
         priv->corePage->settings()->setValidationMessageTimerMagnification(-1);
index e8f4c30..f0059a7 100644 (file)
@@ -1,3 +1,19 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation is now a Supplement in Page so the interface
+        has changed for setting up the page's geolocation client
+        initially and accessing the controller later.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView _geolocationDidChangePosition:]):
+        (-[WebView _geolocationDidFailWithError:]):
+
 2012-03-30  Keishi Hattori  <keishi@webkit.org>
 
         Change ENABLE_INPUT_COLOR to ENABLE_INPUT_TYPE_COLOR and enable it for chromium
index d2ec914..c94ac3c 100644 (file)
@@ -736,10 +736,10 @@ static NSString *leakOutlookQuirksUserScriptContents()
     pageClients.editorClient = new WebEditorClient(self);
     pageClients.dragClient = new WebDragClient(self);
     pageClients.inspectorClient = new WebInspectorClient(self);
+    _private->page = new Page(pageClients);
 #if ENABLE(GEOLOCATION)
-    pageClients.geolocationClient = new WebGeolocationClient(self);
+    WebCore::provideGeolocationTo(_private->page, new WebGeolocationClient(self));
 #endif
-    _private->page = new Page(pageClients);
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     WebCore::provideNotification(_private->page, new WebNotificationClient(self));
 #endif
@@ -6388,7 +6388,7 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity
 {
 #if ENABLE(GEOLOCATION)
     if (_private && _private->page)
-        _private->page->geolocationController()->positionChanged(core(position));
+        WebCore::GeolocationController::from(_private->page)->positionChanged(core(position));
 #endif // ENABLE(GEOLOCATION)
 }
 
@@ -6397,7 +6397,7 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity
 #if ENABLE(GEOLOCATION)
     if (_private && _private->page) {
         RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, [error localizedDescription]);
-        _private->page->geolocationController()->errorOccurred(geolocatioError.get());
+        WebCore::GeolocationController::from(_private->page)->errorOccurred(geolocatioError.get());
     }
 #endif // ENABLE(GEOLOCATION)
 }
index e96903e..5105827 100644 (file)
@@ -67,6 +67,7 @@
 #if ENABLE(GEOLOCATION)
 #include "GeolocationClientMock.h"
 #include "GeolocationClientQt.h"
+#include "GeolocationController.h"
 #endif
 #include "GeolocationPermissionClientQt.h"
 #include "HTMLFormElement.h"
@@ -326,13 +327,16 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
     pageClients.editorClient = new EditorClientQt(q);
     pageClients.dragClient = new DragClientQt(q);
     pageClients.inspectorClient = new InspectorClientQt(q);
+    page = new Page(pageClients);
 #if ENABLE(GEOLOCATION)
-    if (useMock)
-        pageClients.geolocationClient = new GeolocationClientMock;
-    else
-        pageClients.geolocationClient = new GeolocationClientQt(q);
+    if (useMock) {
+        // In case running in DumpRenderTree mode set the controller to mock provider.
+        GeolocationClientMock* mock = new GeolocationClientMock;
+        WebCore::provideGeolocationTo(page, mock);
+        mock->setController(WebCore::GeolocationController::from(page));
+    } else
+        WebCore::provideGeolocationTo(page, new GeolocationClientQt(q));
 #endif
-    page = new Page(pageClients);
 #if ENABLE(DEVICE_ORIENTATION)
     if (useMock)
         WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientMock);
@@ -351,11 +355,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
     // as expected out of the box, we use a default group similar to what other ports are doing.
     page->setGroupName("Default Group");
 
-    // In case running in DumpRenderTree mode set the controller to mock provider.
-#if ENABLE(GEOLOCATION)
-    if (QWebPagePrivate::drtRun)
-        static_cast<GeolocationClientMock*>(pageClients.geolocationClient)->setController(page->geolocationController());
-#endif
     settings = new QWebSettings(page->settings());
 
 #if ENABLE(WEB_SOCKETS)
index 2722003..a4979fb 100644 (file)
@@ -1,3 +1,26 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation is now a Supplement in Page so the interface
+        has changed for setting up the page's geolocation client
+        initially and accessing the controller later.
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::QWebPagePrivate):
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::resetGeolocationMock):
+        (DumpRenderTreeSupportQt::setMockGeolocationPermission):
+        (DumpRenderTreeSupportQt::setMockGeolocationPosition):
+        (DumpRenderTreeSupportQt::setMockGeolocationError):
+        (DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests):
+        * WebCoreSupport/GeolocationClientQt.cpp:
+        (WebCore::GeolocationClientQt::positionUpdated):
+        (WebCore::GeolocationClientQt::startUpdating):
+
 2012-03-29  Ádám Kallai  <kadam@inf.u-szeged.hu>
 
         [Qt] Build fix by renameing QtDeclarative to QtQml in header calls.
index 4746a70..ff7c094 100644 (file)
@@ -840,7 +840,7 @@ void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPage* page)
 {
 #if ENABLE(GEOLOCATION)
     Page* corePage = QWebPagePrivate::core(page);
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     mockClient->reset();
 #endif
 }
@@ -849,7 +849,7 @@ void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPage* page, bool
 {
 #if ENABLE(GEOLOCATION)
     Page* corePage = QWebPagePrivate::core(page);
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     mockClient->setPermission(allowed);
 #endif
 }
@@ -858,7 +858,7 @@ void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPage* page, double
 {
 #if ENABLE(GEOLOCATION)
     Page* corePage = QWebPagePrivate::core(page);
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
 #endif
 }
@@ -878,7 +878,7 @@ void DumpRenderTreeSupportQt::setMockGeolocationError(QWebPage* page, int errorC
         break;
     }
 
-    GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(corePage->geolocationController()->client());
+    GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage)->client());
     mockClient->setError(GeolocationError::create(code, message));
 #endif
 }
@@ -887,7 +887,7 @@ int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPa
 {
 #if ENABLE(GEOLOCATION)
     Page* corePage = QWebPagePrivate::core(page);
-    GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
+    GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     return mockClient->numberOfPendingPermissionRequests();
 #else
     return -1;
index cda5f35..8551cf9 100644 (file)
@@ -94,7 +94,7 @@ void GeolocationClientQt::positionUpdated(const QGeoPositionInfo& geoPosition)
                                                  providesHeading, heading, providesSpeed, speed);
 
     WebCore::Page* page = QWebPagePrivate::core(m_page);
-    page->geolocationController()->positionChanged(m_lastPosition.get());
+    GeolocationController::from(page)->positionChanged(m_lastPosition.get());
 }
 
 void GeolocationClientQt::startUpdating()
@@ -105,7 +105,7 @@ void GeolocationClientQt::startUpdating()
     if (!m_location) {
         WebCore::Page* page = QWebPagePrivate::core(m_page);
         RefPtr<WebCore::GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, failedToStartServiceErrorMessage);
-        page->geolocationController()->errorOccurred(error.get());
+        GeolocationController::from(page)->errorOccurred(error.get());
         return;
     }
 
index dd9f1f3..3d75100 100644 (file)
@@ -1,3 +1,19 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation is now a Supplement in Page so the interface
+        has changed for setting up the page's geolocation client
+        initially and accessing the controller later.
+
+        * WebView.cpp:
+        (WebView::initWithFrame):
+        (WebView::geolocationDidChangePosition):
+        (WebView::geolocationDidFailWithError):
+
 2012-03-29  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r112553.
index f342ebd..e1ab0cc 100644 (file)
@@ -2666,8 +2666,8 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
     pageClients.editorClient = new WebEditorClient(this);
     pageClients.dragClient = new WebDragClient(this);
     pageClients.inspectorClient = m_inspectorClient;
-    pageClients.geolocationClient = new WebGeolocationClient(this);
     m_page = new Page(pageClients);
+    provideGeolocationTo(m_page, new WebGeolocationClient(this));
 
     BSTR localStoragePath;
     if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) {
@@ -6566,7 +6566,7 @@ HRESULT WebView::geolocationDidChangePosition(IWebGeolocationPosition* position)
 {
     if (!m_page)
         return E_FAIL;
-    m_page->geolocationController()->positionChanged(core(position));
+    GeolocationController::from(m_page)->positionChanged(core(position));
     return S_OK;
 }
 
@@ -6584,7 +6584,7 @@ HRESULT WebView::geolocationDidFailWithError(IWebError* error)
     SysFreeString(descriptionBSTR);
 
     RefPtr<GeolocationError> geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, descriptionString);
-    m_page->geolocationController()->errorOccurred(geolocationError.get());
+    GeolocationController::from(m_page)->errorOccurred(geolocationError.get());
     return S_OK;
 }
 
index 93a280b..bf988c8 100644 (file)
@@ -1,3 +1,22 @@
+2012-03-30  Mark Pilgrim  <pilgrim@chromium.org>
+
+        GEOLOCATION should be implemented as Page Supplement
+        https://bugs.webkit.org/show_bug.cgi?id=82228
+
+        Reviewed by Adam Barth.
+
+        Geolocation is now a Supplement in Page so the interface
+        has changed for setting up the page's geolocation client
+        initially and accessing the controller later.
+
+        * WebProcess/Geolocation/WebGeolocationManager.cpp:
+        (WebKit::WebGeolocationManager::didChangePosition):
+        (WebKit::WebGeolocationManager::didFailToDeterminePosition):
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setGeoLocationPermission):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+
 2012-03-30  Anders Carlsson  <andersca@apple.com>
 
         Show a scrolling indicator light when compositing borders are turned on
index 60b81d1..2b97676 100644 (file)
@@ -81,7 +81,7 @@ void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data
     for (; it != end; ++it) {
         WebPage* page = *it;
         if (page->corePage())
-            page->corePage()->geolocationController()->positionChanged(position.get());
+            GeolocationController::from(page->corePage())->positionChanged(position.get());
     }
 #endif // ENABLE(GEOLOCATION)
 }
@@ -97,7 +97,7 @@ void WebGeolocationManager::didFailToDeterminePosition()
     for (; it != end; ++it) {
         WebPage* page = *it;
         if (page->corePage())
-            page->corePage()->geolocationController()->errorOccurred(error.get());
+            GeolocationController::from(page->corePage())->errorOccurred(error.get());
     }
 #endif // ENABLE(GEOLOCATION)
 }
index 42f8674..c60a30b 100644 (file)
@@ -198,7 +198,7 @@ void InjectedBundle::setGeoLocationPermission(WebPageGroupProxy* pageGroup, bool
 #if ENABLE(GEOLOCATION)
     const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
     for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
-        static_cast<GeolocationClientMock*>((*iter)->geolocationController()->client())->setPermission(enabled);
+        static_cast<GeolocationClientMock*>(GeolocationController::from(*iter)->client())->setPermission(enabled);
 #endif // ENABLE(GEOLOCATION)
 }
 
index 074c2e6..96a5e1a 100644 (file)
@@ -231,15 +231,15 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     pageClients.editorClient = new WebEditorClient(this);
     pageClients.dragClient = new WebDragClient(this);
     pageClients.backForwardClient = WebBackForwardListProxy::create(this);
-#if ENABLE(GEOLOCATION)
-    pageClients.geolocationClient = new WebGeolocationClient(this);
-#endif
 #if ENABLE(INSPECTOR)
     pageClients.inspectorClient = new WebInspectorClient(this);
 #endif
     
     m_page = adoptPtr(new Page(pageClients));
 
+#if ENABLE(GEOLOCATION)
+    WebCore::provideGeolocationTo(m_page.get(), new WebGeolocationClient(this));
+#endif
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     WebCore::provideNotification(m_page.get(), new WebNotificationClient(this));
 #endif