Changeset 218165 in webkit
- Timestamp:
- Jun 12, 2017 11:59:23 PM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r218164 r218165 1 2017-06-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Add API::GeolocationProvider 4 https://bugs.webkit.org/show_bug.cgi?id=173150 5 6 Reviewed by Alex Christensen. 7 8 It will be used by GTK+ port instead of the C API. 9 10 * UIProcess/API/APIGeolocationProvider.h: Added. 11 (API::GeolocationProvider::~GeolocationProvider): 12 (API::GeolocationProvider::startUpdating): 13 (API::GeolocationProvider::stopUpdating): 14 (API::GeolocationProvider::setEnableHighAccuracy): 15 * UIProcess/API/C/WKGeolocationManager.cpp: 16 (WKGeolocationManagerSetProvider): 17 * UIProcess/WebGeolocationManagerProxy.cpp: 18 (WebKit::WebGeolocationManagerProxy::WebGeolocationManagerProxy): 19 (WebKit::WebGeolocationManagerProxy::setProvider): 20 (WebKit::WebGeolocationManagerProxy::processPoolDestroyed): 21 (WebKit::WebGeolocationManagerProxy::startUpdating): 22 (WebKit::WebGeolocationManagerProxy::removeRequester): 23 (WebKit::WebGeolocationManagerProxy::setEnableHighAccuracy): 24 * UIProcess/WebGeolocationManagerProxy.h: 25 * UIProcess/WebGeolocationProvider.cpp: 26 (WebKit::WebGeolocationProvider::WebGeolocationProvider): 27 (WebKit::WebGeolocationProvider::startUpdating): 28 (WebKit::WebGeolocationProvider::stopUpdating): 29 (WebKit::WebGeolocationProvider::setEnableHighAccuracy): 30 * UIProcess/WebGeolocationProvider.h: 31 * WebKit2.xcodeproj/project.pbxproj: 32 1 33 2017-06-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 34 -
trunk/Source/WebKit2/UIProcess/API/APIGeolocationProvider.h
r218164 r218165 1 1 /* 2 * Copyright (C) 201 1, 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2017 Igalia S.L. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef WebGeolocationProvider_h 27 #define WebGeolocationProvider_h 26 #pragma once 28 27 29 #include "APIClient.h"30 #include "WKGeolocationManager.h"31 28 #include <wtf/Forward.h> 32 29 33 namespace API { 34 template<> struct ClientTraits<WKGeolocationProviderBase> { 35 typedef std::tuple<WKGeolocationProviderV0, WKGeolocationProviderV1> Versions; 36 }; 30 namespace WebKit { 31 class WebGeolocationManagerProxy; 37 32 } 38 33 39 namespace WebKit{34 namespace API { 40 35 41 class WebGeolocationManagerProxy; 36 class GeolocationProvider { 37 public: 38 virtual ~GeolocationProvider() { } 42 39 43 class WebGeolocationProvider : public API::Client<WKGeolocationProviderBase> { 44 public: 45 void startUpdating(WebGeolocationManagerProxy*); 46 void stopUpdating(WebGeolocationManagerProxy*); 47 void setEnableHighAccuracy(WebGeolocationManagerProxy*, bool); 40 virtual void startUpdating(WebKit::WebGeolocationManagerProxy&) { }; 41 virtual void stopUpdating(WebKit::WebGeolocationManagerProxy&) { }; 42 virtual void setEnableHighAccuracy(WebKit::WebGeolocationManagerProxy&, bool) { }; 48 43 }; 49 44 50 } // namespace WebKit 51 52 #endif // WebGeolocationProvider_h 45 } // namespace API -
trunk/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp
r176829 r218165 30 30 #include "WebGeolocationManagerProxy.h" 31 31 #include "WebGeolocationPosition.h" 32 #include "WebGeolocationProvider.h" 32 33 33 34 using namespace WebKit; … … 40 41 void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManagerRef, const WKGeolocationProviderBase* wkProvider) 41 42 { 42 toImpl(geolocationManagerRef)-> initializeProvider(wkProvider);43 toImpl(geolocationManagerRef)->setProvider(std::make_unique<WebGeolocationProvider>(wkProvider)); 43 44 } 44 45 -
trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp
r216473 r218165 27 27 #include "WebGeolocationManagerProxy.h" 28 28 29 #include "APIGeolocationProvider.h" 29 30 #include "WebGeolocationManagerMessages.h" 30 31 #include "WebGeolocationManagerProxyMessages.h" … … 45 46 WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebProcessPool* processPool) 46 47 : WebContextSupplement(processPool) 48 , m_provider(std::make_unique<API::GeolocationProvider>()) 47 49 { 48 50 WebContextSupplement::processPool()->addMessageReceiver(Messages::WebGeolocationManagerProxy::messageReceiverName(), *this); 49 51 } 50 52 51 void WebGeolocationManagerProxy:: initializeProvider(const WKGeolocationProviderBase*provider)53 void WebGeolocationManagerProxy::setProvider(std::unique_ptr<API::GeolocationProvider> provider) 52 54 { 53 m_provider.initialize(provider); 55 if (!provider) 56 m_provider = std::make_unique<API::GeolocationProvider>(); 57 else 58 m_provider = WTFMove(provider); 54 59 } 55 60 … … 63 68 ASSERT(!isUpdating()); 64 69 if (wasUpdating) 65 m_provider .stopUpdating(this);70 m_provider->stopUpdating(*this); 66 71 } 67 72 … … 109 114 m_updateRequesters.add(&connection.client()); 110 115 if (!wasUpdating) { 111 m_provider .setEnableHighAccuracy(this, isHighAccuracyEnabled());112 m_provider .startUpdating(this);116 m_provider->setEnableHighAccuracy(*this, isHighAccuracyEnabled()); 117 m_provider->startUpdating(*this); 113 118 } 114 119 } … … 128 133 129 134 if (wasUpdating && !isUpdating()) 130 m_provider .stopUpdating(this);135 m_provider->stopUpdating(*this); 131 136 else { 132 137 bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled(); 133 138 if (highAccuracyShouldBeEnabled != highAccuracyWasEnabled) 134 m_provider .setEnableHighAccuracy(this, highAccuracyShouldBeEnabled);139 m_provider->setEnableHighAccuracy(*this, highAccuracyShouldBeEnabled); 135 140 } 136 141 } … … 147 152 bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled(); 148 153 if (isUpdating() && highAccuracyWasEnabled != highAccuracyShouldBeEnabled) 149 m_provider .setEnableHighAccuracy(this, highAccuracyShouldBeEnabled);154 m_provider->setEnableHighAccuracy(*this, highAccuracyShouldBeEnabled); 150 155 } 151 156 -
trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h
r216473 r218165 30 30 #include "MessageReceiver.h" 31 31 #include "WebContextSupplement.h" 32 #include "WebGeolocationProvider.h"33 32 #include <wtf/HashSet.h> 34 33 #include <wtf/text/WTFString.h> 34 35 namespace API { 36 class GeolocationProvider; 37 } 35 38 36 39 namespace WebKit { … … 45 48 static Ref<WebGeolocationManagerProxy> create(WebProcessPool*); 46 49 47 void initializeProvider(const WKGeolocationProviderBase*);50 void setProvider(std::unique_ptr<API::GeolocationProvider>); 48 51 49 52 void providerDidChangePosition(WebGeolocationPosition*); … … 79 82 HashSet<const IPC::Connection::Client*> m_highAccuracyRequesters; 80 83 81 WebGeolocationProviderm_provider;84 std::unique_ptr<API::GeolocationProvider> m_provider; 82 85 }; 83 86 -
trunk/Source/WebKit2/UIProcess/WebGeolocationProvider.cpp
r159988 r218165 32 32 namespace WebKit { 33 33 34 void WebGeolocationProvider::startUpdating(WebGeolocationManagerProxy* geolocationManager) 34 WebGeolocationProvider::WebGeolocationProvider(const WKGeolocationProviderBase* provider) 35 { 36 initialize(provider); 37 } 38 39 void WebGeolocationProvider::startUpdating(WebGeolocationManagerProxy& geolocationManager) 35 40 { 36 41 if (!m_client.startUpdating) 37 42 return; 38 43 39 m_client.startUpdating(toAPI( geolocationManager), m_client.base.clientInfo);44 m_client.startUpdating(toAPI(&geolocationManager), m_client.base.clientInfo); 40 45 } 41 46 42 void WebGeolocationProvider::stopUpdating(WebGeolocationManagerProxy *geolocationManager)47 void WebGeolocationProvider::stopUpdating(WebGeolocationManagerProxy& geolocationManager) 43 48 { 44 49 if (!m_client.stopUpdating) 45 50 return; 46 51 47 m_client.stopUpdating(toAPI( geolocationManager), m_client.base.clientInfo);52 m_client.stopUpdating(toAPI(&geolocationManager), m_client.base.clientInfo); 48 53 } 49 54 50 void WebGeolocationProvider::setEnableHighAccuracy(WebGeolocationManagerProxy *geolocationManager, bool enabled)55 void WebGeolocationProvider::setEnableHighAccuracy(WebGeolocationManagerProxy& geolocationManager, bool enabled) 51 56 { 52 57 if (!m_client.setEnableHighAccuracy) 53 58 return; 54 59 55 m_client.setEnableHighAccuracy(toAPI( geolocationManager), enabled, m_client.base.clientInfo);60 m_client.setEnableHighAccuracy(toAPI(&geolocationManager), enabled, m_client.base.clientInfo); 56 61 } 57 62 -
trunk/Source/WebKit2/UIProcess/WebGeolocationProvider.h
r159994 r218165 28 28 29 29 #include "APIClient.h" 30 #include "APIGeolocationProvider.h" 30 31 #include "WKGeolocationManager.h" 31 32 #include <wtf/Forward.h> … … 41 42 class WebGeolocationManagerProxy; 42 43 43 class WebGeolocationProvider : public API:: Client<WKGeolocationProviderBase> {44 class WebGeolocationProvider : public API::GeolocationProvider, API::Client<WKGeolocationProviderBase> { 44 45 public: 45 void startUpdating(WebGeolocationManagerProxy*); 46 void stopUpdating(WebGeolocationManagerProxy*); 47 void setEnableHighAccuracy(WebGeolocationManagerProxy*, bool); 46 explicit WebGeolocationProvider(const WKGeolocationProviderBase*); 47 48 void startUpdating(WebGeolocationManagerProxy&) override; 49 void stopUpdating(WebGeolocationManagerProxy&) override; 50 void setEnableHighAccuracy(WebGeolocationManagerProxy&, bool) override; 48 51 }; 49 52 -
trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm
r216794 r218165 34 34 #import "GeolocationPermissionRequestProxy.h" 35 35 #import "WKFrameInfoInternal.h" 36 #import "WKGeolocationManager.h" 36 37 #import "WKProcessPoolInternal.h" 37 38 #import "WKUIDelegatePrivate.h" … … 162 163 setEnableHighAccuracy 163 164 }; 164 _geolocationManager->initializeProvider(reinterpret_cast<WKGeolocationProviderBase*>(&providerCallback));165 WKGeolocationManagerSetProvider(toAPI(_geolocationManager.get()), &providerCallback.base); 165 166 _coreLocationProvider = wrapper(processPool)._coreLocationProvider ?: adoptNS(static_cast<id <_WKGeolocationCoreLocationProvider>>([[WKLegacyCoreLocationProvider alloc] init])); 166 167 [_coreLocationProvider setListener:self]; -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r218164 r218165 1219 1219 7AAD175F1EA6AF99003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7AAD175E1EA6AF37003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm */; }; 1220 1220 7AB6EA451EEAAE3800037B2B /* APIIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */; }; 1221 7AB6EA471EEAB6B800037B2B /* APIGeolocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB6EA461EEAB6B000037B2B /* APIGeolocationProvider.h */; }; 1221 1222 7AF236201E79A3E400438A05 /* WebErrors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF2361E1E79A3B400438A05 /* WebErrors.cpp */; }; 1222 1223 7AF236211E79A40800438A05 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF2361F1E79A3D800438A05 /* WebErrors.h */; }; … … 3507 3508 7AAD175E1EA6AF37003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebResourceLoadStatisticsStoreCocoa.mm; sourceTree = "<group>"; }; 3508 3509 7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIIconDatabaseClient.h; sourceTree = "<group>"; }; 3510 7AB6EA461EEAB6B000037B2B /* APIGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIGeolocationProvider.h; sourceTree = "<group>"; }; 3509 3511 7AF2361E1E79A3B400438A05 /* WebErrors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebErrors.cpp; sourceTree = "<group>"; }; 3510 3512 7AF2361F1E79A3D800438A05 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; }; … … 6884 6886 2DF9EEE41A781FB400B6CFBE /* APIFrameInfo.h */, 6885 6887 CD78E1161DB7DC0A0014A2DE /* APIFullscreenClient.h */, 6888 7AB6EA461EEAB6B000037B2B /* APIGeolocationProvider.h */, 6886 6889 2DABA7751A82B42100EF0F1A /* APIHistoryClient.h */, 6887 6890 93A88B421BC8828C00ABA5C2 /* APIHitTestResult.cpp */, … … 9052 9055 5272D4C91E735F0900EB4290 /* WKProtectionSpaceNS.h in Headers */, 9053 9056 518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */, 9057 7AB6EA471EEAB6B800037B2B /* APIGeolocationProvider.h in Headers */, 9054 9058 1AD01BCD1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.h in Headers */, 9055 9059 1A9E329B1822E1CC00F5D04C /* WKRemoteObject.h in Headers */,
Note: See TracChangeset
for help on using the changeset viewer.