<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add SPI for handling geolocation authorization requests"
   href="https://bugs.webkit.org/show_bug.cgi?id=170362#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add SPI for handling geolocation authorization requests"
   href="https://bugs.webkit.org/show_bug.cgi?id=170362">bug 170362</a>
              from <span class="vcard"><a class="email" href="mailto:david_quesada&#64;apple.com" title="David Quesada &lt;david_quesada&#64;apple.com&gt;"> <span class="fn">David Quesada</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=306015&amp;action=diff" name="attach_306015" title="Patch">attachment 306015</a> <a href="attachment.cgi?id=306015&amp;action=edit" title="Patch">[details]</a></span>
Patch

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


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>