[WK2] Add a WebKit2 API for Geolocation's highAccuracy
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Nov 2013 21:17:07 +0000 (21:17 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Nov 2013 21:17:07 +0000 (21:17 +0000)
commit864a54675a0089235fa3c241d539ea405364d730
tree87ac0b3f89a3817c5cbbcd37c0a336b2ab9abac4
parent276a0be912e0ef28c51b84eb8908151dded68fc1
[WK2] Add a WebKit2 API for Geolocation's highAccuracy
https://bugs.webkit.org/show_bug.cgi?id=123786

Reviewed by Darin Adler.

Source/WebKit2:

This adds support for highAccuracy Geolocation with WebKit2.

The key is to track which page/requester need what kind of geolocation
in order to change between high and low accuracy as pages run and disappear.

WebGeolocationManager and WebGeolocationManagerProxy have very similar roles
but for different sources:
-WebGeolocationManager tracks which live page require high accuracy geolocation.
 When the state changes, it forward the information to the UIProcess.
-WebGeolocationManagerProxy tracks which WebContent processes needs high accuracy.

* Shared/APIClientTraits.cpp:
* Shared/APIClientTraits.h:
* UIProcess/API/C/WKGeolocationManager.h:
* UIProcess/WebGeolocationManagerProxy.cpp:
(WebKit::WebGeolocationManagerProxy::startUpdating):
(WebKit::WebGeolocationManagerProxy::removeRequester):
(WebKit::WebGeolocationManagerProxy::setEnableHighAccuracy):
* UIProcess/WebGeolocationManagerProxy.h:
(WebKit::WebGeolocationManagerProxy::isUpdating):
(WebKit::WebGeolocationManagerProxy::isHighAccuracyEnabled):
* UIProcess/WebGeolocationManagerProxy.messages.in:
* UIProcess/WebGeolocationProvider.cpp:
(WebKit::WebGeolocationProvider::setEnableHighAccuracy):
* UIProcess/WebGeolocationProvider.h:
* WebProcess/Geolocation/WebGeolocationManager.cpp:
(WebKit::WebGeolocationManager::registerWebPage):
(WebKit::WebGeolocationManager::unregisterWebPage):
(WebKit::WebGeolocationManager::setEnableHighAccuracyForPage):
* WebProcess/Geolocation/WebGeolocationManager.h:
(WebKit::WebGeolocationManager::isUpdating):
(WebKit::WebGeolocationManager::isHighAccuracyEnabled):
* WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
(WebKit::WebGeolocationClient::setEnableHighAccuracy):

Tools:

Add basic testing for the Geolocation API (start, stop and change accuracy).

* TestWebKitAPI/GNUmakefile.am:
* TestWebKitAPI/PlatformEfl.cmake:
* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/Geolocation.cpp: Added.
(TestWebKitAPI::operator<<):
(TestWebKitAPI::GeolocationStateTracker::~GeolocationStateTracker):
(TestWebKitAPI::GeolocationStateTracker::eventsChanged):
(TestWebKitAPI::GeolocationStateTracker::startUpdatingCallback):
(TestWebKitAPI::GeolocationStateTracker::stopUpdatingCallback):
(TestWebKitAPI::GeolocationStateTracker::setEnableHighAccuracyCallback):
(TestWebKitAPI::decidePolicyForGeolocationPermissionRequestCallBack):
(TestWebKitAPI::setupGeolocationProvider):
(TestWebKitAPI::setupView):
(TestWebKitAPI::GeolocationBasicStateTracker::GeolocationBasicStateTracker):
(TestWebKitAPI::GeolocationBasicStateTracker::eventsChanged):
(TestWebKitAPI::GeolocationBasicWithHighAccuracyStateTracker::GeolocationBasicWithHighAccuracyStateTracker):
(TestWebKitAPI::GeolocationBasicWithHighAccuracyStateTracker::eventsChanged):
(TestWebKitAPI::GeolocationTransitionToHighAccuracyStateTracker::GeolocationTransitionToHighAccuracyStateTracker):
(TestWebKitAPI::GeolocationTransitionToHighAccuracyStateTracker::eventsChanged):
(TestWebKitAPI::GeolocationTransitionToLowAccuracyStateTracker::GeolocationTransitionToLowAccuracyStateTracker):
(TestWebKitAPI::GeolocationTransitionToLowAccuracyStateTracker::eventsChanged):
(TestWebKitAPI::didFinishLoadForFrame):
* TestWebKitAPI/Tests/WebKit2/geolocationGetCurrentPosition.html: Added.
* TestWebKitAPI/Tests/WebKit2/geolocationGetCurrentPositionWithHighAccuracy.html: Added.
* TestWebKitAPI/Tests/WebKit2/geolocationWatchPosition.html: Added.
* TestWebKitAPI/Tests/WebKit2/geolocationWatchPositionWithHighAccuracy.html: Added.
* WebKitTestRunner/GeolocationProviderMock.cpp:
(WTR::GeolocationProviderMock::GeolocationProviderMock):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/APIClientTraits.cpp
Source/WebKit2/Shared/APIClientTraits.h
Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h
Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp
Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h
Source/WebKit2/UIProcess/WebGeolocationManagerProxy.messages.in
Source/WebKit2/UIProcess/WebGeolocationProvider.cpp
Source/WebKit2/UIProcess/WebGeolocationProvider.h
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h
Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/GNUmakefile.am
Tools/TestWebKitAPI/PlatformEfl.cmake
Tools/TestWebKitAPI/PlatformGTK.cmake
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/Geolocation.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/geolocationGetCurrentPosition.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/geolocationGetCurrentPositionWithHighAccuracy.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/geolocationWatchPosition.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/geolocationWatchPositionWithHighAccuracy.html [new file with mode: 0644]
Tools/WebKitTestRunner/GeolocationProviderMock.cpp