<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173019] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173019">173019</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-08-27 14:48:02 -0700 (Wed, 27 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Provide a delegate callback to skip Geolocation authorization per page for WebApp
https://bugs.webkit.org/show_bug.cgi?id=136243

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2014-08-27
Reviewed by Sam Weinig.

Just ask the UI if the authorization dialog needs to be skipped.

* UIProcess/API/Cocoa/WKUIDelegate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):

* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]): Deleted.
The code in WKContentView only exists due to legacy. Instead, the PageClient dispatch the request
to the GeolocationProvider directly.

* UIProcess/ios/WKGeolocationProviderIOS.h:
* UIProcess/ios/WKGeolocationProviderIOS.mm:
(-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:request:view:]):
(-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
(-[WKGeolocationProviderIOS positionChanged:]):
(-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:request:window:]): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUIDelegateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewh">trunk/Source/WebKit2/UIProcess/ios/WKContentView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKGeolocationProviderIOSh">trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKGeolocationProviderIOSmm">trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/ChangeLog        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-08-27  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS WK2] Provide a delegate callback to skip Geolocation authorization per page for WebApp
+        https://bugs.webkit.org/show_bug.cgi?id=136243
+
+        Reviewed by Sam Weinig.
+
+        Just ask the UI if the authorization dialog needs to be skipped.
+
+        * UIProcess/API/Cocoa/WKUIDelegate.h:
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
+
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]): Deleted.
+        The code in WKContentView only exists due to legacy. Instead, the PageClient dispatch the request
+        to the GeolocationProvider directly.
+
+        * UIProcess/ios/WKGeolocationProviderIOS.h:
+        * UIProcess/ios/WKGeolocationProviderIOS.mm:
+        (-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:request:view:]):
+        (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
+        (-[WKGeolocationProviderIOS positionChanged:]):
+        (-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:request:window:]): Deleted.
+
</ins><span class="cx"> 2014-08-27  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         overflow:scroll elements should not latch to the body if the body is 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUIDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegate.h        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import &lt;Foundation/Foundation.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @class WKFrameInfo;
</span><ins>+@class WKNavigationAction;
</ins><span class="cx"> @class WKWebViewConfiguration;
</span><span class="cx"> @class WKWindowFeatures;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> - (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray *)defaultActions;
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didNotHandleTapAsClickAtPoint:(CGPoint)point;
</span><span class="cx"> - (void)_webView:(WKWebView *)webView usesMinimalUI:(BOOL)wantMinimalUI;
</span><ins>+- (bool)_webView:(WKWebView *)webView shouldRequestGeolocationAuthorizationForURL:(NSURL *)url isMainFrame:(BOOL)isMainFrame mainFrameURL:(NSURL *)mainFrameURL;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -38,6 +38,8 @@
</span><span class="cx"> #import &quot;ViewSnapshotStore.h&quot;
</span><span class="cx"> #import &quot;WKContentView.h&quot;
</span><span class="cx"> #import &quot;WKContentViewInteraction.h&quot;
</span><ins>+#import &quot;WKGeolocationProviderIOS.h&quot;
+#import &quot;WKProcessPoolInternal.h&quot;
</ins><span class="cx"> #import &quot;WKWebViewConfigurationInternal.h&quot;
</span><span class="cx"> #import &quot;WKWebViewContentProviderRegistry.h&quot;
</span><span class="cx"> #import &quot;WKWebViewInternal.h&quot;
</span><span class="lines">@@ -228,7 +230,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool PageClientImpl::decidePolicyForGeolocationPermissionRequest(WebFrameProxy&amp; frame, WebSecurityOrigin&amp; origin, GeolocationPermissionRequestProxy&amp; request)
</span><span class="cx"> {
</span><del>-    [m_contentView _decidePolicyForGeolocationRequestFromOrigin:origin frame:frame request:request];
</del><ins>+    [[wrapper(m_webView-&gt;_page-&gt;process().context()) _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:origin.securityOrigin() frame:frame request:request view:m_webView];
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -85,8 +85,6 @@
</span><span class="cx"> - (void)_didCommitLoadForMainFrame;
</span><span class="cx"> - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction;
</span><span class="cx"> 
</span><del>-- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebKit::WebSecurityOrigin&amp;)origin frame:(WebKit::WebFrameProxy&amp;)frame request:(WebKit::GeolocationPermissionRequestProxy&amp;)permissionRequest;
-
</del><span class="cx"> - (void)_setAccessibilityWebProcessToken:(NSData *)data;
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)_scrollToRect:(CGRect)targetRect withOrigin:(CGPoint)origin minimumScrollDistance:(CGFloat)minimumScrollDistance;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -34,11 +34,9 @@
</span><span class="cx"> #import &quot;SmartMagnificationController.h&quot;
</span><span class="cx"> #import &quot;WKBrowsingContextControllerInternal.h&quot;
</span><span class="cx"> #import &quot;WKBrowsingContextGroupPrivate.h&quot;
</span><del>-#import &quot;WKGeolocationProviderIOS.h&quot;
</del><span class="cx"> #import &quot;WKInspectorHighlightView.h&quot;
</span><span class="cx"> #import &quot;WKPreferencesInternal.h&quot;
</span><span class="cx"> #import &quot;WKProcessGroupPrivate.h&quot;
</span><del>-#import &quot;WKProcessPoolInternal.h&quot;
</del><span class="cx"> #import &quot;WKWebViewConfiguration.h&quot;
</span><span class="cx"> #import &quot;WKWebViewInternal.h&quot;
</span><span class="cx"> #import &quot;WebContext.h&quot;
</span><span class="lines">@@ -473,11 +471,6 @@
</span><span class="cx">     [_rootContentView addSubview:rootView];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin&amp;)origin frame:(WebFrameProxy&amp;)frame request:(GeolocationPermissionRequestProxy&amp;)permissionRequest
-{
-    [[wrapper(_page-&gt;process().context()) _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&amp;origin) frame:toAPI(&amp;frame) request:toAPI(&amp;permissionRequest) window:[self window]];
-}
-
</del><span class="cx"> - (BOOL)_scrollToRect:(CGRect)targetRect withOrigin:(CGPoint)origin minimumScrollDistance:(CGFloat)minimumScrollDistance
</span><span class="cx"> {
</span><span class="cx">     return [_webView _scrollToRect:targetRect origin:origin minimumScrollDistance:minimumScrollDistance];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKGeolocationProviderIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.h (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.h        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.h        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,14 +29,20 @@
</span><span class="cx"> #import &lt;WebKit/WKBase.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><ins>+class GeolocationPermissionRequestProxy;
</ins><span class="cx"> class WebContext;
</span><ins>+class WebFrameProxy;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-@class UIWindow;
</del><ins>+namespace WebCore {
+class SecurityOrigin;
+}
</ins><span class="cx"> 
</span><ins>+@class WKWebView;
+
</ins><span class="cx"> @interface WKGeolocationProviderIOS : NSObject
</span><span class="cx"> -(id)initWithContext:(WebKit::WebContext*)context;
</span><del>--(void)decidePolicyForGeolocationRequestFromOrigin:(WKSecurityOriginRef)origin frame:(WKFrameRef)frame request:(WKGeolocationPermissionRequestRef)permissionRequest window:(UIWindow*)window;
</del><ins>+-(void)decidePolicyForGeolocationRequestFromOrigin:(WebCore::SecurityOrigin&amp;)origin frame:(WebKit::WebFrameProxy&amp;)frame request:(WebKit::GeolocationPermissionRequestProxy&amp;)permissionRequest view:(WKWebView*)view;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKGeolocationProviderIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm (173018 => 173019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm        2014-08-27 21:30:55 UTC (rev 173018)
+++ trunk/Source/WebKit2/UIProcess/ios/WKGeolocationProviderIOS.mm        2014-08-27 21:48:02 UTC (rev 173019)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,12 +29,14 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;GeolocationPermissionRequestProxy.h&quot;
</span><ins>+#import &quot;WKUIDelegatePrivate.h&quot;
+#import &quot;WKWebView.h&quot;
</ins><span class="cx"> #import &quot;WebContext.h&quot;
</span><span class="cx"> #import &quot;WebGeolocationManagerProxy.h&quot;
</span><span class="cx"> #import &quot;WebSecurityOrigin.h&quot;
</span><span class="cx"> #import &lt;WebGeolocationPosition.h&gt;
</span><span class="cx"> #import &lt;WebCore/GeolocationPosition.h&gt;
</span><del>-#import &lt;WebKit/WKGeolocationPermissionRequest.h&gt;
</del><ins>+#import &lt;WebCore/URL.h&gt;
</ins><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #import &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #import &lt;wtf/RefPtr.h&gt;
</span><span class="lines">@@ -45,6 +47,7 @@
</span><span class="cx"> #import &lt;WebKit/WebGeolocationCoreLocationProvider.h&gt;
</span><span class="cx"> #import &lt;WebKit/WebAllowDenyPolicyListener.h&gt;
</span><span class="cx"> 
</span><ins>+using namespace WebCore;
</ins><span class="cx"> using namespace WebKit;
</span><span class="cx"> 
</span><span class="cx"> #pragma clang diagnostic push
</span><span class="lines">@@ -59,14 +62,14 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><del>-void decidePolicyForGeolocationRequestFromOrigin(WebCore::SecurityOrigin*, const String&amp; urlString, id&lt;WebAllowDenyPolicyListener&gt;, UIWindow*);
</del><ins>+void decidePolicyForGeolocationRequestFromOrigin(SecurityOrigin*, const String&amp; urlString, id&lt;WebAllowDenyPolicyListener&gt;, UIWindow*);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct GeolocationRequestData {
</span><del>-    RefPtr&lt;WebCore::SecurityOrigin&gt; origin;
</del><ins>+    RefPtr&lt;SecurityOrigin&gt; origin;
</ins><span class="cx">     RefPtr&lt;WebFrameProxy&gt; frame;
</span><span class="cx">     RefPtr&lt;GeolocationPermissionRequestProxy&gt; permissionRequest;
</span><del>-    RetainPtr&lt;UIWindow&gt; window;
</del><ins>+    RetainPtr&lt;WKWebView&gt; view;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> @implementation WKGeolocationProviderIOS {
</span><span class="lines">@@ -150,14 +153,14 @@
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>--(void)decidePolicyForGeolocationRequestFromOrigin:(WKSecurityOriginRef)origin frame:(WKFrameRef)frame request:(WKGeolocationPermissionRequestRef)permissionRequest window:(UIWindow*)window
</del><ins>+-(void)decidePolicyForGeolocationRequestFromOrigin:(SecurityOrigin&amp;)origin frame:(WebFrameProxy&amp;)frame request:(GeolocationPermissionRequestProxy&amp;)permissionRequest view:(WKWebView*)contentView
</ins><span class="cx"> {
</span><span class="cx">     // Step 1: ask the user if the app can use Geolocation.
</span><span class="cx">     GeolocationRequestData geolocationRequestData;
</span><del>-    geolocationRequestData.origin = const_cast&lt;WebCore::SecurityOrigin*&gt;(&amp;toImpl(origin)-&gt;securityOrigin());
-    geolocationRequestData.frame = toImpl(frame);
-    geolocationRequestData.permissionRequest = toImpl(permissionRequest);
-    geolocationRequestData.window = window;
</del><ins>+    geolocationRequestData.origin = &amp;origin;
+    geolocationRequestData.frame = &amp;frame;
+    geolocationRequestData.permissionRequest = &amp;permissionRequest;
+    geolocationRequestData.view = contentView;
</ins><span class="cx">     _requestsWaitingForCoreLocationAuthorization.append(geolocationRequestData);
</span><span class="cx">     [_coreLocationProvider requestGeolocationAuthorization];
</span><span class="cx"> }
</span><span class="lines">@@ -172,8 +175,25 @@
</span><span class="cx">     // Step 2: ask the user if the this particular page can use gelocation.
</span><span class="cx">     Vector&lt;GeolocationRequestData&gt; requests = WTF::move(_requestsWaitingForCoreLocationAuthorization);
</span><span class="cx">     for (const auto&amp; request : requests) {
</span><del>-        RetainPtr&lt;WKWebAllowDenyPolicyListener&gt; policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithPermissionRequestProxy:request.permissionRequest.get()]);
-        decidePolicyForGeolocationRequestFromOrigin(request.origin.get(), request.frame-&gt;url(), policyListener.get(), request.window.get());
</del><ins>+        bool requiresUserAuthorization = true;
+
+        id&lt;WKUIDelegatePrivate&gt; uiDelegate = static_cast&lt;id &lt;WKUIDelegatePrivate&gt;&gt;([request.view UIDelegate]);
+        if ([uiDelegate respondsToSelector:@selector(_webView:shouldRequestGeolocationAuthorizationForURL:isMainFrame:mainFrameURL:)]) {
+            const WebFrameProxy* mainFrame = request.frame-&gt;page()-&gt;mainFrame();
+            bool isMainFrame = request.frame == mainFrame;
+            URL requestFrameURL(URL(), request.frame-&gt;url());
+            URL mainFrameURL(URL(), mainFrame-&gt;url());
+            requiresUserAuthorization = [uiDelegate _webView:request.view.get()
+                 shouldRequestGeolocationAuthorizationForURL:requestFrameURL
+                                                 isMainFrame:isMainFrame
+                                                mainFrameURL:mainFrameURL];
+        }
+
+        if (requiresUserAuthorization) {
+            RetainPtr&lt;WKWebAllowDenyPolicyListener&gt; policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithPermissionRequestProxy:request.permissionRequest.get()]);
+            decidePolicyForGeolocationRequestFromOrigin(request.origin.get(), request.frame-&gt;url(), policyListener.get(), [request.view window]);
+        } else
+            request.permissionRequest-&gt;allow();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -184,7 +204,7 @@
</span><span class="cx">         requestData.permissionRequest-&gt;deny();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)positionChanged:(WebCore::GeolocationPosition*)position
</del><ins>+- (void)positionChanged:(GeolocationPosition*)position
</ins><span class="cx"> {
</span><span class="cx">     _lastActivePosition = WebGeolocationPosition::create(position-&gt;timestamp(), position-&gt;latitude(), position-&gt;longitude(), position-&gt;accuracy(), position-&gt;canProvideAltitude(), position-&gt;altitude(), position-&gt;canProvideAltitudeAccuracy(), position-&gt;altitudeAccuracy(), position-&gt;canProvideHeading(), position-&gt;heading(), position-&gt;canProvideSpeed(), position-&gt;speed());
</span><span class="cx">     _geolocationManager-&gt;providerDidChangePosition(_lastActivePosition.get());
</span></span></pre>
</div>
</div>

</body>
</html>