[Webkit-unassigned] [Bug 170362] Add SPI for handling geolocation authorization requests

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 31 15:03:39 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=170362

--- Comment #3 from David Quesada <david_quesada at apple.com> ---
Comment on attachment 306015
  --> https://bugs.webkit.org/attachment.cgi?id=306015
Patch

>commit 8d19071e1f4ffcbe354b901238e104b85728994a
>Author: David Quesada <david_quesada at apple.com>
>Date:   Fri Mar 31 14:53:01 2017 -0700
>
>    Add SPI for handling geolocation authorization requests
>    https://bugs.webkit.org/show_bug.cgi?id=170362
>    rdar://problem/17508627
>    
>    Reviewed by NOBODY (OOPS!).
>    
>    * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
>    * UIProcess/ios/WKGeolocationProviderIOS.mm:
>    (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
>
>diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
>index 9ca40daa58b..5b969402e17 100644
>--- a/Source/WebKit2/ChangeLog
>+++ b/Source/WebKit2/ChangeLog
>@@ -1,3 +1,15 @@
>+2017-03-31  David Quesada  <david_quesada at apple.com>
>+
>+        Add SPI for handling geolocation authorization requests
>+        https://bugs.webkit.org/show_bug.cgi?id=170362
>+        rdar://problem/17508627
>+
>+        Reviewed by NOBODY (OOPS!).
>+
>+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
>+        * UIProcess/ios/WKGeolocationProviderIOS.mm:
>+        (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
>+
> 2017-03-31  Csaba Osztrogonác  <ossy at webkit.org>
> 
>         Mac cmake buildfix after r214403
>diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h b/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
>index 05a1096fb8c..4e3614eaa69 100644
>--- a/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
>+++ b/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
>@@ -35,6 +35,7 @@
> @class UIItemProvider;
> @class UIScrollView;
> @class UIViewController;
>+ at class WKFrameInfo;
> @class _WKContextMenuElementInfo;
> @class _WKActivatedElementInfo;
> @class _WKElementAction;
>@@ -72,6 +73,7 @@ struct UIEdgeInsets;
> - (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray<_WKElementAction *> *)defaultActions;
> - (void)_webView:(WKWebView *)webView didNotHandleTapAsClickAtPoint:(CGPoint)point;
> - (BOOL)_webView:(WKWebView *)webView shouldRequestGeolocationAuthorizationForURL:(NSURL *)url isMainFrame:(BOOL)isMainFrame mainFrameURL:(NSURL *)mainFrameURL;
>+- (void)_webView:(WKWebView *)webView requestGeolocationAuthorizationForURL:(NSURL *)url frame:(WKFrameInfo *)frame decisionHandler:(void (^)(BOOL authorized))decisionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
> - (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url WK_API_AVAILABLE(ios(9.0));
> - (void)_webView:(WKWebView *)webView commitPreviewedViewController:(UIViewController *)previewedViewController WK_API_AVAILABLE(ios(9.0));
> - (void)_webView:(WKWebView *)webView willPreviewImageWithURL:(NSURL *)imageURL WK_API_AVAILABLE(ios(9.0));
>diff --git a/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm b/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm
>index 24781044816..839939d4c5a 100644
>--- a/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm
>+++ b/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm
>@@ -28,8 +28,11 @@
> 
> #if PLATFORM(IOS)
> 
>+#import "APIFrameInfo.h"
> #import "APISecurityOrigin.h"
>+#import "CompletionHandlerCallChecker.h"
> #import "GeolocationPermissionRequestProxy.h"
>+#import "WKFrameInfoInternal.h"
> #import "WKUIDelegatePrivate.h"
> #import "WKWebView.h"
> #import "WebGeolocationManagerProxy.h"
>@@ -38,6 +41,7 @@
> #import <WebCore/URL.h>
> #import <WebGeolocationPosition.h>
> #import <wtf/Assertions.h>
>+#import <wtf/BlockPtr.h>
> #import <wtf/HashSet.h>
> #import <wtf/PassRefPtr.h>
> #import <wtf/RefPtr.h>
>@@ -177,6 +181,22 @@ - (void)geolocationAuthorizationGranted
>         bool requiresUserAuthorization = true;
> 
>         id<WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([request.view UIDelegate]);
>+        if ([uiDelegate respondsToSelector:@selector(_webView:requestGeolocationAuthorizationForURL:frame:decisionHandler:)]) {
>+            URL requestFrameURL(URL(), request.frame->url());
>+            RetainPtr<WKFrameInfo> frameInfo = wrapper(API::FrameInfo::create(*request.frame.get(), *request.origin.get()));
>+            RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(uiDelegate, @selector(_webView:requestGeolocationAuthorizationForURL:frame:decisionHandler:));
>+            [uiDelegate _webView:request.view.get() requestGeolocationAuthorizationForURL:requestFrameURL frame:frameInfo.get() decisionHandler:BlockPtr<void(BOOL)>::fromCallable([request, checker = WTFMove(checker)](BOOL authorized) {
>+                if (checker->completionHandlerHasBeenCalled())
>+                    return;
>+                if (authorized)
>+                    request.permissionRequest->allow();
>+                else
>+                    request.permissionRequest->deny();
>+                checker->didCallCompletionHandler();
>+            }).get()];
>+            return;
>+        }
>+
>         if ([uiDelegate respondsToSelector:@selector(_webView:shouldRequestGeolocationAuthorizationForURL:isMainFrame:mainFrameURL:)]) {
>             const WebFrameProxy* mainFrame = request.frame->page()->mainFrame();
>             bool isMainFrame = request.frame == mainFrame;

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170331/66b5b262/attachment.html>


More information about the webkit-unassigned mailing list