Changeset 221743 in webkit
- Timestamp:
- Sep 7, 2017 12:01:45 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r221742 r221743 1 2017-09-07 Alex Christensen <achristensen@webkit.org> 2 3 Modernize Geolocation code 4 https://bugs.webkit.org/show_bug.cgi?id=176496 5 6 Reviewed by Andy Estes. 7 8 No change in behavior. Just more references instead of pointers. 9 10 * Modules/geolocation/Geolocation.cpp: 11 (WebCore::createPositionError): 12 (WebCore::Geolocation::resetAllGeolocationPermission): 13 (WebCore::Geolocation::stop): 14 (WebCore::Geolocation::requestPermission): 15 (WebCore::Geolocation::setError): 16 (WebCore::Geolocation::startUpdating): 17 (WebCore::Geolocation::stopUpdating): 18 * Modules/geolocation/Geolocation.h: 19 * Modules/geolocation/GeolocationClient.h: 20 * Modules/geolocation/GeolocationController.cpp: 21 (WebCore::GeolocationController::addObserver): 22 (WebCore::GeolocationController::removeObserver): 23 (WebCore::GeolocationController::requestPermission): 24 (WebCore::GeolocationController::cancelPermissionRequest): 25 (WebCore::GeolocationController::positionChanged): 26 (WebCore::GeolocationController::errorOccurred): 27 (WebCore::GeolocationController::activityStateDidChange): 28 (WebCore::provideGeolocationTo): 29 * Modules/geolocation/GeolocationController.h: 30 1 31 2017-09-07 Adrian Perez de Castro <aperez@igalia.com> 2 32 -
trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp
r217134 r221743 66 66 } 67 67 68 static Ref<PositionError> createPositionError(GeolocationError *error)68 static Ref<PositionError> createPositionError(GeolocationError& error) 69 69 { 70 70 PositionError::ErrorCode code = PositionError::POSITION_UNAVAILABLE; 71 switch (error ->code()) {71 switch (error.code()) { 72 72 case GeolocationError::PermissionDenied: 73 73 code = PositionError::PERMISSION_DENIED; … … 78 78 } 79 79 80 return PositionError::create(code, error ->message());80 return PositionError::create(code, error.message()); 81 81 } 82 82 … … 248 248 Page* page = this->page(); 249 249 if (page) 250 GeolocationController::from(page)->cancelPermissionRequest( this);250 GeolocationController::from(page)->cancelPermissionRequest(*this); 251 251 252 252 // This return is not technically correct as GeolocationController::cancelPermissionRequest() should have cleared the active request. … … 278 278 Page* page = this->page(); 279 279 if (page && m_allowGeolocation == InProgress) 280 GeolocationController::from(page)->cancelPermissionRequest( this);280 GeolocationController::from(page)->cancelPermissionRequest(*this); 281 281 // The frame may be moving to a new page and we want to get the permissions from the new page's client. 282 282 m_allowGeolocation = Unknown; … … 647 647 648 648 // Ask the embedder: it maintains the geolocation challenge policy itself. 649 GeolocationController::from(page)->requestPermission( this);649 GeolocationController::from(page)->requestPermission(*this); 650 650 } 651 651 … … 691 691 } 692 692 693 void Geolocation::setError(GeolocationError *error)693 void Geolocation::setError(GeolocationError& error) 694 694 { 695 695 if (m_isSuspended) { … … 708 708 return false; 709 709 710 GeolocationController::from(page)->addObserver( this, notifier->options().enableHighAccuracy);710 GeolocationController::from(page)->addObserver(*this, notifier->options().enableHighAccuracy); 711 711 return true; 712 712 } … … 718 718 return; 719 719 720 GeolocationController::from(page)->removeObserver( this);720 GeolocationController::from(page)->removeObserver(*this); 721 721 } 722 722 -
trunk/Source/WebCore/Modules/geolocation/Geolocation.h
r217134 r221743 70 70 71 71 void positionChanged(); 72 void setError(GeolocationError *);72 void setError(GeolocationError&); 73 73 bool shouldBlockGeolocationRequests(); 74 74 -
trunk/Source/WebCore/Modules/geolocation/GeolocationClient.h
r208646 r221743 45 45 virtual GeolocationPosition* lastPosition() = 0; 46 46 47 virtual void requestPermission(Geolocation *) = 0;48 virtual void cancelPermissionRequest(Geolocation *) = 0;47 virtual void requestPermission(Geolocation&) = 0; 48 virtual void cancelPermissionRequest(Geolocation&) = 0; 49 49 50 void provideGeolocationTo(Page*, GeolocationClient *);50 void provideGeolocationTo(Page*, GeolocationClient&); 51 51 52 52 protected: … … 54 54 }; 55 55 56 WEBCORE_EXPORT void provideGeolocationTo(Page*, GeolocationClient *);56 WEBCORE_EXPORT void provideGeolocationTo(Page*, GeolocationClient&); 57 57 58 58 } // namespace WebCore -
trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp
r208225 r221743 53 53 } 54 54 55 void GeolocationController::addObserver(Geolocation *observer, bool enableHighAccuracy)55 void GeolocationController::addObserver(Geolocation& observer, bool enableHighAccuracy) 56 56 { 57 57 // This may be called multiple times with the same observer, though removeObserver() … … 68 68 } 69 69 70 void GeolocationController::removeObserver(Geolocation *observer)70 void GeolocationController::removeObserver(Geolocation& observer) 71 71 { 72 72 if (!m_observers.contains(observer)) … … 82 82 } 83 83 84 void GeolocationController::requestPermission(Geolocation *geolocation)84 void GeolocationController::requestPermission(Geolocation& geolocation) 85 85 { 86 86 if (!m_page.isVisible()) { 87 m_pend edPermissionRequest.add(geolocation);87 m_pendingPermissionRequest.add(geolocation); 88 88 return; 89 89 } … … 92 92 } 93 93 94 void GeolocationController::cancelPermissionRequest(Geolocation *geolocation)94 void GeolocationController::cancelPermissionRequest(Geolocation& geolocation) 95 95 { 96 if (m_pend edPermissionRequest.remove(geolocation))96 if (m_pendingPermissionRequest.remove(geolocation)) 97 97 return; 98 98 … … 103 103 { 104 104 m_lastPosition = position; 105 Vector<RefPtr<Geolocation>> observersVector; 106 copyToVector(m_observers, observersVector); 105 Vector<Ref<Geolocation>> observersVector; 106 observersVector.reserveInitialCapacity(m_observers.size()); 107 for (auto& observer : m_observers) 108 observersVector.uncheckedAppend(observer.copyRef()); 107 109 for (auto& observer : observersVector) 108 110 observer->positionChanged(); 109 111 } 110 112 111 void GeolocationController::errorOccurred(GeolocationError *error)113 void GeolocationController::errorOccurred(GeolocationError& error) 112 114 { 113 Vector<RefPtr<Geolocation>> observersVector; 114 copyToVector(m_observers, observersVector); 115 Vector<Ref<Geolocation>> observersVector; 116 observersVector.reserveInitialCapacity(m_observers.size()); 117 for (auto& observer : m_observers) 118 observersVector.uncheckedAppend(observer.copyRef()); 115 119 for (auto& observer : observersVector) 116 120 observer->setError(error); … … 139 143 return; 140 144 141 HashSet<RefPtr<Geolocation>> pendedPermissionRequests = WTFMove(m_pendedPermissionRequest);145 auto pendedPermissionRequests = WTFMove(m_pendingPermissionRequest); 142 146 for (auto& permissionRequest : pendedPermissionRequests) 143 147 m_client.requestPermission(permissionRequest.get()); … … 149 153 } 150 154 151 void provideGeolocationTo(Page* page, GeolocationClient *client)155 void provideGeolocationTo(Page* page, GeolocationClient& client) 152 156 { 153 157 ASSERT(page); 154 ASSERT(client); 155 Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(*page, *client)); 158 Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(*page, client)); 156 159 } 157 160 -
trunk/Source/WebCore/Modules/geolocation/GeolocationController.h
r208646 r221743 48 48 ~GeolocationController(); 49 49 50 void addObserver(Geolocation *, bool enableHighAccuracy);51 void removeObserver(Geolocation *);50 void addObserver(Geolocation&, bool enableHighAccuracy); 51 void removeObserver(Geolocation&); 52 52 53 void requestPermission(Geolocation *);54 void cancelPermissionRequest(Geolocation *);53 void requestPermission(Geolocation&); 54 void cancelPermissionRequest(Geolocation&); 55 55 56 56 WEBCORE_EXPORT void positionChanged(GeolocationPosition*); 57 WEBCORE_EXPORT void errorOccurred(GeolocationError *);57 WEBCORE_EXPORT void errorOccurred(GeolocationError&); 58 58 59 59 GeolocationPosition* lastPosition(); … … 72 72 RefPtr<GeolocationPosition> m_lastPosition; 73 73 74 typedef HashSet<Ref Ptr<Geolocation>> ObserversSet;74 typedef HashSet<Ref<Geolocation>> ObserversSet; 75 75 // All observers; both those requesting high accuracy and those not. 76 76 ObserversSet m_observers; … … 78 78 79 79 // While the page is not visible, we pend permission requests. 80 HashSet<Ref Ptr<Geolocation>> m_pendedPermissionRequest;80 HashSet<Ref<Geolocation>> m_pendingPermissionRequest; 81 81 }; 82 82 -
trunk/Source/WebCore/platform/mock/GeolocationClientMock.cpp
r216724 r221743 88 88 } 89 89 90 void GeolocationClientMock::requestPermission(Geolocation *geolocation)90 void GeolocationClientMock::requestPermission(Geolocation& geolocation) 91 91 { 92 m_pendingPermission.add( geolocation);92 m_pendingPermission.add(&geolocation); 93 93 if (m_permissionState != PermissionStateUnset) 94 94 asyncUpdatePermission(); 95 95 } 96 96 97 void GeolocationClientMock::cancelPermissionRequest(Geolocation *geolocation)97 void GeolocationClientMock::cancelPermissionRequest(Geolocation& geolocation) 98 98 { 99 99 // Called from Geolocation::disconnectFrame() in response to Frame destruction. 100 m_pendingPermission.remove( geolocation);100 m_pendingPermission.remove(&geolocation); 101 101 if (m_pendingPermission.isEmpty() && m_permissionTimer.isActive()) 102 102 m_permissionTimer.stop(); … … 177 177 m_controller->positionChanged(m_lastPosition.get()); 178 178 } else if (m_hasError) { 179 RefPtr<GeolocationError>geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage);179 auto geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage); 180 180 m_controller->errorOccurred(geolocatioError.get()); 181 181 } -
trunk/Source/WebCore/platform/mock/GeolocationClientMock.h
r216724 r221743 30 30 */ 31 31 32 #ifndef GeolocationClientMock_h 33 #define GeolocationClientMock_h 32 #pragma once 34 33 35 34 #include "GeolocationClient.h" … … 65 64 void setEnableHighAccuracy(bool) override; 66 65 GeolocationPosition* lastPosition() override; 67 void requestPermission(Geolocation *) override;68 void cancelPermissionRequest(Geolocation *) override;66 void requestPermission(Geolocation&) override; 67 void cancelPermissionRequest(Geolocation&) override; 69 68 70 69 private: … … 95 94 96 95 } 97 98 #endif -
trunk/Source/WebKit/ChangeLog
r221714 r221743 1 2017-09-07 Alex Christensen <achristensen@webkit.org> 2 3 Modernize Geolocation code 4 https://bugs.webkit.org/show_bug.cgi?id=176496 5 6 Reviewed by Andy Estes. 7 8 Making the GeolocationPermissionRequestManager take a reference instead of a pointer 9 spilled into making the other supplement constructors do the same. 10 11 * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp: 12 (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager): 13 (WebKit::LegacyCustomProtocolManager::startLoading): 14 (WebKit::LegacyCustomProtocolManager::stopLoading): 15 * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: 16 * NetworkProcess/NetworkProcess.h: 17 (WebKit::NetworkProcess::addSupplement): 18 * Shared/Authentication/AuthenticationManager.cpp: 19 (WebKit::AuthenticationManager::AuthenticationManager): 20 (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): 21 * Shared/Authentication/AuthenticationManager.h: 22 * UIProcess/API/APIUIClient.h: 23 (API::UIClient::decidePolicyForGeolocationPermissionRequest): 24 * UIProcess/API/C/WKPage.cpp: 25 (WKPageSetPageUIClient): 26 * UIProcess/WebPageProxy.cpp: 27 (WebKit::WebPageProxy::requestGeolocationPermissionForFrame): 28 * WebProcess/Cookies/WebCookieManager.cpp: 29 (WebKit::WebCookieManager::WebCookieManager): 30 (WebKit::WebCookieManager::getHostnamesWithCookies): 31 (WebKit::WebCookieManager::deleteCookie): 32 (WebKit::WebCookieManager::deleteAllCookiesModifiedSince): 33 (WebKit::WebCookieManager::getAllCookies): 34 (WebKit::WebCookieManager::getCookies): 35 (WebKit::WebCookieManager::setCookie): 36 (WebKit::WebCookieManager::setCookies): 37 (WebKit::WebCookieManager::notifyCookiesDidChange): 38 (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy): 39 (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy): 40 * WebProcess/Cookies/WebCookieManager.h: 41 * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: 42 (WebKit::GeolocationPermissionRequestManager::GeolocationPermissionRequestManager): 43 (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation): 44 (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation): 45 * WebProcess/Geolocation/GeolocationPermissionRequestManager.h: 46 * WebProcess/Geolocation/WebGeolocationManager.cpp: 47 (WebKit::WebGeolocationManager::WebGeolocationManager): 48 (WebKit::WebGeolocationManager::registerWebPage): 49 (WebKit::WebGeolocationManager::unregisterWebPage): 50 (WebKit::WebGeolocationManager::setEnableHighAccuracyForPage): 51 (WebKit::WebGeolocationManager::didChangePosition): 52 (WebKit::WebGeolocationManager::didFailToDeterminePosition): 53 (WebKit::WebGeolocationManager::resetPermissions): 54 * WebProcess/Geolocation/WebGeolocationManager.h: 55 * WebProcess/MediaCache/WebMediaKeyStorageManager.h: 56 (WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager): 57 * WebProcess/Notifications/WebNotificationManager.cpp: 58 (WebKit::WebNotificationManager::WebNotificationManager): 59 (WebKit::WebNotificationManager::show): 60 (WebKit::WebNotificationManager::cancel): 61 (WebKit::WebNotificationManager::clearNotifications): 62 (WebKit::WebNotificationManager::didDestroyNotification): 63 * WebProcess/Notifications/WebNotificationManager.h: 64 * WebProcess/WebCoreSupport/WebGeolocationClient.cpp: 65 (WebKit::WebGeolocationClient::requestPermission): 66 (WebKit::WebGeolocationClient::cancelPermissionRequest): 67 * WebProcess/WebCoreSupport/WebGeolocationClient.h: 68 (WebKit::WebGeolocationClient::WebGeolocationClient): 69 * WebProcess/WebPage/WebPage.cpp: 70 (WebKit::m_cpuLimit): 71 * WebProcess/WebProcess.h: 72 (WebKit::WebProcess::addSupplement): 73 * WebProcess/cocoa/UserMediaCaptureManager.cpp: 74 (WebKit::UserMediaCaptureManager::UserMediaCaptureManager): 75 * WebProcess/cocoa/UserMediaCaptureManager.h: 76 1 77 2017-09-06 Alex Christensen <achristensen@webkit.org> 2 78 -
trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
r213441 r221743 48 48 } 49 49 50 LegacyCustomProtocolManager::LegacyCustomProtocolManager(ChildProcess *childProcess)50 LegacyCustomProtocolManager::LegacyCustomProtocolManager(ChildProcess& childProcess) 51 51 : m_childProcess(childProcess) 52 52 { 53 m_childProcess ->addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this);53 m_childProcess.addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this); 54 54 } 55 55 … … 78 78 void LegacyCustomProtocolManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request) 79 79 { 80 m_childProcess ->send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request));80 m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request)); 81 81 } 82 82 83 83 void LegacyCustomProtocolManager::stopLoading(uint64_t customProtocolID) 84 84 { 85 m_childProcess ->send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0);85 m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0); 86 86 } 87 87 -
trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h
r213441 r221743 66 66 WTF_MAKE_NONCOPYABLE(LegacyCustomProtocolManager); 67 67 public: 68 explicit LegacyCustomProtocolManager(ChildProcess *);68 explicit LegacyCustomProtocolManager(ChildProcess&); 69 69 70 70 static const char* supplementName(); … … 114 114 void registerProtocolClass(); 115 115 116 ChildProcess *m_childProcess;116 ChildProcess& m_childProcess; 117 117 118 118 typedef HashMap<uint64_t, CustomProtocol> CustomProtocolMap; -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r221683 r221743 87 87 void addSupplement() 88 88 { 89 m_supplements.add(T::supplementName(), std::make_unique<T>( this));89 m_supplements.add(T::supplementName(), std::make_unique<T>(*this)); 90 90 } 91 91 -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
r221059 r221743 63 63 } 64 64 65 AuthenticationManager::AuthenticationManager(ChildProcess *process)65 AuthenticationManager::AuthenticationManager(ChildProcess& process) 66 66 : m_process(process) 67 67 { 68 m_process ->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this);68 m_process.addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this); 69 69 } 70 70 … … 127 127 return; 128 128 129 m_process ->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());129 m_process.send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID()); 130 130 } 131 131 … … 142 142 return; 143 143 144 m_process ->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));144 m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID)); 145 145 } 146 146 … … 170 170 return; 171 171 172 m_process ->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));172 m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID)); 173 173 } 174 174 #endif -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h
r221059 r221743 60 60 WTF_MAKE_NONCOPYABLE(AuthenticationManager); 61 61 public: 62 explicit AuthenticationManager(ChildProcess *);62 explicit AuthenticationManager(ChildProcess&); 63 63 64 64 static const char* supplementName(); … … 119 119 Vector<uint64_t> coalesceChallengesMatching(uint64_t challengeID) const; 120 120 121 ChildProcess *m_process;121 ChildProcess& m_process; 122 122 123 123 HashMap<uint64_t, Challenge> m_challenges; -
trunk/Source/WebKit/UIProcess/API/APIUIClient.h
r221658 r221743 128 128 129 129 virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::SecurityOriginData&, OpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; } 130 virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy *, WebKit::WebFrameProxy*, SecurityOrigin*, WebKit::GeolocationPermissionRequestProxy*) { return false; }130 virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, WebKit::GeolocationPermissionRequestProxy&) { return false; } 131 131 virtual bool decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy&) { return false; } 132 132 virtual bool checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy&) { return false; } -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r221658 r221743 1954 1954 } 1955 1955 1956 bool decidePolicyForGeolocationPermissionRequest(WebPageProxy * page, WebFrameProxy* frame, API::SecurityOrigin* origin, GeolocationPermissionRequestProxy*permissionRequest) final1956 bool decidePolicyForGeolocationPermissionRequest(WebPageProxy& page, WebFrameProxy& frame, API::SecurityOrigin& origin, GeolocationPermissionRequestProxy& permissionRequest) final 1957 1957 { 1958 1958 if (!m_client.decidePolicyForGeolocationPermissionRequest) 1959 1959 return false; 1960 1960 1961 m_client.decidePolicyForGeolocationPermissionRequest(toAPI( page), toAPI(frame), toAPI(origin), toAPI(permissionRequest), m_client.base.clientInfo);1961 m_client.decidePolicyForGeolocationPermissionRequest(toAPI(&page), toAPI(&frame), toAPI(&origin), toAPI(&permissionRequest), m_client.base.clientInfo); 1962 1962 return true; 1963 1963 } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
r221658 r221743 183 183 } 184 184 185 bool decidePolicyForGeolocationPermissionRequest(WebPageProxy *, WebFrameProxy*, API::SecurityOrigin*, GeolocationPermissionRequestProxy* permissionRequest) override186 { 187 GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate( permissionRequest));185 bool decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, GeolocationPermissionRequestProxy& permissionRequest) final 186 { 187 GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(&permissionRequest)); 188 188 webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get())); 189 189 return true; -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r221707 r221743 5810 5810 5811 5811 // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier(). 5812 RefPtr<API::SecurityOrigin>origin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin());5813 RefPtr<GeolocationPermissionRequestProxy>request = m_geolocationPermissionRequestManager.createRequest(geolocationID);5814 5815 if (m_uiClient->decidePolicyForGeolocationPermissionRequest( this,frame, origin.get(), request.get()))5816 return; 5817 5818 if (m_pageClient.decidePolicyForGeolocationPermissionRequest(*frame, *origin, *request))5812 auto origin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin()); 5813 auto request = m_geolocationPermissionRequestManager.createRequest(geolocationID); 5814 5815 if (m_uiClient->decidePolicyForGeolocationPermissionRequest(*this, *frame, origin.get(), request.get())) 5816 return; 5817 5818 if (m_pageClient.decidePolicyForGeolocationPermissionRequest(*frame, origin.get(), request.get())) 5819 5819 return; 5820 5820 -
trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.cpp
r220857 r221743 49 49 } 50 50 51 WebCookieManager::WebCookieManager(ChildProcess *process)51 WebCookieManager::WebCookieManager(ChildProcess& process) 52 52 : m_process(process) 53 53 { 54 m_process ->addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this);54 m_process.addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this); 55 55 } 56 56 … … 64 64 copyToVector(hostnames, hostnameList); 65 65 66 m_process ->send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);66 m_process.send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0); 67 67 } 68 68 … … 85 85 storageSession->deleteCookie(cookie); 86 86 87 m_process ->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);87 m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0); 88 88 } 89 89 … … 93 93 WebCore::deleteAllCookiesModifiedSince(*storageSession, time); 94 94 95 m_process ->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);95 m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0); 96 96 } 97 97 … … 102 102 cookies = storageSession->getAllCookies(); 103 103 104 m_process ->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);104 m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0); 105 105 } 106 106 … … 111 111 cookies = storageSession->getCookies(url); 112 112 113 m_process ->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);113 m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0); 114 114 } 115 115 … … 119 119 storageSession->setCookie(cookie); 120 120 121 m_process ->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);121 m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0); 122 122 } 123 123 … … 127 127 storageSession->setCookies(cookies, url, mainDocumentURL); 128 128 129 m_process ->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);129 m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0); 130 130 } 131 131 … … 133 133 { 134 134 ASSERT(RunLoop::isMain()); 135 m_process ->send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);135 m_process.send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0); 136 136 } 137 137 … … 156 156 157 157 if (callbackID) 158 m_process ->send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0);158 m_process.send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0); 159 159 } 160 160 161 161 void WebCookieManager::getHTTPCookieAcceptPolicy(CallbackID callbackID) 162 162 { 163 m_process ->send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);163 m_process.send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0); 164 164 } 165 165 -
trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.h
r220887 r221743 55 55 WTF_MAKE_NONCOPYABLE(WebCookieManager); 56 56 public: 57 WebCookieManager(ChildProcess *);57 WebCookieManager(ChildProcess&); 58 58 59 59 static const char* supplementName(); … … 90 90 void stopObservingCookieChanges(PAL::SessionID); 91 91 92 ChildProcess *m_process;92 ChildProcess& m_process; 93 93 }; 94 94 -
trunk/Source/WebKit/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
r210859 r221743 50 50 } 51 51 52 GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage *page)52 GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage& page) 53 53 : m_page(page) 54 54 { 55 55 } 56 56 57 void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation *geolocation)57 void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation& geolocation) 58 58 { 59 Frame* frame = geolocation ->frame();59 Frame* frame = geolocation.frame(); 60 60 61 61 ASSERT_WITH_MESSAGE(frame, "It is not well understood in which cases the Geolocation is alive after its frame goes away. If you hit this assertion, please add a test covering this case."); 62 62 if (!frame) { 63 geolocation ->setIsAllowed(false);63 geolocation.setIsAllowed(false); 64 64 return; 65 65 } … … 67 67 uint64_t geolocationID = generateGeolocationID(); 68 68 69 m_geolocationToIDMap.set( geolocation, geolocationID);70 m_idToGeolocationMap.set(geolocationID, geolocation);69 m_geolocationToIDMap.set(&geolocation, geolocationID); 70 m_idToGeolocationMap.set(geolocationID, &geolocation); 71 71 72 72 WebFrame* webFrame = WebFrame::fromCoreFrame(*frame); … … 75 75 SecurityOrigin& origin = frame->document()->securityOrigin(); 76 76 77 m_page ->send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier()));77 m_page.send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier())); 78 78 } 79 79 80 void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation *geolocation)80 void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation& geolocation) 81 81 { 82 uint64_t geolocationID = m_geolocationToIDMap.take( geolocation);82 uint64_t geolocationID = m_geolocationToIDMap.take(&geolocation); 83 83 if (!geolocationID) 84 84 return; -
trunk/Source/WebKit/WebProcess/Geolocation/GeolocationPermissionRequestManager.h
r95901 r221743 24 24 */ 25 25 26 #ifndef GeolocationPermissionRequestManager_h 27 #define GeolocationPermissionRequestManager_h 26 #pragma once 28 27 29 28 #include <wtf/HashMap.h> … … 40 39 class GeolocationPermissionRequestManager { 41 40 public: 42 explicit GeolocationPermissionRequestManager(WebPage *);41 explicit GeolocationPermissionRequestManager(WebPage&); 43 42 44 void startRequestForGeolocation(WebCore::Geolocation *);45 void cancelRequestForGeolocation(WebCore::Geolocation *);43 void startRequestForGeolocation(WebCore::Geolocation&); 44 void cancelRequestForGeolocation(WebCore::Geolocation&); 46 45 47 46 void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed); … … 53 52 GeolocationToIDMap m_geolocationToIDMap; 54 53 55 WebPage *m_page;54 WebPage& m_page; 56 55 }; 57 56 58 57 } // namespace WebKit 59 60 #endif // GeolocationPermissionRequestManager_h -
trunk/Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp
r160464 r221743 46 46 } 47 47 48 WebGeolocationManager::WebGeolocationManager(WebProcess *process)48 WebGeolocationManager::WebGeolocationManager(WebProcess& process) 49 49 : m_process(process) 50 50 { 51 m_process ->addMessageReceiver(Messages::WebGeolocationManager::messageReceiverName(), *this);51 m_process.addMessageReceiver(Messages::WebGeolocationManager::messageReceiverName(), *this); 52 52 } 53 53 54 void WebGeolocationManager::registerWebPage(WebPage *page)54 void WebGeolocationManager::registerWebPage(WebPage& page) 55 55 { 56 56 bool wasUpdating = isUpdating(); 57 57 58 m_pageSet.add( page);58 m_pageSet.add(&page); 59 59 60 60 if (!wasUpdating) 61 m_process ->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StartUpdating(), 0);61 m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StartUpdating(), 0); 62 62 } 63 63 64 void WebGeolocationManager::unregisterWebPage(WebPage *page)64 void WebGeolocationManager::unregisterWebPage(WebPage& page) 65 65 { 66 66 bool highAccuracyWasEnabled = isHighAccuracyEnabled(); 67 67 68 m_pageSet.remove( page);69 m_highAccuracyPageSet.remove( page);68 m_pageSet.remove(&page); 69 m_highAccuracyPageSet.remove(&page); 70 70 71 71 if (!isUpdating()) 72 m_process ->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0);72 m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0); 73 73 else { 74 74 bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled(); 75 75 if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled) 76 m_process ->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);76 m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0); 77 77 } 78 78 } 79 79 80 void WebGeolocationManager::setEnableHighAccuracyForPage(WebPage *page, bool enabled)80 void WebGeolocationManager::setEnableHighAccuracyForPage(WebPage& page, bool enabled) 81 81 { 82 82 bool highAccuracyWasEnabled = isHighAccuracyEnabled(); 83 83 84 84 if (enabled) 85 m_highAccuracyPageSet.add( page);85 m_highAccuracyPageSet.add(&page); 86 86 else 87 m_highAccuracyPageSet.remove( page);87 m_highAccuracyPageSet.remove(&page); 88 88 89 89 bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled(); 90 90 if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled) 91 m_process ->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);91 m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0); 92 92 } 93 93 … … 99 99 Vector<RefPtr<WebPage>> webPageCopy; 100 100 copyToVector(m_pageSet, webPageCopy); 101 for (size_t i = 0; i < webPageCopy.size(); ++i) { 102 WebPage* page = webPageCopy[i].get(); 101 for (auto& page : webPageCopy) { 103 102 if (page->corePage()) 104 103 GeolocationController::from(page->corePage())->positionChanged(position.get()); … … 113 112 #if ENABLE(GEOLOCATION) 114 113 // FIXME: Add localized error string. 115 RefPtr<GeolocationError>error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);114 auto error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage); 116 115 117 116 Vector<RefPtr<WebPage>> webPageCopy; 118 117 copyToVector(m_pageSet, webPageCopy); 119 for (size_t i = 0; i < webPageCopy.size(); ++i) { 120 WebPage* page = webPageCopy[i].get(); 118 for (auto& page : webPageCopy) { 121 119 if (page->corePage()) 122 120 GeolocationController::from(page->corePage())->errorOccurred(error.get()); … … 130 128 void WebGeolocationManager::resetPermissions() 131 129 { 132 m_process ->resetAllGeolocationPermissions();130 m_process.resetAllGeolocationPermissions(); 133 131 } 134 132 #endif // PLATFORM(IOS) -
trunk/Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.h
r204668 r221743 24 24 */ 25 25 26 #ifndef WebGeolocationManager_h 27 #define WebGeolocationManager_h 26 #pragma once 28 27 29 28 #include "MessageReceiver.h" … … 47 46 WTF_MAKE_NONCOPYABLE(WebGeolocationManager); 48 47 public: 49 explicit WebGeolocationManager(WebProcess *);48 explicit WebGeolocationManager(WebProcess&); 50 49 51 50 static const char* supplementName(); 52 51 53 void registerWebPage(WebPage *);54 void unregisterWebPage(WebPage *);55 void setEnableHighAccuracyForPage(WebPage *, bool);52 void registerWebPage(WebPage&); 53 void unregisterWebPage(WebPage&); 54 void setEnableHighAccuracyForPage(WebPage&, bool); 56 55 57 void requestPermission(WebCore::Geolocation *);56 void requestPermission(WebCore::Geolocation&); 58 57 59 58 private: … … 70 69 #endif // PLATFORM(IOS) 71 70 72 WebProcess *m_process;71 WebProcess& m_process; 73 72 HashSet<WebPage*> m_pageSet; 74 73 HashSet<WebPage*> m_highAccuracyPageSet; … … 76 75 77 76 } // namespace WebKit 78 79 #endif // WebGeolocationManager_h -
trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.h
r209871 r221743 24 24 */ 25 25 26 #ifndef WebMediaKeyStorageManager_h 27 #define WebMediaKeyStorageManager_h 26 #pragma once 28 27 29 28 #include "WebProcessSupplement.h" … … 42 41 WTF_MAKE_NONCOPYABLE(WebMediaKeyStorageManager); 43 42 public: 44 explicit WebMediaKeyStorageManager(WebProcess *) { }43 explicit WebMediaKeyStorageManager(WebProcess&) { } 45 44 virtual ~WebMediaKeyStorageManager() { } 46 45 … … 62 61 63 62 } 64 65 #endif -
trunk/Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp
r217041 r221743 62 62 } 63 63 64 WebNotificationManager::WebNotificationManager(WebProcess *process)64 WebNotificationManager::WebNotificationManager(WebProcess& process) 65 65 : m_process(process) 66 66 { 67 67 #if ENABLE(NOTIFICATIONS) 68 m_process ->addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), *this);68 m_process.addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), *this); 69 69 #endif 70 70 } … … 152 152 it->value.append(notificationID); 153 153 154 m_process ->parentProcessConnection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->icon().string(), notification->tag(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());154 m_process.parentProcessConnection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->icon().string(), notification->tag(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID()); 155 155 return true; 156 156 #else … … 171 171 return; 172 172 173 m_process ->parentProcessConnection()->send(Messages::WebPageProxy::CancelNotification(notificationID), page->pageID());173 m_process.parentProcessConnection()->send(Messages::WebPageProxy::CancelNotification(notificationID), page->pageID()); 174 174 #else 175 175 UNUSED_PARAM(notification); … … 186 186 187 187 Vector<uint64_t>& notificationIDs = it->value; 188 m_process ->parentProcessConnection()->send(Messages::WebPageProxy::ClearNotifications(notificationIDs), page->pageID());188 m_process.parentProcessConnection()->send(Messages::WebPageProxy::ClearNotifications(notificationIDs), page->pageID()); 189 189 size_t count = notificationIDs.size(); 190 190 for (size_t i = 0; i < count; ++i) { … … 212 212 m_notificationIDMap.remove(notificationID); 213 213 removeNotificationFromContextMap(notificationID, notification); 214 m_process ->parentProcessConnection()->send(Messages::WebPageProxy::DidDestroyNotification(notificationID), page->pageID());214 m_process.parentProcessConnection()->send(Messages::WebPageProxy::DidDestroyNotification(notificationID), page->pageID()); 215 215 #else 216 216 UNUSED_PARAM(notification); -
trunk/Source/WebKit/WebProcess/Notifications/WebNotificationManager.h
r216641 r221743 24 24 */ 25 25 26 #ifndef WebNotificationManager_h 27 #define WebNotificationManager_h 26 #pragma once 28 27 29 28 #include "MessageReceiver.h" … … 49 48 WTF_MAKE_NONCOPYABLE(WebNotificationManager); 50 49 public: 51 explicit WebNotificationManager(WebProcess *);50 explicit WebNotificationManager(WebProcess&); 52 51 ~WebNotificationManager(); 53 52 … … 85 84 #endif 86 85 87 WebProcess *m_process;86 WebProcess& m_process; 88 87 89 88 #if ENABLE(NOTIFICATIONS) … … 102 101 103 102 } // namespace WebKit 104 105 #endif -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
r217041 r221743 71 71 } 72 72 73 void WebGeolocationClient::requestPermission(Geolocation *geolocation)73 void WebGeolocationClient::requestPermission(Geolocation& geolocation) 74 74 { 75 m_page ->geolocationPermissionRequestManager().startRequestForGeolocation(geolocation);75 m_page.geolocationPermissionRequestManager().startRequestForGeolocation(geolocation); 76 76 } 77 77 78 void WebGeolocationClient::cancelPermissionRequest(Geolocation *geolocation)78 void WebGeolocationClient::cancelPermissionRequest(Geolocation& geolocation) 79 79 { 80 m_page ->geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation);80 m_page.geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation); 81 81 } 82 82 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.h
r197563 r221743 24 24 */ 25 25 26 #ifndef WebGeolocationClient_h 27 #define WebGeolocationClient_h 26 #pragma once 28 27 29 28 #include <WebCore/GeolocationClient.h> … … 35 34 class WebGeolocationClient : public WebCore::GeolocationClient { 36 35 public: 37 WebGeolocationClient(WebPage *page)36 WebGeolocationClient(WebPage& page) 38 37 : m_page(page) 39 38 { … … 51 50 WebCore::GeolocationPosition* lastPosition() override; 52 51 53 void requestPermission(WebCore::Geolocation *) override;54 void cancelPermissionRequest(WebCore::Geolocation *) override;52 void requestPermission(WebCore::Geolocation&) override; 53 void cancelPermissionRequest(WebCore::Geolocation&) override; 55 54 56 57 WebPage* m_page; 55 WebPage& m_page; 58 56 }; 59 57 60 58 } // namespace WebKit 61 62 #endif // WebGeolocationClient_h -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r221465 r221743 335 335 , m_userContentController(WebUserContentController::getOrCreate(parameters.userContentControllerID)) 336 336 #if ENABLE(GEOLOCATION) 337 , m_geolocationPermissionRequestManager(makeUniqueRef<GeolocationPermissionRequestManager>( this))337 , m_geolocationPermissionRequestManager(makeUniqueRef<GeolocationPermissionRequestManager>(*this)) 338 338 #endif 339 339 #if ENABLE(MEDIA_STREAM) … … 428 428 429 429 #if ENABLE(GEOLOCATION) 430 WebCore::provideGeolocationTo(m_page.get(), new WebGeolocationClient(this));430 WebCore::provideGeolocationTo(m_page.get(), *new WebGeolocationClient(*this)); 431 431 #endif 432 432 #if ENABLE(NOTIFICATIONS) -
trunk/Source/WebKit/WebProcess/WebProcess.h
r220931 r221743 114 114 void addSupplement() 115 115 { 116 m_supplements.add(T::supplementName(), std::make_unique<T>( this));116 m_supplements.add(T::supplementName(), std::make_unique<T>(*this)); 117 117 } 118 118 -
trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp
r219511 r221743 153 153 }; 154 154 155 UserMediaCaptureManager::UserMediaCaptureManager(WebProcess *process)156 : m_process( *process)155 UserMediaCaptureManager::UserMediaCaptureManager(WebProcess& process) 156 : m_process(process) 157 157 { 158 158 m_process.addMessageReceiver(Messages::UserMediaCaptureManager::messageReceiverName(), *this); -
trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h
r219511 r221743 45 45 class UserMediaCaptureManager : public WebProcessSupplement, public IPC::MessageReceiver, public WebCore::RealtimeMediaSource::AudioCaptureFactory, public WebCore::RealtimeMediaSource::VideoCaptureFactory { 46 46 public: 47 explicit UserMediaCaptureManager(WebProcess *);47 explicit UserMediaCaptureManager(WebProcess&); 48 48 ~UserMediaCaptureManager(); 49 49 -
trunk/Source/WebKitLegacy/mac/ChangeLog
r221617 r221743 1 2017-09-07 Alex Christensen <achristensen@webkit.org> 2 3 Modernize Geolocation code 4 https://bugs.webkit.org/show_bug.cgi?id=176496 5 6 Reviewed by Andy Estes. 7 8 * WebCoreSupport/WebGeolocationClient.h: 9 * WebCoreSupport/WebGeolocationClient.mm: 10 (WebGeolocationClient::requestPermission): 11 (-[WebGeolocationPolicyListener initWithGeolocation:]): 12 (-[WebGeolocationPolicyListener initWithGeolocation:forWebView:]): 13 (-[WebGeolocationProviderInitializationListener initWithGeolocation:]): 14 * WebView/WebView.mm: 15 (-[WebView _commonInitializationWithFrameName:groupName:]): 16 (-[WebView _geolocationDidFailWithMessage:]): 17 1 18 2017-09-05 Tim Horton <timothy_horton@apple.com> 2 19 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.h
r197563 r221743 50 50 WebCore::GeolocationPosition* lastPosition() override; 51 51 52 void requestPermission(WebCore::Geolocation *) override;53 void cancelPermissionRequest(WebCore::Geolocation *) override { };52 void requestPermission(WebCore::Geolocation&) override; 53 void cancelPermissionRequest(WebCore::Geolocation&) override { }; 54 54 55 55 private: -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm
r210859 r221743 51 51 RefPtr<Geolocation> _geolocation; 52 52 } 53 - (id)initWithGeolocation:(Geolocation *)geolocation;53 - (id)initWithGeolocation:(Geolocation&)geolocation; 54 54 @end 55 55 #else … … 68 68 RefPtr<Geolocation> m_geolocation; 69 69 } 70 - (id)initWithGeolocation:(Geolocation *)geolocation;70 - (id)initWithGeolocation:(Geolocation&)geolocation; 71 71 @end 72 72 #endif … … 101 101 #endif 102 102 103 void WebGeolocationClient::requestPermission(Geolocation *geolocation)103 void WebGeolocationClient::requestPermission(Geolocation& geolocation) 104 104 { 105 105 BEGIN_BLOCK_OBJC_EXCEPTIONS; … … 107 107 SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:); 108 108 if (![[m_webView UIDelegate] respondsToSelector:selector]) { 109 geolocation ->setIsAllowed(false);109 geolocation.setIsAllowed(false); 110 110 return; 111 111 } 112 112 113 113 #if !PLATFORM(IOS) 114 Frame *frame = geolocation ->frame();114 Frame *frame = geolocation.frame(); 115 115 116 116 if (!frame) { 117 geolocation ->setIsAllowed(false);117 geolocation.setIsAllowed(false); 118 118 return; 119 119 } … … 141 141 @implementation WebGeolocationPolicyListener 142 142 143 - (id)initWithGeolocation:(Geolocation *)geolocation143 - (id)initWithGeolocation:(Geolocation&)geolocation 144 144 { 145 145 if (!(self = [super init])) 146 146 return nil; 147 _geolocation = geolocation;147 _geolocation = &geolocation; 148 148 return self; 149 149 } … … 207 207 208 208 @implementation WebGeolocationProviderInitializationListener 209 - (id)initWithGeolocation:(Geolocation *)geolocation209 - (id)initWithGeolocation:(Geolocation&)geolocation 210 210 { 211 211 self = [super init]; 212 212 if (self) 213 m_geolocation = geolocation;213 m_geolocation = &geolocation; 214 214 return self; 215 215 } -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r221473 r221743 1455 1455 1456 1456 #if ENABLE(GEOLOCATION) 1457 WebCore::provideGeolocationTo(_private->page, new WebGeolocationClient(self));1457 WebCore::provideGeolocationTo(_private->page, *new WebGeolocationClient(self)); 1458 1458 #endif 1459 1459 #if ENABLE(NOTIFICATIONS) … … 9985 9985 #if ENABLE(GEOLOCATION) 9986 9986 if (_private && _private->page) { 9987 RefPtr<GeolocationError>geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);9987 auto geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage); 9988 9988 WebCore::GeolocationController::from(_private->page)->errorOccurred(geolocatioError.get()); 9989 9989 } -
trunk/Source/WebKitLegacy/win/ChangeLog
r221733 r221743 1 2017-09-07 Alex Christensen <achristensen@webkit.org> 2 3 Modernize Geolocation code 4 https://bugs.webkit.org/show_bug.cgi?id=176496 5 6 Reviewed by Andy Estes. 7 8 * WebCoreSupport/WebGeolocationClient.cpp: 9 (WebGeolocationClient::requestPermission): 10 * WebCoreSupport/WebGeolocationClient.h: 11 (WebGeolocationClient::setEnableHighAccuracy): Deleted. 12 (WebGeolocationClient::cancelPermissionRequest): Deleted. 13 * WebGeolocationPolicyListener.h: 14 * WebView.cpp: 15 (WebView::initWithFrame): 16 (WebView::geolocationDidFailWithError): 17 1 18 2017-09-07 Per Arne Vollan <pvollan@apple.com> 2 19 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.cpp
r210859 r221743 76 76 } 77 77 78 void WebGeolocationClient::requestPermission(Geolocation *geolocation)78 void WebGeolocationClient::requestPermission(Geolocation& geolocation) 79 79 { 80 80 COMPtr<IWebUIDelegate> uiDelegate; 81 81 if (FAILED(m_webView->uiDelegate(&uiDelegate))) { 82 geolocation ->setIsAllowed(false);82 geolocation.setIsAllowed(false); 83 83 return; 84 84 } … … 86 86 COMPtr<IWebUIDelegatePrivate2> uiDelegatePrivate2(Query, uiDelegate); 87 87 if (!uiDelegatePrivate2) { 88 geolocation ->setIsAllowed(false);88 geolocation.setIsAllowed(false); 89 89 return; 90 90 } 91 91 92 Frame* frame = geolocation ->frame();92 Frame* frame = geolocation.frame(); 93 93 COMPtr<WebSecurityOrigin> origin(AdoptCOM, WebSecurityOrigin::createInstance(&frame->document()->securityOrigin())); 94 COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance( geolocation);94 COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance(&geolocation); 95 95 HRESULT hr = uiDelegatePrivate2->decidePolicyForGeolocationRequest(m_webView.get(), kit(frame), origin.get(), listener.get()); 96 96 if (hr != E_NOTIMPL) 97 97 return; 98 98 99 geolocation ->setIsAllowed(false);99 geolocation.setIsAllowed(false); 100 100 } -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebGeolocationClient.h
r84146 r221743 24 24 */ 25 25 26 #ifndef WebGeolocationClient_h 27 #define WebGeolocationClient_h 26 #pragma once 28 27 29 28 #include <WebCore/COMPtr.h> … … 41 40 WebGeolocationClient(WebView*); 42 41 43 v irtual void geolocationDestroyed();44 v irtual void startUpdating();45 v irtual void stopUpdating();46 v irtual void setEnableHighAccuracy(bool){ }47 virtual WebCore::GeolocationPosition* lastPosition();42 void geolocationDestroyed() final; 43 void startUpdating() final; 44 void stopUpdating() final; 45 void setEnableHighAccuracy(bool) final { } 46 WebCore::GeolocationPosition* lastPosition() final; 48 47 49 v irtual void requestPermission(WebCore::Geolocation*);50 v irtual void cancelPermissionRequest(WebCore::Geolocation*){ }48 void requestPermission(WebCore::Geolocation&) final; 49 void cancelPermissionRequest(WebCore::Geolocation&) final { } 51 50 52 51 private: 53 52 COMPtr<WebView> m_webView; 54 53 }; 55 56 #endif // WebGeolocationClient_h -
trunk/Source/WebKitLegacy/win/WebGeolocationPolicyListener.h
r216823 r221743 24 24 */ 25 25 26 #ifndef WebGeolocationPolicyListener_h 27 #define WebGeolocationPolicyListener_h 26 #pragma once 28 27 29 28 #include "WebKit.h" … … 55 54 RefPtr<WebCore::Geolocation> m_geolocation; 56 55 }; 57 58 #endif WebGeolocationPolicyListener_h -
trunk/Source/WebKitLegacy/win/WebView.cpp
r221733 r221743 3122 3122 3123 3123 m_page = new Page(WTFMove(configuration)); 3124 provideGeolocationTo(m_page, new WebGeolocationClient(this));3124 provideGeolocationTo(m_page, *new WebGeolocationClient(this)); 3125 3125 3126 3126 unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; … … 7250 7250 return E_FAIL; 7251 7251 7252 RefPtr<GeolocationError>geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, toString(description));7252 auto geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, toString(description)); 7253 7253 GeolocationController::from(m_page)->errorOccurred(geolocationError.get()); 7254 7254 return S_OK;
Note: See TracChangeset
for help on using the changeset viewer.