Source/WebCore/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation now uses the Supplement interface instead of
 9 keeping an instance variable on Page. This allows us to
 10 remove all geolocation-related functions, variables, and
 11 ifdefs out of Page and into Modules/geolocation/.
 12
 13 * Modules/geolocation/Geolocation.cpp:
 14 (WebCore::Geolocation::stop):
 15 (WebCore::Geolocation::lastPosition):
 16 (WebCore::Geolocation::requestPermission):
 17 (WebCore::Geolocation::startUpdating):
 18 (WebCore::Geolocation::stopUpdating):
 19 * Modules/geolocation/Geolocation.h:
 20 (WebCore):
 21 * Modules/geolocation/GeolocationController.cpp:
 22 (WebCore::GeolocationController::supplementName):
 23 (WebCore):
 24 (WebCore::provideGeolocationTo):
 25 * Modules/geolocation/GeolocationController.h:
 26 (GeolocationController):
 27 (WebCore::GeolocationController::from):
 28 * WebCore.exp.in:
 29 * page/GeolocationClient.h:
 30 (WebCore):
 31 (GeolocationClient):
 32 * page/Page.cpp:
 33 (WebCore::Page::Page):
 34 (WebCore::Page::PageClients::PageClients):
 35 * page/Page.h:
 36 (WebCore):
 37 (PageClients):
 38 (Page):
 39
1402012-03-29 Andrey Kosyakov <caseq@chromium.org>
241
342 Web Inspector: timeline overview window selection is not reset upon clear/record
112527

Source/WebCore/WebCore.exp.in

@@__ZN7WebCore8DragDataC1ERKN3WTF6StringER
17211721__ZN7WebCore11Geolocation12setIsAllowedEb
17221722__ZN7WebCore11GeolocationD1Ev
17231723__ZNK7WebCore11Geolocation5frameEv
 1724__ZN7WebCore20provideGeolocationToEPNS_4PageEPNS_17GeolocationClientE
17241725__ZN7WebCore21GeolocationClientMock13setPermissionEb
17251726__ZN7WebCore21GeolocationController13errorOccurredEPNS_16GeolocationErrorE
 1727__ZN7WebCore21GeolocationController14supplementNameEv
17261728__ZN7WebCore21GeolocationController15positionChangedEPNS_19GeolocationPositionE
 1729__ZN7WebCore21GeolocationController4fromEPNS_4PageE
17271730#endif
17281731
17291732#if ENABLE(ICONDATABASE)
112427

Source/WebCore/Modules/geolocation/Geolocation.cpp

@@void Geolocation::stop()
275275{
276276 Page* page = this->page();
277277 if (page && m_allowGeolocation == InProgress)
278  page->geolocationController()->cancelPermissionRequest(this);
 278 GeolocationController::from(page)->cancelPermissionRequest(this);
279279 // The frame may be moving to a new page and we want to get the permissions from the new page's client.
280280 m_allowGeolocation = Unknown;
281281 cancelAllRequests();

@@Geoposition* Geolocation::lastPosition()
291291 if (!page)
292292 return 0;
293293
294  m_lastPosition = createGeoposition(page->geolocationController()->lastPosition());
 294 m_lastPosition = createGeoposition(GeolocationController::from(page)->lastPosition());
295295
296296 return m_lastPosition.get();
297297}

@@void Geolocation::requestPermission()
614614 m_allowGeolocation = InProgress;
615615
616616 // Ask the embedder: it maintains the geolocation challenge policy itself.
617  page->geolocationController()->requestPermission(this);
 617 GeolocationController::from(page)->requestPermission(this);
618618}
619619
620620void Geolocation::positionChangedInternal()

@@bool Geolocation::startUpdating(GeoNotif
676676 if (!page)
677677 return false;
678678
679  page->geolocationController()->addObserver(this, notifier->options()->enableHighAccuracy());
 679 GeolocationController::from(page)->addObserver(this, notifier->options()->enableHighAccuracy());
680680 return true;
681681}
682682

@@void Geolocation::stopUpdating()
686686 if (!page)
687687 return;
688688
689  page->geolocationController()->removeObserver(this);
 689 GeolocationController::from(page)->removeObserver(this);
690690}
691691
692692#if USE(PREEMPT_GEOLOCATION_PERMISSION)
112427

Source/WebCore/Modules/geolocation/Geolocation.h

@@namespace WebCore {
4141
4242class Document;
4343class Frame;
44 class GeolocationPosition;
 44class GeolocationController;
4545class GeolocationError;
 46class GeolocationPosition;
4647class Page;
4748class ScriptExecutionContext;
4849
112427

Source/WebCore/Modules/geolocation/GeolocationController.cpp

@@GeolocationPosition* GeolocationControll
125125 return m_client->lastPosition();
126126}
127127
 128const AtomicString& GeolocationController::supplementName()
 129{
 130 DEFINE_STATIC_LOCAL(AtomicString, name, ("GeolocationController"));
 131 return name;
 132}
 133
 134void provideGeolocationTo(Page* page, GeolocationClient* client)
 135{
 136 Supplement<Page>::provideTo(page, GeolocationController::supplementName(), GeolocationController::create(page, client));
 137}
 138
128139} // namespace WebCore
129140
130141#endif // ENABLE(GEOLOCATION)
112427

Source/WebCore/Modules/geolocation/GeolocationController.h

2929#if ENABLE(GEOLOCATION)
3030
3131#include "Geolocation.h"
 32#include "Page.h"
3233#include <wtf/HashSet.h>
3334#include <wtf/Noncopyable.h>
3435#include <wtf/RefPtr.h>

@@class GeolocationError;
4041class GeolocationPosition;
4142class Page;
4243
43 class GeolocationController {
 44class GeolocationController : public Supplement<Page> {
4445 WTF_MAKE_NONCOPYABLE(GeolocationController);
4546public:
4647 ~GeolocationController();

@@public:
6061
6162 GeolocationClient* client() { return m_client; }
6263
 64 static const AtomicString& supplementName();
 65 static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); }
 66
6367private:
6468 GeolocationController(Page*, GeolocationClient*);
6569
112427

Source/WebCore/page/GeolocationClient.h

@@namespace WebCore {
3030
3131class Geolocation;
3232class GeolocationPosition;
 33class Page;
3334
3435class GeolocationClient {
3536public:

@@public:
4748 virtual void requestPermission(Geolocation*) = 0;
4849 virtual void cancelPermissionRequest(Geolocation*) = 0;
4950
 51 void provideGeolocationTo(Page*, GeolocationClient*);
 52
5053protected:
5154 virtual ~GeolocationClient() { }
5255};
5356
 57void provideGeolocationTo(Page*, GeolocationClient*);
 58
5459} // namespace WebCore
5560
5661#endif // GeolocationClient_h
112427

Source/WebCore/page/Page.cpp

4343#include "FrameSelection.h"
4444#include "FrameTree.h"
4545#include "FrameView.h"
46 #include "GeolocationController.h"
4746#include "HTMLElement.h"
4847#include "HistoryItem.h"
4948#include "InspectorController.h"

@@Page::Page(PageClients& pageClients)
122121#if ENABLE(INSPECTOR)
123122 , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient))
124123#endif
125 #if ENABLE(GEOLOCATION)
126  , m_geolocationController(GeolocationController::create(this, pageClients.geolocationClient))
127 #endif
128124#if ENABLE(POINTER_LOCK)
129125 , m_pointerLockController(PointerLockController::create(this))
130126#endif

@@Page::PageClients::PageClients()
11201116 , editorClient(0)
11211117 , dragClient(0)
11221118 , inspectorClient(0)
1123  , geolocationClient(0)
11241119{
11251120}
11261121
112427

Source/WebCore/page/Page.h

@@namespace WebCore {
6363 class FocusController;
6464 class Frame;
6565 class FrameSelection;
66  class GeolocationClient;
67  class GeolocationController;
6866 class HaltablePlugin;
6967 class HistoryItem;
7068 class InspectorClient;

@@namespace WebCore {
108106 EditorClient* editorClient;
109107 DragClient* dragClient;
110108 InspectorClient* inspectorClient;
111  GeolocationClient* geolocationClient;
112109 RefPtr<BackForwardList> backForwardClient;
113110 };
114111

@@namespace WebCore {
167164#if ENABLE(INSPECTOR)
168165 InspectorController* inspectorController() const { return m_inspectorController.get(); }
169166#endif
170 #if ENABLE(GEOLOCATION)
171  GeolocationController* geolocationController() const { return m_geolocationController.get(); }
172 #endif
173167#if ENABLE(POINTER_LOCK)
174168 PointerLockController* pointerLockController() const { return m_pointerLockController.get(); }
175169#endif

@@namespace WebCore {
362356#if ENABLE(INSPECTOR)
363357 OwnPtr<InspectorController> m_inspectorController;
364358#endif
365 #if ENABLE(GEOLOCATION)
366  OwnPtr<GeolocationController> m_geolocationController;
367 #endif
368359#if ENABLE(POINTER_LOCK)
369360 OwnPtr<PointerLockController> m_pointerLockController;
370361#endif
112427

Source/WebKit2/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation is now a Supplement in Page so the interface
 9 has changed for setting up the page's geolocation client
 10 initially and accessing the controller later.
 11
 12 * WebProcess/Geolocation/WebGeolocationManager.cpp:
 13 (WebKit::WebGeolocationManager::didChangePosition):
 14 (WebKit::WebGeolocationManager::didFailToDeterminePosition):
 15 * WebProcess/InjectedBundle/InjectedBundle.cpp:
 16 (WebKit::InjectedBundle::setGeoLocationPermission):
 17 * WebProcess/WebPage/WebPage.cpp:
 18 (WebKit::WebPage::WebPage):
 19
1202012-03-28 Anders Carlsson <andersca@apple.com>
221
322 Fix a crash and an assertion when recovering from a web process crash
112527

Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp

@@void WebGeolocationManager::didChangePos
8181 for (; it != end; ++it) {
8282 WebPage* page = *it;
8383 if (page->corePage())
84  page->corePage()->geolocationController()->positionChanged(position.get());
 84 GeolocationController::from(page->corePage())->positionChanged(position.get());
8585 }
8686#endif // ENABLE(GEOLOCATION)
8787}

@@void WebGeolocationManager::didFailToDet
9797 for (; it != end; ++it) {
9898 WebPage* page = *it;
9999 if (page->corePage())
100  page->corePage()->geolocationController()->errorOccurred(error.get());
 100 GeolocationController::from(page->corePage())->errorOccurred(error.get());
101101 }
102102#endif // ENABLE(GEOLOCATION)
103103}
112427

Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp

@@void InjectedBundle::setGeoLocationPermi
198198#if ENABLE(GEOLOCATION)
199199 const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
200200 for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
201  static_cast<GeolocationClientMock*>((*iter)->geolocationController()->client())->setPermission(enabled);
 201 static_cast<GeolocationClientMock*>(GeolocationController::from(*iter)->client())->setPermission(enabled);
202202#endif // ENABLE(GEOLOCATION)
203203}
204204
112427

Source/WebKit2/WebProcess/WebPage/WebPage.cpp

@@WebPage::WebPage(uint64_t pageID, const
232232 pageClients.dragClient = new WebDragClient(this);
233233 pageClients.backForwardClient = WebBackForwardListProxy::create(this);
234234#if ENABLE(GEOLOCATION)
235  pageClients.geolocationClient = new WebGeolocationClient(this);
 235 WebCore::provideGeolocationTo(m_page.get(), new WebGeolocationClient(this));
236236#endif
237237#if ENABLE(INSPECTOR)
238238 pageClients.inspectorClient = new WebInspectorClient(this);
112427

Source/WebKit/blackberry/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation is now a Supplement in Page so the interface
 9 has changed for setting up the page's geolocation client
 10 initially and accessing the controller later.
 11
 12 * Api/WebPage.cpp:
 13 (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
 14 (BlackBerry::WebKit::WebPagePrivate::init):
 15 * WebCoreSupport/GeolocationControllerClientBlackBerry.cpp:
 16 (GeolocationControllerClientBlackBerry::onLocationUpdate):
 17 (GeolocationControllerClientBlackBerry::onLocationError):
 18 * WebKitSupport/DumpRenderTreeSupport.cpp:
 19 (DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests):
 20 (DumpRenderTreeSupport::resetGeolocationMock):
 21 (DumpRenderTreeSupport::setMockGeolocationError):
 22 (DumpRenderTreeSupport::setMockGeolocationPermission):
 23 (DumpRenderTreeSupport::setMockGeolocationPosition):
 24
1252012-03-28 Nate Chapin <japhet@chromium.org>
226
327 Remove dispatchDidLoadMainResource callback, since no
112527

Source/WebKit/blackberry/Api/WebPage.cpp

@@WebPagePrivate::WebPagePrivate(WebPage*
325325 , m_lastUserEventTimestamp(0.0)
326326 , m_pluginMouseButtonPressed(false)
327327 , m_pluginMayOpenNewTab(false)
328  , m_geolocationClient(0)
329328 , m_inRegionScrollStartingNode(0)
330329#if USE(ACCELERATED_COMPOSITING)
331330 , m_rootLayerCommitTimer(adoptPtr(new Timer<WebPagePrivate>(this, &WebPagePrivate::rootLayerCommitTimerFired)))

@@void WebPagePrivate::init(const WebStrin
428427 pageClients.dragClient = dragClient;
429428 pageClients.inspectorClient = inspectorClient;
430429
431  // Note the object will be destroyed when the page is destroyed.
 430 m_page = new Page(pageClients);
432431#if ENABLE_DRT
433  if (getenv("drtRun"))
434  pageClients.geolocationClient = new GeolocationClientMock();
435  else
436 #endif
437  pageClients.geolocationClient = m_geolocationClient = new GeolocationControllerClientBlackBerry(this);
 432 if (getenv("drtRun")) {
 433 // In case running in DumpRenderTree mode set the controller to mock provider.
 434 GeolocationClientMock* mock = new GeolocationClientMock();
 435 WebCore::provideGeolocationTo(m_page, mock);
 436 mock->setController(WebCore::GeolocationController::from(m_page));
 437 } else
438438#else
439  pageClients.geolocationClient = m_geolocationClient;
440 
441  m_page = new Page(pageClients);
 439 WebCore::provideGeolocationTo(m_page, new GeolocationControllerClientBlackBerry(this));
 440#endif
442441 WebCore::provideDeviceOrientationTo(m_page, new DeviceOrientationClientBlackBerry(this));
443442 WebCore::provideDeviceMotionTo(m_page, new DeviceMotionClientBlackBerry(this));
444443

@@void WebPagePrivate::init(const WebStrin
446445 WebCore::provideNotification(m_page, NotificationPresenterImpl::instance());
447446#endif
448447
449 #if ENABLE_DRT
450  // In case running in DumpRenderTree mode set the controller to mock provider.
451  if (getenv("drtRun"))
452  static_cast<GeolocationClientMock*>(pageClients.geolocationClient)->setController(m_page->geolocationController());
453 #endif
454 
455448 m_page->setCustomHTMLTokenizerChunkSize(256);
456449 m_page->setCustomHTMLTokenizerTimeDelay(0.3);
457450
112427

Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp

@@void GeolocationControllerClientBlackBer
8282{
8383 m_lastPosition = GeolocationPosition::create(timestamp, latitude, longitude, accuracy, altitudeValid, altitude, altitudeAccuracyValid,
8484 altitudeAccuracy, headingValid, heading, speedValid, speed);
85  m_webPagePrivate->m_page->geolocationController()->positionChanged(m_lastPosition.get());
 85 GeolocationController::from(m_webPagePrivate->m_page)->positionChanged(m_lastPosition.get());
8686}
8787
8888void GeolocationControllerClientBlackBerry::onLocationError(const char* errorStr)
8989{
9090 RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, String::fromUTF8(errorStr));
91  m_webPagePrivate->m_page->geolocationController()->errorOccurred(error.get());
 91 GeolocationController::from(m_webPagePrivate->m_page)->errorOccurred(error.get());
9292}
9393
9494void GeolocationControllerClientBlackBerry::onPermission(void* context, bool isAllowed)
112427

Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp

@@void DumpRenderTreeSupport::dumpConfigur
9696
9797int DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(WebPage* webPage)
9898{
99  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
 99 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController(corePage(webPage))->client());
100100 return mockClient->numberOfPendingPermissionRequests();
101101}
102102
103103void DumpRenderTreeSupport::resetGeolocationMock(WebPage* webPage)
104104{
105  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
 105 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage(webPage))->client());
106106 mockClient->reset();
107107}
108108

@@void DumpRenderTreeSupport::setMockGeolo
118118 break;
119119 }
120120
121  GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(corePage(webPage)->geolocationController()->client());
 121 GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage(webPage))->client());
122122 mockClient->setError(GeolocationError::create(code, message));
123123}
124124
125125void DumpRenderTreeSupport::setMockGeolocationPermission(WebPage* webPage, bool allowed)
126126{
127  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
 127 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage(webPage))->client());
128128 mockClient->setPermission(allowed);
129129}
130130
131131void DumpRenderTreeSupport::setMockGeolocationPosition(WebPage* webPage, double latitude, double longitude, double accuracy)
132132{
133  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage(webPage)->geolocationController()->client());
 133 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage(webPage))->client());
134134 mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
135135}
136136
112427

Source/WebKit/chromium/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation is now a Supplement in Page so the interface
 9 has changed for setting up the page's geolocation client
 10 initially and accessing the controller later.
 11
 12 * src/WebViewImpl.cpp:
 13 (WebKit::WebViewImpl::WebViewImpl):
 14
1152012-03-29 Tommy Widenflycht <tommyw@google.com>
216
317 MediaStream API: Adding better comments for the WebRTC methods in WebKitPlatformSupport.h
112527

Source/WebKit/chromium/src/WebViewImpl.cpp

6363#include "FrameTree.h"
6464#include "FrameView.h"
6565#include "GeolocationClientProxy.h"
 66#include "GeolocationController.h"
6667#include "GraphicsContext.h"
6768#include "GraphicsContext3D.h"
6869#include "GraphicsContext3DPrivate.h"

@@WebViewImpl::WebViewImpl(WebViewClient*
385386 pageClients.editorClient = &m_editorClientImpl;
386387 pageClients.dragClient = &m_dragClientImpl;
387388 pageClients.inspectorClient = &m_inspectorClientImpl;
388  pageClients.geolocationClient = m_geolocationClientProxy.get();
389389 pageClients.backForwardClient = BackForwardListChromium::create(this);
390390
391391 m_page = adoptPtr(new Page(pageClients));

@@WebViewImpl::WebViewImpl(WebViewClient*
403403#endif
404404
405405 provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
406  m_geolocationClientProxy->setController(m_page->geolocationController());
407 
 406 provideGeolocationTo(m_page.get(), m_geolocationClientProxy.get());
 407 m_geolocationClientProxy->setController(GeolocationController::from(m_page.get()));
 408
408409 m_page->setGroupName(pageGroupName);
409410
410411#if ENABLE(PAGE_VISIBILITY_API)
112427

Source/WebKit/gtk/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation is now a Supplement in Page so the interface
 9 has changed for setting up the page's geolocation client
 10 initially and accessing the controller later.
 11
 12 * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
 13 (DumpRenderTreeSupportGtk::resetGeolocationClientMock):
 14 (DumpRenderTreeSupportGtk::setMockGeolocationPermission):
 15 (DumpRenderTreeSupportGtk::setMockGeolocationPosition):
 16 (DumpRenderTreeSupportGtk::setMockGeolocationError):
 17 (DumpRenderTreeSupportGtk::numberOfPendingGeolocationPermissionRequests):
 18 * WebCoreSupport/GeolocationClientGtk.cpp:
 19 (WebKit::GeolocationClient::updatePosition):
 20 (WebKit::GeolocationClient::errorOccured):
 21 * webkit/webkitwebview.cpp:
 22 (webkit_web_view_init):
 23
1242012-03-28 Nate Chapin <japhet@chromium.org>
225
326 Remove dispatchDidLoadMainResource callback, since no
112527

Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp

@@void DumpRenderTreeSupportGtk::scalePage
794794void DumpRenderTreeSupportGtk::resetGeolocationClientMock(WebKitWebView* webView)
795795{
796796#if ENABLE(GEOLOCATION)
797  GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
 797 GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
798798 mock->reset();
799799#endif
800800}

@@void DumpRenderTreeSupportGtk::resetGeol
802802void DumpRenderTreeSupportGtk::setMockGeolocationPermission(WebKitWebView* webView, bool allowed)
803803{
804804#if ENABLE(GEOLOCATION)
805  GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
 805 GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
806806 mock->setPermission(allowed);
807807#endif
808808}

@@void DumpRenderTreeSupportGtk::setMockGe
810810void DumpRenderTreeSupportGtk::setMockGeolocationPosition(WebKitWebView* webView, double latitude, double longitude, double accuracy)
811811{
812812#if ENABLE(GEOLOCATION)
813  GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
 813 GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
814814
815815 double timestamp = g_get_real_time() / 1000000.0;
816816 mock->setPosition(GeolocationPosition::create(timestamp, latitude, longitude, accuracy));

@@void DumpRenderTreeSupportGtk::setMockGe
820820void DumpRenderTreeSupportGtk::setMockGeolocationError(WebKitWebView* webView, int errorCode, const gchar* errorMessage)
821821{
822822#if ENABLE(GEOLOCATION)
823  GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
 823 GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
824824
825825 GeolocationError::ErrorCode code;
826826 switch (errorCode) {

@@void DumpRenderTreeSupportGtk::setMockGe
840840int DumpRenderTreeSupportGtk::numberOfPendingGeolocationPermissionRequests(WebKitWebView* webView)
841841{
842842#if ENABLE(GEOLOCATION)
843  GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(core(webView)->geolocationController()->client());
 843 GeolocationClientMock* mock = static_cast<GeolocationClientMock*>(GeolocationController::from(core(webView))->client());
844844 return mock->numberOfPendingPermissionRequests();
845845#endif
846846}
112427

Source/WebKit/gtk/WebCoreSupport/GeolocationClientGtk.cpp

@@void GeolocationClient::updatePosition()
175175{
176176 m_lastPosition = WebCore::GeolocationPosition::create(static_cast<double>(m_timestamp), m_latitude, m_longitude, m_accuracy,
177177 true, m_altitude, true, m_altitudeAccuracy, false, 0, false, 0);
178  core(m_webView)->geolocationController()->positionChanged(m_lastPosition.get());
 178 WebCore::GeolocationController::from(core(m_webView))->positionChanged(m_lastPosition.get());
179179}
180180
181181void GeolocationClient::errorOccured(const char* message)
182182{
183183 RefPtr<WebCore::GeolocationError> error = WebCore::GeolocationError::create(WebCore::GeolocationError::PositionUnavailable, message);
184  core(m_webView)->geolocationController()->errorOccurred(error.get());
 184 WebCore::GeolocationController::from(core(m_webView))->errorOccurred(error.get());
185185}
186186
187187}
112427

Source/WebKit/gtk/webkit/webkitwebview.cpp

5959#include "FrameLoaderClient.h"
6060#include "FrameLoaderTypes.h"
6161#include "FrameView.h"
 62#include "GOwnPtrGtk.h"
6263#include "GeolocationClientGtk.h"
6364#include "GeolocationClientMock.h"
64 #include "GOwnPtrGtk.h"
 65#include "GeolocationController.h"
6566#include "GraphicsContext.h"
6667#include "GtkUtilities.h"
6768#include "GtkVersioning.h"

@@static void webkit_web_view_init(WebKitW
35673568 pageClients.editorClient = new WebKit::EditorClient(webView);
35683569 pageClients.dragClient = new WebKit::DragClient(webView);
35693570 pageClients.inspectorClient = new WebKit::InspectorClient(webView);
3570 #if ENABLE(GEOLOCATION)
3571  if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled())
3572  pageClients.geolocationClient = new GeolocationClientMock;
3573  else
3574  pageClients.geolocationClient = new WebKit::GeolocationClient(webView);
3575 #endif
35763571
35773572 priv->corePage = new Page(pageClients);
35783573
 3574#if ENABLE(GEOLOCATION)
 3575 if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) {
 3576 GeolocationClientMock* mock = new GeolocationClientMock;
 3577 WebCore::provideGeolocationTo(priv->corePage, mock);
 3578 mock->setController(GeolocationController::from(priv->corePage));
 3579 } else
 3580 WebCore::provideGeolocationTo(priv->corePage, new WebKit::GeolocationClient(webView));
 3581#endif
35793582#if ENABLE(DEVICE_ORIENTATION)
35803583 WebCore::provideDeviceMotionTo(priv->corePage, new DeviceMotionClientGtk);
35813584 WebCore::provideDeviceOrientationTo(priv->corePage, new DeviceOrientationClientGtk);

@@static void webkit_web_view_init(WebKitW
35863589#endif
35873590
35883591 if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) {
3589 #if ENABLE(GEOLOCATION)
3590  static_cast<GeolocationClientMock*>(pageClients.geolocationClient)->setController(priv->corePage->geolocationController());
3591 #endif
35923592 // Set some testing-specific settings
35933593 priv->corePage->settings()->setInteractiveFormValidationEnabled(true);
35943594 priv->corePage->settings()->setValidationMessageTimerMagnification(-1);
112427

Source/WebKit/mac/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation is now a Supplement in Page so the interface
 9 has changed for setting up the page's geolocation client
 10 initially and accessing the controller later.
 11
 12 * WebView/WebView.mm:
 13 (-[WebView _commonInitializationWithFrameName:groupName:]):
 14 (-[WebView _geolocationDidChangePosition:]):
 15 (-[WebView _geolocationDidFailWithError:]):
 16
1172012-03-28 Nate Chapin <japhet@chromium.org>
218
319 Remove dispatchDidLoadMainResource callback, since no
112527

Source/WebKit/mac/WebView/WebView.mm

@@- (void)_commonInitializationWithFrameNa
736736 pageClients.editorClient = new WebEditorClient(self);
737737 pageClients.dragClient = new WebDragClient(self);
738738 pageClients.inspectorClient = new WebInspectorClient(self);
 739 _private->page = new Page(pageClients);
739740#if ENABLE(GEOLOCATION)
740  pageClients.geolocationClient = new WebGeolocationClient(self);
 741 WebCore::provideGeolocationTo(_private->page, new WebGeolocationClient(self));
741742#endif
742  _private->page = new Page(pageClients);
743743#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
744744 WebCore::provideNotification(_private->page, new WebNotificationClient(self));
745745#endif

@@- (void)_geolocationDidChangePosition:(W
63826382{
63836383#if ENABLE(GEOLOCATION)
63846384 if (_private && _private->page)
6385  _private->page->geolocationController()->positionChanged(core(position));
 6385 WebCore::GeolocationController::from(_private->page)->positionChanged(core(position));
63866386#endif // ENABLE(GEOLOCATION)
63876387}
63886388

@@- (void)_geolocationDidFailWithError:(NS
63916391#if ENABLE(GEOLOCATION)
63926392 if (_private && _private->page) {
63936393 RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, [error localizedDescription]);
6394  _private->page->geolocationController()->errorOccurred(geolocatioError.get());
 6394 WebCore::GeolocationController::from(_private->page)->errorOccurred(geolocatioError.get());
63956395 }
63966396#endif // ENABLE(GEOLOCATION)
63976397}
112427

Source/WebKit/qt/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation is now a Supplement in Page so the interface
 9 has changed for setting up the page's geolocation client
 10 initially and accessing the controller later.
 11
 12 * Api/qwebpage.cpp:
 13 (QWebPagePrivate::QWebPagePrivate):
 14 * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
 15 (DumpRenderTreeSupportQt::resetGeolocationMock):
 16 (DumpRenderTreeSupportQt::setMockGeolocationPermission):
 17 (DumpRenderTreeSupportQt::setMockGeolocationPosition):
 18 (DumpRenderTreeSupportQt::setMockGeolocationError):
 19 (DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests):
 20 * WebCoreSupport/GeolocationClientQt.cpp:
 21 (WebCore::GeolocationClientQt::positionUpdated):
 22 (WebCore::GeolocationClientQt::startUpdating):
 23
1242012-03-28 Nate Chapin <japhet@chromium.org>
225
326 Remove dispatchDidLoadMainResource callback, since no
112527

Source/WebKit/qt/Api/qwebpage.cpp

6767#if ENABLE(GEOLOCATION)
6868#include "GeolocationClientMock.h"
6969#include "GeolocationClientQt.h"
 70#include "GeolocationController.h"
7071#endif
7172#include "GeolocationPermissionClientQt.h"
7273#include "HTMLFormElement.h"

@@QWebPagePrivate::QWebPagePrivate(QWebPag
326327 pageClients.editorClient = new EditorClientQt(q);
327328 pageClients.dragClient = new DragClientQt(q);
328329 pageClients.inspectorClient = new InspectorClientQt(q);
 330 page = new Page(pageClients);
329331#if ENABLE(GEOLOCATION)
330  if (useMock)
331  pageClients.geolocationClient = new GeolocationClientMock;
332  else
333  pageClients.geolocationClient = new GeolocationClientQt(q);
 332 if (useMock) {
 333 // In case running in DumpRenderTree mode set the controller to mock provider.
 334 GeolocationClientMock* mock = new GeolocationClientMock;
 335 WebCore::provideGeolocationTo(page, mock);
 336 mock->setController(WebCore::GeolocationController::from(page));
 337 } else
 338 WebCore::provideGeolocationTo(page, new GeolocationClientQt(q));
334339#endif
335  page = new Page(pageClients);
336340#if ENABLE(DEVICE_ORIENTATION)
337341 if (useMock)
338342 WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientMock);

@@QWebPagePrivate::QWebPagePrivate(QWebPag
351355 // as expected out of the box, we use a default group similar to what other ports are doing.
352356 page->setGroupName("Default Group");
353357
354  // In case running in DumpRenderTree mode set the controller to mock provider.
355 #if ENABLE(GEOLOCATION)
356  if (QWebPagePrivate::drtRun)
357  static_cast<GeolocationClientMock*>(pageClients.geolocationClient)->setController(page->geolocationController());
358 #endif
359358 settings = new QWebSettings(page->settings());
360359
361360#if ENABLE(WEB_SOCKETS)
112427

Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

@@void DumpRenderTreeSupportQt::resetGeolo
840840{
841841#if ENABLE(GEOLOCATION)
842842 Page* corePage = QWebPagePrivate::core(page);
843  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
 843 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
844844 mockClient->reset();
845845#endif
846846}

@@void DumpRenderTreeSupportQt::setMockGeo
849849{
850850#if ENABLE(GEOLOCATION)
851851 Page* corePage = QWebPagePrivate::core(page);
852  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
 852 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
853853 mockClient->setPermission(allowed);
854854#endif
855855}

@@void DumpRenderTreeSupportQt::setMockGeo
858858{
859859#if ENABLE(GEOLOCATION)
860860 Page* corePage = QWebPagePrivate::core(page);
861  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
 861 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
862862 mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
863863#endif
864864}

@@void DumpRenderTreeSupportQt::setMockGeo
878878 break;
879879 }
880880
881  GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(corePage->geolocationController()->client());
 881 GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage)->client());
882882 mockClient->setError(GeolocationError::create(code, message));
883883#endif
884884}

@@int DumpRenderTreeSupportQt::numberOfPen
887887{
888888#if ENABLE(GEOLOCATION)
889889 Page* corePage = QWebPagePrivate::core(page);
890  GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
 890 GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
891891 return mockClient->numberOfPendingPermissionRequests();
892892#else
893893 return -1;
112427

Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp

@@void GeolocationClientQt::positionUpdate
9494 providesHeading, heading, providesSpeed, speed);
9595
9696 WebCore::Page* page = QWebPagePrivate::core(m_page);
97  page->geolocationController()->positionChanged(m_lastPosition.get());
 97 GeolocationController::from(page)->positionChanged(m_lastPosition.get());
9898}
9999
100100void GeolocationClientQt::startUpdating()

@@void GeolocationClientQt::startUpdating(
105105 if (!m_location) {
106106 WebCore::Page* page = QWebPagePrivate::core(m_page);
107107 RefPtr<WebCore::GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, failedToStartServiceErrorMessage);
108  page->geolocationController()->errorOccurred(error.get());
 108 GeolocationController::from(page)->errorOccurred(error.get());
109109 return;
110110 }
111111
112427

Source/WebKit/win/ChangeLog

 12012-03-29 Mark Pilgrim <pilgrim@chromium.org>
 2
 3 GEOLOCATION should be implemented as Page Supplement
 4 https://bugs.webkit.org/show_bug.cgi?id=82228
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Geolocation is now a Supplement in Page so the interface
 9 has changed for setting up the page's geolocation client
 10 initially and accessing the controller later.
 11
 12 * WebView.cpp:
 13 (WebView::initWithFrame):
 14 (WebView::geolocationDidChangePosition):
 15 (WebView::geolocationDidFailWithError):
 16
1172012-03-28 Nate Chapin <japhet@chromium.org>
218
319 Remove dispatchDidLoadMainResource callback, since no
112527

Source/WebKit/win/WebView.cpp

@@HRESULT STDMETHODCALLTYPE WebView::initW
26662666 pageClients.editorClient = new WebEditorClient(this);
26672667 pageClients.dragClient = new WebDragClient(this);
26682668 pageClients.inspectorClient = m_inspectorClient;
2669  pageClients.geolocationClient = new WebGeolocationClient(this);
26702669 m_page = new Page(pageClients);
 2670 provideGeolocationTo(m_page, new WebGeolocationClient(this));
26712671
26722672 BSTR localStoragePath;
26732673 if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) {

@@HRESULT WebView::geolocationDidChangePos
65666566{
65676567 if (!m_page)
65686568 return E_FAIL;
6569  m_page->geolocationController()->positionChanged(core(position));
 6569 GeolocationController::from(m_page)->positionChanged(core(position));
65706570 return S_OK;
65716571}
65726572

@@HRESULT WebView::geolocationDidFailWithE
65846584 SysFreeString(descriptionBSTR);
65856585
65866586 RefPtr<GeolocationError> geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, descriptionString);
6587  m_page->geolocationController()->errorOccurred(geolocationError.get());
 6587 GeolocationController::from(m_page)->errorOccurred(geolocationError.get());
65886588 return S_OK;
65896589}
65906590
112427