https://bugs.webkit.org/show_bug.cgi?id=176496
Reviewed by Andy Estes.
Source/WebCore:
No change in behavior. Just more references instead of pointers.
* Modules/geolocation/Geolocation.cpp:
(WebCore::createPositionError):
(WebCore::Geolocation::resetAllGeolocationPermission):
(WebCore::Geolocation::stop):
(WebCore::Geolocation::requestPermission):
(WebCore::Geolocation::setError):
(WebCore::Geolocation::startUpdating):
(WebCore::Geolocation::stopUpdating):
* Modules/geolocation/Geolocation.h:
* Modules/geolocation/GeolocationClient.h:
* Modules/geolocation/GeolocationController.cpp:
(WebCore::GeolocationController::addObserver):
(WebCore::GeolocationController::removeObserver):
(WebCore::GeolocationController::requestPermission):
(WebCore::GeolocationController::cancelPermissionRequest):
(WebCore::GeolocationController::positionChanged):
(WebCore::GeolocationController::errorOccurred):
(WebCore::GeolocationController::activityStateDidChange):
(WebCore::provideGeolocationTo):
* Modules/geolocation/GeolocationController.h:
Source/WebKit:
Making the GeolocationPermissionRequestManager take a reference instead of a pointer
spilled into making the other supplement constructors do the same.
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
(WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
(WebKit::LegacyCustomProtocolManager::startLoading):
(WebKit::LegacyCustomProtocolManager::stopLoading):
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::addSupplement):
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::AuthenticationManager):
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
* Shared/Authentication/AuthenticationManager.h:
* UIProcess/API/APIUIClient.h:
(API::UIClient::decidePolicyForGeolocationPermissionRequest):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
* WebProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::WebCookieManager):
(WebKit::WebCookieManager::getHostnamesWithCookies):
(WebKit::WebCookieManager::deleteCookie):
(WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManager::getAllCookies):
(WebKit::WebCookieManager::getCookies):
(WebKit::WebCookieManager::setCookie):
(WebKit::WebCookieManager::setCookies):
(WebKit::WebCookieManager::notifyCookiesDidChange):
(WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
* WebProcess/Cookies/WebCookieManager.h:
* WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
(WebKit::GeolocationPermissionRequestManager::GeolocationPermissionRequestManager):
(WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
(WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
* WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
* WebProcess/Geolocation/WebGeolocationManager.cpp:
(WebKit::WebGeolocationManager::WebGeolocationManager):
(WebKit::WebGeolocationManager::registerWebPage):
(WebKit::WebGeolocationManager::unregisterWebPage):
(WebKit::WebGeolocationManager::setEnableHighAccuracyForPage):
(WebKit::WebGeolocationManager::didChangePosition):
(WebKit::WebGeolocationManager::didFailToDeterminePosition):
(WebKit::WebGeolocationManager::resetPermissions):
* WebProcess/Geolocation/WebGeolocationManager.h:
* WebProcess/MediaCache/WebMediaKeyStorageManager.h:
(WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager):
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::WebNotificationManager):
(WebKit::WebNotificationManager::show):
(WebKit::WebNotificationManager::cancel):
(WebKit::WebNotificationManager::clearNotifications):
(WebKit::WebNotificationManager::didDestroyNotification):
* WebProcess/Notifications/WebNotificationManager.h:
* WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
(WebKit::WebGeolocationClient::requestPermission):
(WebKit::WebGeolocationClient::cancelPermissionRequest):
* WebProcess/WebCoreSupport/WebGeolocationClient.h:
(WebKit::WebGeolocationClient::WebGeolocationClient):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_cpuLimit):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::addSupplement):
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
* WebProcess/cocoa/UserMediaCaptureManager.h:
Source/WebKitLegacy/mac:
* WebCoreSupport/WebGeolocationClient.h:
* WebCoreSupport/WebGeolocationClient.mm:
(WebGeolocationClient::requestPermission):
(-[WebGeolocationPolicyListener initWithGeolocation:]):
(-[WebGeolocationPolicyListener initWithGeolocation:forWebView:]):
(-[WebGeolocationProviderInitializationListener initWithGeolocation:]):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _geolocationDidFailWithMessage:]):
Source/WebKitLegacy/win:
* WebCoreSupport/WebGeolocationClient.cpp:
(WebGeolocationClient::requestPermission):
* WebCoreSupport/WebGeolocationClient.h:
(WebGeolocationClient::setEnableHighAccuracy): Deleted.
(WebGeolocationClient::cancelPermissionRequest): Deleted.
* WebGeolocationPolicyListener.h:
* WebView.cpp:
(WebView::initWithFrame):
(WebView::geolocationDidFailWithError):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221743
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-09-07 Alex Christensen <achristensen@webkit.org>
+
+ Modernize Geolocation code
+ https://bugs.webkit.org/show_bug.cgi?id=176496
+
+ Reviewed by Andy Estes.
+
+ No change in behavior. Just more references instead of pointers.
+
+ * Modules/geolocation/Geolocation.cpp:
+ (WebCore::createPositionError):
+ (WebCore::Geolocation::resetAllGeolocationPermission):
+ (WebCore::Geolocation::stop):
+ (WebCore::Geolocation::requestPermission):
+ (WebCore::Geolocation::setError):
+ (WebCore::Geolocation::startUpdating):
+ (WebCore::Geolocation::stopUpdating):
+ * Modules/geolocation/Geolocation.h:
+ * Modules/geolocation/GeolocationClient.h:
+ * Modules/geolocation/GeolocationController.cpp:
+ (WebCore::GeolocationController::addObserver):
+ (WebCore::GeolocationController::removeObserver):
+ (WebCore::GeolocationController::requestPermission):
+ (WebCore::GeolocationController::cancelPermissionRequest):
+ (WebCore::GeolocationController::positionChanged):
+ (WebCore::GeolocationController::errorOccurred):
+ (WebCore::GeolocationController::activityStateDidChange):
+ (WebCore::provideGeolocationTo):
+ * Modules/geolocation/GeolocationController.h:
+
2017-09-07 Adrian Perez de Castro <aperez@igalia.com>
[ARM] Building FELightningNEON.cpp fails due to missing {Point,Spot}LightSource declarations
return Geoposition::create(WTFMove(coordinates), convertSecondsToDOMTimeStamp(position->timestamp()));
}
-static Ref<PositionError> createPositionError(GeolocationError* error)
+static Ref<PositionError> createPositionError(GeolocationError& error)
{
PositionError::ErrorCode code = PositionError::POSITION_UNAVAILABLE;
- switch (error->code()) {
+ switch (error.code()) {
case GeolocationError::PermissionDenied:
code = PositionError::PERMISSION_DENIED;
break;
break;
}
- return PositionError::create(code, error->message());
+ return PositionError::create(code, error.message());
}
bool Geolocation::Watchers::add(int id, RefPtr<GeoNotifier>&& notifier)
if (m_allowGeolocation == InProgress) {
Page* page = this->page();
if (page)
- GeolocationController::from(page)->cancelPermissionRequest(this);
+ GeolocationController::from(page)->cancelPermissionRequest(*this);
// This return is not technically correct as GeolocationController::cancelPermissionRequest() should have cleared the active request.
// Neither iOS nor OS X supports cancelPermissionRequest() (https://bugs.webkit.org/show_bug.cgi?id=89524), so we workaround that and let ongoing requests complete. :(
{
Page* page = this->page();
if (page && m_allowGeolocation == InProgress)
- GeolocationController::from(page)->cancelPermissionRequest(this);
+ GeolocationController::from(page)->cancelPermissionRequest(*this);
// The frame may be moving to a new page and we want to get the permissions from the new page's client.
m_allowGeolocation = Unknown;
cancelAllRequests();
m_allowGeolocation = InProgress;
// Ask the embedder: it maintains the geolocation challenge policy itself.
- GeolocationController::from(page)->requestPermission(this);
+ GeolocationController::from(page)->requestPermission(*this);
}
void Geolocation::makeSuccessCallbacks(Geoposition& position)
makeSuccessCallbacks(*position);
}
-void Geolocation::setError(GeolocationError* error)
+void Geolocation::setError(GeolocationError& error)
{
if (m_isSuspended) {
m_errorWaitingForResume = createPositionError(error);
if (!page)
return false;
- GeolocationController::from(page)->addObserver(this, notifier->options().enableHighAccuracy);
+ GeolocationController::from(page)->addObserver(*this, notifier->options().enableHighAccuracy);
return true;
}
if (!page)
return;
- GeolocationController::from(page)->removeObserver(this);
+ GeolocationController::from(page)->removeObserver(*this);
}
void Geolocation::handlePendingPermissionNotifiers()
bool isAllowed() const { return m_allowGeolocation == Yes; }
void positionChanged();
- void setError(GeolocationError*);
+ void setError(GeolocationError&);
bool shouldBlockGeolocationRequests();
private:
virtual void setEnableHighAccuracy(bool) = 0;
virtual GeolocationPosition* lastPosition() = 0;
- virtual void requestPermission(Geolocation*) = 0;
- virtual void cancelPermissionRequest(Geolocation*) = 0;
+ virtual void requestPermission(Geolocation&) = 0;
+ virtual void cancelPermissionRequest(Geolocation&) = 0;
- void provideGeolocationTo(Page*, GeolocationClient*);
+ void provideGeolocationTo(Page*, GeolocationClient&);
protected:
virtual ~GeolocationClient() { }
};
-WEBCORE_EXPORT void provideGeolocationTo(Page*, GeolocationClient*);
+WEBCORE_EXPORT void provideGeolocationTo(Page*, GeolocationClient&);
} // namespace WebCore
m_client.geolocationDestroyed();
}
-void GeolocationController::addObserver(Geolocation* observer, bool enableHighAccuracy)
+void GeolocationController::addObserver(Geolocation& observer, bool enableHighAccuracy)
{
// This may be called multiple times with the same observer, though removeObserver()
// is called only once with each.
m_client.startUpdating();
}
-void GeolocationController::removeObserver(Geolocation* observer)
+void GeolocationController::removeObserver(Geolocation& observer)
{
if (!m_observers.contains(observer))
return;
m_client.setEnableHighAccuracy(false);
}
-void GeolocationController::requestPermission(Geolocation* geolocation)
+void GeolocationController::requestPermission(Geolocation& geolocation)
{
if (!m_page.isVisible()) {
- m_pendedPermissionRequest.add(geolocation);
+ m_pendingPermissionRequest.add(geolocation);
return;
}
m_client.requestPermission(geolocation);
}
-void GeolocationController::cancelPermissionRequest(Geolocation* geolocation)
+void GeolocationController::cancelPermissionRequest(Geolocation& geolocation)
{
- if (m_pendedPermissionRequest.remove(geolocation))
+ if (m_pendingPermissionRequest.remove(geolocation))
return;
m_client.cancelPermissionRequest(geolocation);
void GeolocationController::positionChanged(GeolocationPosition* position)
{
m_lastPosition = position;
- Vector<RefPtr<Geolocation>> observersVector;
- copyToVector(m_observers, observersVector);
+ Vector<Ref<Geolocation>> observersVector;
+ observersVector.reserveInitialCapacity(m_observers.size());
+ for (auto& observer : m_observers)
+ observersVector.uncheckedAppend(observer.copyRef());
for (auto& observer : observersVector)
observer->positionChanged();
}
-void GeolocationController::errorOccurred(GeolocationError* error)
+void GeolocationController::errorOccurred(GeolocationError& error)
{
- Vector<RefPtr<Geolocation>> observersVector;
- copyToVector(m_observers, observersVector);
+ Vector<Ref<Geolocation>> observersVector;
+ observersVector.reserveInitialCapacity(m_observers.size());
+ for (auto& observer : m_observers)
+ observersVector.uncheckedAppend(observer.copyRef());
for (auto& observer : observersVector)
observer->setError(error);
}
if (!m_page.isVisible())
return;
- HashSet<RefPtr<Geolocation>> pendedPermissionRequests = WTFMove(m_pendedPermissionRequest);
+ auto pendedPermissionRequests = WTFMove(m_pendingPermissionRequest);
for (auto& permissionRequest : pendedPermissionRequests)
m_client.requestPermission(permissionRequest.get());
}
return "GeolocationController";
}
-void provideGeolocationTo(Page* page, GeolocationClient* client)
+void provideGeolocationTo(Page* page, GeolocationClient& client)
{
ASSERT(page);
- ASSERT(client);
- Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(*page, *client));
+ Supplement<Page>::provideTo(page, GeolocationController::supplementName(), std::make_unique<GeolocationController>(*page, client));
}
} // namespace WebCore
GeolocationController(Page&, GeolocationClient&);
~GeolocationController();
- void addObserver(Geolocation*, bool enableHighAccuracy);
- void removeObserver(Geolocation*);
+ void addObserver(Geolocation&, bool enableHighAccuracy);
+ void removeObserver(Geolocation&);
- void requestPermission(Geolocation*);
- void cancelPermissionRequest(Geolocation*);
+ void requestPermission(Geolocation&);
+ void cancelPermissionRequest(Geolocation&);
WEBCORE_EXPORT void positionChanged(GeolocationPosition*);
- WEBCORE_EXPORT void errorOccurred(GeolocationError*);
+ WEBCORE_EXPORT void errorOccurred(GeolocationError&);
GeolocationPosition* lastPosition();
RefPtr<GeolocationPosition> m_lastPosition;
- typedef HashSet<RefPtr<Geolocation>> ObserversSet;
+ typedef HashSet<Ref<Geolocation>> ObserversSet;
// All observers; both those requesting high accuracy and those not.
ObserversSet m_observers;
ObserversSet m_highAccuracyObservers;
// While the page is not visible, we pend permission requests.
- HashSet<RefPtr<Geolocation>> m_pendedPermissionRequest;
+ HashSet<Ref<Geolocation>> m_pendingPermissionRequest;
};
} // namespace WebCore
return m_pendingPermission.size();
}
-void GeolocationClientMock::requestPermission(Geolocation* geolocation)
+void GeolocationClientMock::requestPermission(Geolocation& geolocation)
{
- m_pendingPermission.add(geolocation);
+ m_pendingPermission.add(&geolocation);
if (m_permissionState != PermissionStateUnset)
asyncUpdatePermission();
}
-void GeolocationClientMock::cancelPermissionRequest(Geolocation* geolocation)
+void GeolocationClientMock::cancelPermissionRequest(Geolocation& geolocation)
{
// Called from Geolocation::disconnectFrame() in response to Frame destruction.
- m_pendingPermission.remove(geolocation);
+ m_pendingPermission.remove(&geolocation);
if (m_pendingPermission.isEmpty() && m_permissionTimer.isActive())
m_permissionTimer.stop();
}
ASSERT(!m_hasError);
m_controller->positionChanged(m_lastPosition.get());
} else if (m_hasError) {
- RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage);
+ auto geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage);
m_controller->errorOccurred(geolocatioError.get());
}
}
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GeolocationClientMock_h
-#define GeolocationClientMock_h
+#pragma once
#include "GeolocationClient.h"
#include "Timer.h"
void stopUpdating() override;
void setEnableHighAccuracy(bool) override;
GeolocationPosition* lastPosition() override;
- void requestPermission(Geolocation*) override;
- void cancelPermissionRequest(Geolocation*) override;
+ void requestPermission(Geolocation&) override;
+ void cancelPermissionRequest(Geolocation&) override;
private:
void asyncUpdateController();
};
}
-
-#endif
+2017-09-07 Alex Christensen <achristensen@webkit.org>
+
+ Modernize Geolocation code
+ https://bugs.webkit.org/show_bug.cgi?id=176496
+
+ Reviewed by Andy Estes.
+
+ Making the GeolocationPermissionRequestManager take a reference instead of a pointer
+ spilled into making the other supplement constructors do the same.
+
+ * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
+ (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
+ (WebKit::LegacyCustomProtocolManager::startLoading):
+ (WebKit::LegacyCustomProtocolManager::stopLoading):
+ * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
+ * NetworkProcess/NetworkProcess.h:
+ (WebKit::NetworkProcess::addSupplement):
+ * Shared/Authentication/AuthenticationManager.cpp:
+ (WebKit::AuthenticationManager::AuthenticationManager):
+ (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+ * Shared/Authentication/AuthenticationManager.h:
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::decidePolicyForGeolocationPermissionRequest):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
+ * WebProcess/Cookies/WebCookieManager.cpp:
+ (WebKit::WebCookieManager::WebCookieManager):
+ (WebKit::WebCookieManager::getHostnamesWithCookies):
+ (WebKit::WebCookieManager::deleteCookie):
+ (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
+ (WebKit::WebCookieManager::getAllCookies):
+ (WebKit::WebCookieManager::getCookies):
+ (WebKit::WebCookieManager::setCookie):
+ (WebKit::WebCookieManager::setCookies):
+ (WebKit::WebCookieManager::notifyCookiesDidChange):
+ (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
+ (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
+ * WebProcess/Cookies/WebCookieManager.h:
+ * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
+ (WebKit::GeolocationPermissionRequestManager::GeolocationPermissionRequestManager):
+ (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
+ (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
+ * WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
+ * WebProcess/Geolocation/WebGeolocationManager.cpp:
+ (WebKit::WebGeolocationManager::WebGeolocationManager):
+ (WebKit::WebGeolocationManager::registerWebPage):
+ (WebKit::WebGeolocationManager::unregisterWebPage):
+ (WebKit::WebGeolocationManager::setEnableHighAccuracyForPage):
+ (WebKit::WebGeolocationManager::didChangePosition):
+ (WebKit::WebGeolocationManager::didFailToDeterminePosition):
+ (WebKit::WebGeolocationManager::resetPermissions):
+ * WebProcess/Geolocation/WebGeolocationManager.h:
+ * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
+ (WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager):
+ * WebProcess/Notifications/WebNotificationManager.cpp:
+ (WebKit::WebNotificationManager::WebNotificationManager):
+ (WebKit::WebNotificationManager::show):
+ (WebKit::WebNotificationManager::cancel):
+ (WebKit::WebNotificationManager::clearNotifications):
+ (WebKit::WebNotificationManager::didDestroyNotification):
+ * WebProcess/Notifications/WebNotificationManager.h:
+ * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
+ (WebKit::WebGeolocationClient::requestPermission):
+ (WebKit::WebGeolocationClient::cancelPermissionRequest):
+ * WebProcess/WebCoreSupport/WebGeolocationClient.h:
+ (WebKit::WebGeolocationClient::WebGeolocationClient):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_cpuLimit):
+ * WebProcess/WebProcess.h:
+ (WebKit::WebProcess::addSupplement):
+ * WebProcess/cocoa/UserMediaCaptureManager.cpp:
+ (WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
+ * WebProcess/cocoa/UserMediaCaptureManager.h:
+
2017-09-06 Alex Christensen <achristensen@webkit.org>
Add WKUIDelegatePrivate equivalent of WKPageUIClient's pageDidScroll
return "LegacyCustomProtocolManager";
}
-LegacyCustomProtocolManager::LegacyCustomProtocolManager(ChildProcess* childProcess)
+LegacyCustomProtocolManager::LegacyCustomProtocolManager(ChildProcess& childProcess)
: m_childProcess(childProcess)
{
- m_childProcess->addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this);
+ m_childProcess.addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this);
}
void LegacyCustomProtocolManager::initialize(const NetworkProcessCreationParameters& parameters)
void LegacyCustomProtocolManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request)
{
- m_childProcess->send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request));
+ m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request));
}
void LegacyCustomProtocolManager::stopLoading(uint64_t customProtocolID)
{
- m_childProcess->send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0);
+ m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0);
}
} // namespace WebKit
class LegacyCustomProtocolManager : public NetworkProcessSupplement, public IPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(LegacyCustomProtocolManager);
public:
- explicit LegacyCustomProtocolManager(ChildProcess*);
+ explicit LegacyCustomProtocolManager(ChildProcess&);
static const char* supplementName();
void registerProtocolClass();
- ChildProcess* m_childProcess;
+ ChildProcess& m_childProcess;
typedef HashMap<uint64_t, CustomProtocol> CustomProtocolMap;
CustomProtocolMap m_customProtocolMap;
template <typename T>
void addSupplement()
{
- m_supplements.add(T::supplementName(), std::make_unique<T>(this));
+ m_supplements.add(T::supplementName(), std::make_unique<T>(*this));
}
void removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess*);
return "AuthenticationManager";
}
-AuthenticationManager::AuthenticationManager(ChildProcess* process)
+AuthenticationManager::AuthenticationManager(ChildProcess& process)
: m_process(process)
{
- m_process->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this);
+ m_process.addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this);
}
uint64_t AuthenticationManager::addChallengeToChallengeMap(Challenge&& challenge)
if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
return;
- m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
+ m_process.send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
}
#if USE(NETWORK_SESSION)
if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
return;
- m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
+ m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
}
void AuthenticationManager::didReceiveAuthenticationChallenge(PendingDownload& pendingDownload, const WebCore::AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler&& completionHandler)
if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
return;
- m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
+ m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
}
#endif
class AuthenticationManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(AuthenticationManager);
public:
- explicit AuthenticationManager(ChildProcess*);
+ explicit AuthenticationManager(ChildProcess&);
static const char* supplementName();
Vector<uint64_t> coalesceChallengesMatching(uint64_t challengeID) const;
- ChildProcess* m_process;
+ ChildProcess& m_process;
HashMap<uint64_t, Challenge> m_challenges;
};
}
virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::SecurityOriginData&, OpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; }
- virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, SecurityOrigin*, WebKit::GeolocationPermissionRequestProxy*) { return false; }
+ virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, WebKit::GeolocationPermissionRequestProxy&) { return false; }
virtual bool decidePolicyForUserMediaPermissionRequest(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionRequestProxy&) { return false; }
virtual bool checkUserMediaPermissionForOrigin(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, SecurityOrigin&, SecurityOrigin&, WebKit::UserMediaPermissionCheckProxy&) { return false; }
virtual bool decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy*, SecurityOrigin*, WebKit::NotificationPermissionRequest*) { return false; }
return true;
}
- bool decidePolicyForGeolocationPermissionRequest(WebPageProxy* page, WebFrameProxy* frame, API::SecurityOrigin* origin, GeolocationPermissionRequestProxy* permissionRequest) final
+ bool decidePolicyForGeolocationPermissionRequest(WebPageProxy& page, WebFrameProxy& frame, API::SecurityOrigin& origin, GeolocationPermissionRequestProxy& permissionRequest) final
{
if (!m_client.decidePolicyForGeolocationPermissionRequest)
return false;
- m_client.decidePolicyForGeolocationPermissionRequest(toAPI(page), toAPI(frame), toAPI(origin), toAPI(permissionRequest), m_client.base.clientInfo);
+ m_client.decidePolicyForGeolocationPermissionRequest(toAPI(&page), toAPI(&frame), toAPI(&origin), toAPI(&permissionRequest), m_client.base.clientInfo);
return true;
}
return true;
}
- bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, GeolocationPermissionRequestProxy* permissionRequest) override
+ bool decidePolicyForGeolocationPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, GeolocationPermissionRequestProxy& permissionRequest) final
{
- GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(permissionRequest));
+ GRefPtr<WebKitGeolocationPermissionRequest> geolocationPermissionRequest = adoptGRef(webkitGeolocationPermissionRequestCreate(&permissionRequest));
webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get()));
return true;
}
MESSAGE_CHECK(frame);
// FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
- RefPtr<API::SecurityOrigin> origin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin());
- RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
+ auto origin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(originIdentifier)->securityOrigin());
+ auto request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
- if (m_uiClient->decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
+ if (m_uiClient->decidePolicyForGeolocationPermissionRequest(*this, *frame, origin.get(), request.get()))
return;
- if (m_pageClient.decidePolicyForGeolocationPermissionRequest(*frame, *origin, *request))
+ if (m_pageClient.decidePolicyForGeolocationPermissionRequest(*frame, origin.get(), request.get()))
return;
request->deny();
return "WebCookieManager";
}
-WebCookieManager::WebCookieManager(ChildProcess* process)
+WebCookieManager::WebCookieManager(ChildProcess& process)
: m_process(process)
{
- m_process->addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this);
+ m_process.addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this);
}
void WebCookieManager::getHostnamesWithCookies(PAL::SessionID sessionID, CallbackID callbackID)
Vector<String> hostnameList;
copyToVector(hostnames, hostnameList);
- m_process->send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);
}
void WebCookieManager::deleteCookiesForHostname(PAL::SessionID sessionID, const String& hostname)
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
storageSession->deleteCookie(cookie);
- m_process->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
}
void WebCookieManager::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, std::chrono::system_clock::time_point time, CallbackID callbackID)
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
- m_process->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
}
void WebCookieManager::getAllCookies(PAL::SessionID sessionID, CallbackID callbackID)
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
cookies = storageSession->getAllCookies();
- m_process->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
}
void WebCookieManager::getCookies(PAL::SessionID sessionID, const URL& url, CallbackID callbackID)
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
cookies = storageSession->getCookies(url);
- m_process->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
}
void WebCookieManager::setCookie(PAL::SessionID sessionID, const Cookie& cookie, CallbackID callbackID)
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
storageSession->setCookie(cookie);
- m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
}
void WebCookieManager::setCookies(PAL::SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL, CallbackID callbackID)
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
storageSession->setCookies(cookies, url, mainDocumentURL);
- m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
}
void WebCookieManager::notifyCookiesDidChange(PAL::SessionID sessionID)
{
ASSERT(RunLoop::isMain());
- m_process->send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);
}
void WebCookieManager::startObservingCookieChanges(PAL::SessionID sessionID)
platformSetHTTPCookieAcceptPolicy(policy);
if (callbackID)
- m_process->send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0);
}
void WebCookieManager::getHTTPCookieAcceptPolicy(CallbackID callbackID)
{
- m_process->send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
}
} // namespace WebKit
class WebCookieManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(WebCookieManager);
public:
- WebCookieManager(ChildProcess*);
+ WebCookieManager(ChildProcess&);
static const char* supplementName();
void startObservingCookieChanges(PAL::SessionID);
void stopObservingCookieChanges(PAL::SessionID);
- ChildProcess* m_process;
+ ChildProcess& m_process;
};
} // namespace WebKit
return uniqueGeolocationID++;
}
-GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage* page)
+GeolocationPermissionRequestManager::GeolocationPermissionRequestManager(WebPage& page)
: m_page(page)
{
}
-void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation* geolocation)
+void GeolocationPermissionRequestManager::startRequestForGeolocation(Geolocation& geolocation)
{
- Frame* frame = geolocation->frame();
+ Frame* frame = geolocation.frame();
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.");
if (!frame) {
- geolocation->setIsAllowed(false);
+ geolocation.setIsAllowed(false);
return;
}
uint64_t geolocationID = generateGeolocationID();
- m_geolocationToIDMap.set(geolocation, geolocationID);
- m_idToGeolocationMap.set(geolocationID, geolocation);
+ m_geolocationToIDMap.set(&geolocation, geolocationID);
+ m_idToGeolocationMap.set(geolocationID, &geolocation);
WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
ASSERT(webFrame);
SecurityOrigin& origin = frame->document()->securityOrigin();
- m_page->send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier()));
+ m_page.send(Messages::WebPageProxy::RequestGeolocationPermissionForFrame(geolocationID, webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier()));
}
-void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation* geolocation)
+void GeolocationPermissionRequestManager::cancelRequestForGeolocation(Geolocation& geolocation)
{
- uint64_t geolocationID = m_geolocationToIDMap.take(geolocation);
+ uint64_t geolocationID = m_geolocationToIDMap.take(&geolocation);
if (!geolocationID)
return;
m_idToGeolocationMap.remove(geolocationID);
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GeolocationPermissionRequestManager_h
-#define GeolocationPermissionRequestManager_h
+#pragma once
#include <wtf/HashMap.h>
#include <wtf/RefPtr.h>
class GeolocationPermissionRequestManager {
public:
- explicit GeolocationPermissionRequestManager(WebPage*);
+ explicit GeolocationPermissionRequestManager(WebPage&);
- void startRequestForGeolocation(WebCore::Geolocation*);
- void cancelRequestForGeolocation(WebCore::Geolocation*);
+ void startRequestForGeolocation(WebCore::Geolocation&);
+ void cancelRequestForGeolocation(WebCore::Geolocation&);
void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
IDToGeolocationMap m_idToGeolocationMap;
GeolocationToIDMap m_geolocationToIDMap;
- WebPage* m_page;
+ WebPage& m_page;
};
} // namespace WebKit
-
-#endif // GeolocationPermissionRequestManager_h
return "WebGeolocationManager";
}
-WebGeolocationManager::WebGeolocationManager(WebProcess* process)
+WebGeolocationManager::WebGeolocationManager(WebProcess& process)
: m_process(process)
{
- m_process->addMessageReceiver(Messages::WebGeolocationManager::messageReceiverName(), *this);
+ m_process.addMessageReceiver(Messages::WebGeolocationManager::messageReceiverName(), *this);
}
-void WebGeolocationManager::registerWebPage(WebPage* page)
+void WebGeolocationManager::registerWebPage(WebPage& page)
{
bool wasUpdating = isUpdating();
- m_pageSet.add(page);
+ m_pageSet.add(&page);
if (!wasUpdating)
- m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StartUpdating(), 0);
+ m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StartUpdating(), 0);
}
-void WebGeolocationManager::unregisterWebPage(WebPage* page)
+void WebGeolocationManager::unregisterWebPage(WebPage& page)
{
bool highAccuracyWasEnabled = isHighAccuracyEnabled();
- m_pageSet.remove(page);
- m_highAccuracyPageSet.remove(page);
+ m_pageSet.remove(&page);
+ m_highAccuracyPageSet.remove(&page);
if (!isUpdating())
- m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0);
+ m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0);
else {
bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled)
- m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
+ m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
}
}
-void WebGeolocationManager::setEnableHighAccuracyForPage(WebPage* page, bool enabled)
+void WebGeolocationManager::setEnableHighAccuracyForPage(WebPage& page, bool enabled)
{
bool highAccuracyWasEnabled = isHighAccuracyEnabled();
if (enabled)
- m_highAccuracyPageSet.add(page);
+ m_highAccuracyPageSet.add(&page);
else
- m_highAccuracyPageSet.remove(page);
+ m_highAccuracyPageSet.remove(&page);
bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled)
- m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
+ m_process.parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
}
void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data& data)
Vector<RefPtr<WebPage>> webPageCopy;
copyToVector(m_pageSet, webPageCopy);
- for (size_t i = 0; i < webPageCopy.size(); ++i) {
- WebPage* page = webPageCopy[i].get();
+ for (auto& page : webPageCopy) {
if (page->corePage())
GeolocationController::from(page->corePage())->positionChanged(position.get());
}
{
#if ENABLE(GEOLOCATION)
// FIXME: Add localized error string.
- RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
+ auto error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
Vector<RefPtr<WebPage>> webPageCopy;
copyToVector(m_pageSet, webPageCopy);
- for (size_t i = 0; i < webPageCopy.size(); ++i) {
- WebPage* page = webPageCopy[i].get();
+ for (auto& page : webPageCopy) {
if (page->corePage())
GeolocationController::from(page->corePage())->errorOccurred(error.get());
}
#if PLATFORM(IOS)
void WebGeolocationManager::resetPermissions()
{
- m_process->resetAllGeolocationPermissions();
+ m_process.resetAllGeolocationPermissions();
}
#endif // PLATFORM(IOS)
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebGeolocationManager_h
-#define WebGeolocationManager_h
+#pragma once
#include "MessageReceiver.h"
#include "WebGeolocationPosition.h"
class WebGeolocationManager : public WebProcessSupplement, public IPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(WebGeolocationManager);
public:
- explicit WebGeolocationManager(WebProcess*);
+ explicit WebGeolocationManager(WebProcess&);
static const char* supplementName();
- void registerWebPage(WebPage*);
- void unregisterWebPage(WebPage*);
- void setEnableHighAccuracyForPage(WebPage*, bool);
+ void registerWebPage(WebPage&);
+ void unregisterWebPage(WebPage&);
+ void setEnableHighAccuracyForPage(WebPage&, bool);
- void requestPermission(WebCore::Geolocation*);
+ void requestPermission(WebCore::Geolocation&);
private:
// IPC::MessageReceiver
void resetPermissions();
#endif // PLATFORM(IOS)
- WebProcess* m_process;
+ WebProcess& m_process;
HashSet<WebPage*> m_pageSet;
HashSet<WebPage*> m_highAccuracyPageSet;
};
} // namespace WebKit
-
-#endif // WebGeolocationManager_h
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebMediaKeyStorageManager_h
-#define WebMediaKeyStorageManager_h
+#pragma once
#include "WebProcessSupplement.h"
#include <wtf/Noncopyable.h>
class WebMediaKeyStorageManager : public WebProcessSupplement {
WTF_MAKE_NONCOPYABLE(WebMediaKeyStorageManager);
public:
- explicit WebMediaKeyStorageManager(WebProcess*) { }
+ explicit WebMediaKeyStorageManager(WebProcess&) { }
virtual ~WebMediaKeyStorageManager() { }
static const char* supplementName();
};
}
-
-#endif
return "WebNotificationManager";
}
-WebNotificationManager::WebNotificationManager(WebProcess* process)
+WebNotificationManager::WebNotificationManager(WebProcess& process)
: m_process(process)
{
#if ENABLE(NOTIFICATIONS)
- m_process->addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), *this);
+ m_process.addMessageReceiver(Messages::WebNotificationManager::messageReceiverName(), *this);
#endif
}
auto it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<uint64_t>()).iterator;
it->value.append(notificationID);
- 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());
+ 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());
return true;
#else
UNUSED_PARAM(notification);
if (!notificationID)
return;
- m_process->parentProcessConnection()->send(Messages::WebPageProxy::CancelNotification(notificationID), page->pageID());
+ m_process.parentProcessConnection()->send(Messages::WebPageProxy::CancelNotification(notificationID), page->pageID());
#else
UNUSED_PARAM(notification);
UNUSED_PARAM(page);
return;
Vector<uint64_t>& notificationIDs = it->value;
- m_process->parentProcessConnection()->send(Messages::WebPageProxy::ClearNotifications(notificationIDs), page->pageID());
+ m_process.parentProcessConnection()->send(Messages::WebPageProxy::ClearNotifications(notificationIDs), page->pageID());
size_t count = notificationIDs.size();
for (size_t i = 0; i < count; ++i) {
RefPtr<Notification> notification = m_notificationIDMap.take(notificationIDs[i]);
m_notificationIDMap.remove(notificationID);
removeNotificationFromContextMap(notificationID, notification);
- m_process->parentProcessConnection()->send(Messages::WebPageProxy::DidDestroyNotification(notificationID), page->pageID());
+ m_process.parentProcessConnection()->send(Messages::WebPageProxy::DidDestroyNotification(notificationID), page->pageID());
#else
UNUSED_PARAM(notification);
UNUSED_PARAM(page);
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebNotificationManager_h
-#define WebNotificationManager_h
+#pragma once
#include "MessageReceiver.h"
#include "WebProcessSupplement.h"
class WebNotificationManager : public WebProcessSupplement, public IPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(WebNotificationManager);
public:
- explicit WebNotificationManager(WebProcess*);
+ explicit WebNotificationManager(WebProcess&);
~WebNotificationManager();
static const char* supplementName();
void removeNotificationFromContextMap(uint64_t notificationID, WebCore::Notification*);
#endif
- WebProcess* m_process;
+ WebProcess& m_process;
#if ENABLE(NOTIFICATIONS)
typedef HashMap<RefPtr<WebCore::Notification>, uint64_t> NotificationMap;
};
} // namespace WebKit
-
-#endif
return 0;
}
-void WebGeolocationClient::requestPermission(Geolocation* geolocation)
+void WebGeolocationClient::requestPermission(Geolocation& geolocation)
{
- m_page->geolocationPermissionRequestManager().startRequestForGeolocation(geolocation);
+ m_page.geolocationPermissionRequestManager().startRequestForGeolocation(geolocation);
}
-void WebGeolocationClient::cancelPermissionRequest(Geolocation* geolocation)
+void WebGeolocationClient::cancelPermissionRequest(Geolocation& geolocation)
{
- m_page->geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation);
+ m_page.geolocationPermissionRequestManager().cancelRequestForGeolocation(geolocation);
}
} // namespace WebKit
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebGeolocationClient_h
-#define WebGeolocationClient_h
+#pragma once
#include <WebCore/GeolocationClient.h>
class WebGeolocationClient : public WebCore::GeolocationClient {
public:
- WebGeolocationClient(WebPage* page)
+ WebGeolocationClient(WebPage& page)
: m_page(page)
{
}
WebCore::GeolocationPosition* lastPosition() override;
- void requestPermission(WebCore::Geolocation*) override;
- void cancelPermissionRequest(WebCore::Geolocation*) override;
+ void requestPermission(WebCore::Geolocation&) override;
+ void cancelPermissionRequest(WebCore::Geolocation&) override;
-
- WebPage* m_page;
+ WebPage& m_page;
};
} // namespace WebKit
-
-#endif // WebGeolocationClient_h
, m_findController(makeUniqueRef<FindController>(this))
, m_userContentController(WebUserContentController::getOrCreate(parameters.userContentControllerID))
#if ENABLE(GEOLOCATION)
- , m_geolocationPermissionRequestManager(makeUniqueRef<GeolocationPermissionRequestManager>(this))
+ , m_geolocationPermissionRequestManager(makeUniqueRef<GeolocationPermissionRequestManager>(*this))
#endif
#if ENABLE(MEDIA_STREAM)
, m_userMediaPermissionRequestManager { std::make_unique<UserMediaPermissionRequestManager>(*this) }
m_drawingArea->updatePreferences(parameters.store);
#if ENABLE(GEOLOCATION)
- WebCore::provideGeolocationTo(m_page.get(), new WebGeolocationClient(this));
+ WebCore::provideGeolocationTo(m_page.get(), *new WebGeolocationClient(*this));
#endif
#if ENABLE(NOTIFICATIONS)
WebCore::provideNotification(m_page.get(), new WebNotificationClient(this));
template <typename T>
void addSupplement()
{
- m_supplements.add(T::supplementName(), std::make_unique<T>(this));
+ m_supplements.add(T::supplementName(), std::make_unique<T>(*this));
}
WebConnectionToUIProcess* webConnectionToUIProcess() const { return m_webConnection.get(); }
Deque<ApplyConstraintsCallback> m_pendingApplyConstraintsCallbacks;
};
-UserMediaCaptureManager::UserMediaCaptureManager(WebProcess* process)
- : m_process(*process)
+UserMediaCaptureManager::UserMediaCaptureManager(WebProcess& process)
+ : m_process(process)
{
m_process.addMessageReceiver(Messages::UserMediaCaptureManager::messageReceiverName(), *this);
}
class UserMediaCaptureManager : public WebProcessSupplement, public IPC::MessageReceiver, public WebCore::RealtimeMediaSource::AudioCaptureFactory, public WebCore::RealtimeMediaSource::VideoCaptureFactory {
public:
- explicit UserMediaCaptureManager(WebProcess*);
+ explicit UserMediaCaptureManager(WebProcess&);
~UserMediaCaptureManager();
static const char* supplementName();
+2017-09-07 Alex Christensen <achristensen@webkit.org>
+
+ Modernize Geolocation code
+ https://bugs.webkit.org/show_bug.cgi?id=176496
+
+ Reviewed by Andy Estes.
+
+ * WebCoreSupport/WebGeolocationClient.h:
+ * WebCoreSupport/WebGeolocationClient.mm:
+ (WebGeolocationClient::requestPermission):
+ (-[WebGeolocationPolicyListener initWithGeolocation:]):
+ (-[WebGeolocationPolicyListener initWithGeolocation:forWebView:]):
+ (-[WebGeolocationProviderInitializationListener initWithGeolocation:]):
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView _geolocationDidFailWithMessage:]):
+
2017-09-05 Tim Horton <timothy_horton@apple.com>
Remove some unused bits of code and resources
WebCore::GeolocationPosition* lastPosition() override;
- void requestPermission(WebCore::Geolocation*) override;
- void cancelPermissionRequest(WebCore::Geolocation*) override { };
+ void requestPermission(WebCore::Geolocation&) override;
+ void cancelPermissionRequest(WebCore::Geolocation&) override { };
private:
WebView *m_webView;
{
RefPtr<Geolocation> _geolocation;
}
-- (id)initWithGeolocation:(Geolocation*)geolocation;
+- (id)initWithGeolocation:(Geolocation&)geolocation;
@end
#else
@interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
@private
RefPtr<Geolocation> m_geolocation;
}
-- (id)initWithGeolocation:(Geolocation*)geolocation;
+- (id)initWithGeolocation:(Geolocation&)geolocation;
@end
#endif
}
#endif
-void WebGeolocationClient::requestPermission(Geolocation* geolocation)
+void WebGeolocationClient::requestPermission(Geolocation& geolocation)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:);
if (![[m_webView UIDelegate] respondsToSelector:selector]) {
- geolocation->setIsAllowed(false);
+ geolocation.setIsAllowed(false);
return;
}
#if !PLATFORM(IOS)
- Frame *frame = geolocation->frame();
+ Frame *frame = geolocation.frame();
if (!frame) {
- geolocation->setIsAllowed(false);
+ geolocation.setIsAllowed(false);
return;
}
#if !PLATFORM(IOS)
@implementation WebGeolocationPolicyListener
-- (id)initWithGeolocation:(Geolocation*)geolocation
+- (id)initWithGeolocation:(Geolocation&)geolocation
{
if (!(self = [super init]))
return nil;
- _geolocation = geolocation;
+ _geolocation = &geolocation;
return self;
}
@end
@implementation WebGeolocationProviderInitializationListener
-- (id)initWithGeolocation:(Geolocation*)geolocation
+- (id)initWithGeolocation:(Geolocation&)geolocation
{
self = [super init];
if (self)
- m_geolocation = geolocation;
+ m_geolocation = &geolocation;
return self;
}
_private->page->setGroupName(groupName);
#if ENABLE(GEOLOCATION)
- WebCore::provideGeolocationTo(_private->page, new WebGeolocationClient(self));
+ WebCore::provideGeolocationTo(_private->page, *new WebGeolocationClient(self));
#endif
#if ENABLE(NOTIFICATIONS)
WebCore::provideNotification(_private->page, new WebNotificationClient(self));
{
#if ENABLE(GEOLOCATION)
if (_private && _private->page) {
- RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
+ auto geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
WebCore::GeolocationController::from(_private->page)->errorOccurred(geolocatioError.get());
}
#endif // ENABLE(GEOLOCATION)
+2017-09-07 Alex Christensen <achristensen@webkit.org>
+
+ Modernize Geolocation code
+ https://bugs.webkit.org/show_bug.cgi?id=176496
+
+ Reviewed by Andy Estes.
+
+ * WebCoreSupport/WebGeolocationClient.cpp:
+ (WebGeolocationClient::requestPermission):
+ * WebCoreSupport/WebGeolocationClient.h:
+ (WebGeolocationClient::setEnableHighAccuracy): Deleted.
+ (WebGeolocationClient::cancelPermissionRequest): Deleted.
+ * WebGeolocationPolicyListener.h:
+ * WebView.cpp:
+ (WebView::initWithFrame):
+ (WebView::geolocationDidFailWithError):
+
2017-09-07 Per Arne Vollan <pvollan@apple.com>
[Win] Enable DatatransferItems in DRT.
return core(position.get());
}
-void WebGeolocationClient::requestPermission(Geolocation* geolocation)
+void WebGeolocationClient::requestPermission(Geolocation& geolocation)
{
COMPtr<IWebUIDelegate> uiDelegate;
if (FAILED(m_webView->uiDelegate(&uiDelegate))) {
- geolocation->setIsAllowed(false);
+ geolocation.setIsAllowed(false);
return;
}
COMPtr<IWebUIDelegatePrivate2> uiDelegatePrivate2(Query, uiDelegate);
if (!uiDelegatePrivate2) {
- geolocation->setIsAllowed(false);
+ geolocation.setIsAllowed(false);
return;
}
- Frame* frame = geolocation->frame();
+ Frame* frame = geolocation.frame();
COMPtr<WebSecurityOrigin> origin(AdoptCOM, WebSecurityOrigin::createInstance(&frame->document()->securityOrigin()));
- COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance(geolocation);
+ COMPtr<WebGeolocationPolicyListener> listener = WebGeolocationPolicyListener::createInstance(&geolocation);
HRESULT hr = uiDelegatePrivate2->decidePolicyForGeolocationRequest(m_webView.get(), kit(frame), origin.get(), listener.get());
if (hr != E_NOTIMPL)
return;
- geolocation->setIsAllowed(false);
+ geolocation.setIsAllowed(false);
}
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebGeolocationClient_h
-#define WebGeolocationClient_h
+#pragma once
#include <WebCore/COMPtr.h>
#include <WebCore/GeolocationClient.h>
public:
WebGeolocationClient(WebView*);
- virtual void geolocationDestroyed();
- virtual void startUpdating();
- virtual void stopUpdating();
- virtual void setEnableHighAccuracy(bool) { }
- virtual WebCore::GeolocationPosition* lastPosition();
+ void geolocationDestroyed() final;
+ void startUpdating() final;
+ void stopUpdating() final;
+ void setEnableHighAccuracy(bool) final { }
+ WebCore::GeolocationPosition* lastPosition() final;
- virtual void requestPermission(WebCore::Geolocation*);
- virtual void cancelPermissionRequest(WebCore::Geolocation*) { }
+ void requestPermission(WebCore::Geolocation&) final;
+ void cancelPermissionRequest(WebCore::Geolocation&) final { }
private:
COMPtr<WebView> m_webView;
};
-
-#endif // WebGeolocationClient_h
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebGeolocationPolicyListener_h
-#define WebGeolocationPolicyListener_h
+#pragma once
#include "WebKit.h"
#include <WebCore/COMPtr.h>
ULONG m_refCount { 0 };
RefPtr<WebCore::Geolocation> m_geolocation;
};
-
-#endif WebGeolocationPolicyListener_h
configuration.pluginInfoProvider = &WebPluginInfoProvider::singleton();
m_page = new Page(WTFMove(configuration));
- provideGeolocationTo(m_page, new WebGeolocationClient(this));
+ provideGeolocationTo(m_page, *new WebGeolocationClient(this));
unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones));
if (FAILED(error->localizedDescription(&description)))
return E_FAIL;
- RefPtr<GeolocationError> geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, toString(description));
+ auto geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, toString(description));
GeolocationController::from(m_page)->errorOccurred(geolocationError.get());
return S_OK;
}