Changeset 242678 in webkit
- Timestamp:
- Mar 9, 2019, 8:34:19 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
UIProcess/WebPageProxy.h (modified) (1 diff)
-
UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
WebProcess/WebPage/WebPage.h (modified) (2 diffs)
-
WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r242675 r242678 1 2019-03-09 Chris Dumez <cdumez@apple.com> 2 3 Use modern async IPC with reply for device orientation permission 4 https://bugs.webkit.org/show_bug.cgi?id=195529 5 6 Reviewed by Ryosuke Niwa. 7 8 * UIProcess/WebPageProxy.cpp: 9 (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess): 10 * UIProcess/WebPageProxy.h: 11 * UIProcess/WebPageProxy.messages.in: 12 * WebProcess/WebPage/WebPage.cpp: 13 (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess): 14 (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted. 15 (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted. 16 * WebProcess/WebPage/WebPage.h: 17 * WebProcess/WebPage/WebPage.messages.in: 18 1 19 2019-03-09 Zalan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r242664 r242678 7176 7176 7177 7177 #if ENABLE(DEVICE_ORIENTATION) 7178 void WebPageProxy::requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&& originData, uint64_t callbackID)7178 void WebPageProxy::requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&& originData, CompletionHandler<void(bool)>&& completionHandler) 7179 7179 { 7180 7180 auto origin = API::SecurityOrigin::create(originData.securityOrigin()); 7181 m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, origin.get(), [this, weakThis = makeWeakPtr(*this), callbackID](bool granted) { 7182 if (!weakThis || !isValid()) 7183 return; 7184 m_process->send(Messages::WebPage::DidReceiveDeviceOrientationAndMotionAccessDecision(callbackID, granted), m_pageID); 7185 }); 7181 m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, origin.get(), WTFMove(completionHandler)); 7186 7182 } 7187 7183 #endif -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r242664 r242678 1403 1403 1404 1404 #if ENABLE(DEVICE_ORIENTATION) 1405 void requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&&, uint64_t callbackID);1405 void requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&&, CompletionHandler<void(bool)>&&); 1406 1406 #endif 1407 1407 -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r242664 r242678 535 535 536 536 #if ENABLE(DEVICE_ORIENTATION) 537 RequestDeviceOrientationAndMotionAccess(struct WebCore::SecurityOriginData origin , uint64_t callbackID);537 RequestDeviceOrientationAndMotionAccess(struct WebCore::SecurityOriginData origin) -> (bool granted) Async 538 538 #endif 539 539 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r242664 r242678 6342 6342 6343 6343 #if ENABLE(DEVICE_ORIENTATION) 6344 static uint64_t nextDeviceOrientationAndMotionPermissionCallbackID() 6345 { 6346 static uint64_t nextCallbackID = 0; 6347 return ++nextCallbackID; 6348 } 6349 6350 void WebPage::shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin& origin, CompletionHandler<void(bool)>&& callback) 6351 { 6352 auto callbackID = nextDeviceOrientationAndMotionPermissionCallbackID(); 6353 ASSERT(!m_deviceOrientationAndMotionPermissionCallbackMap.contains(callbackID)); 6354 m_deviceOrientationAndMotionPermissionCallbackMap.add(callbackID, WTFMove(callback)); 6355 6356 send(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(origin.data(), callbackID)); 6357 } 6358 6359 void WebPage::didReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted) 6360 { 6361 auto callback = m_deviceOrientationAndMotionPermissionCallbackMap.take(callbackID); 6362 ASSERT(callback); 6363 callback(granted); 6344 void WebPage::shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin& origin, CompletionHandler<void(bool)>&& completionHandler) 6345 { 6346 sendWithAsyncReply(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(origin.data()), WTFMove(completionHandler)); 6364 6347 } 6365 6348 #endif -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r242664 r242678 1211 1211 #endif 1212 1212 1213 #if ENABLE(DEVICE_ORIENTATION)1214 void didReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted);1215 #endif1216 1217 1213 #if !PLATFORM(COCOA) && !PLATFORM(WPE) 1218 1214 static const char* interpretKeyEvent(const WebCore::KeyboardEvent*); … … 1845 1841 HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap; 1846 1842 1847 #if ENABLE(DEVICE_ORIENTATION)1848 HashMap<uint64_t, WTF::CompletionHandler<void(bool granted)>> m_deviceOrientationAndMotionPermissionCallbackMap;1849 #endif1850 1851 1843 #if ENABLE(APPLICATION_MANIFEST) 1852 1844 HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r242664 r242678 364 364 DidReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed) 365 365 366 #if ENABLE(DEVICE_ORIENTATION)367 DidReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted)368 #endif369 370 366 # Printing. 371 367 BeginPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo)
Note:
See TracChangeset
for help on using the changeset viewer.