<!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 <bpoulain@apple.com> 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 <bpoulain@apple.com>
+
+ [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 <bdakin@apple.com>
</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 <Foundation/Foundation.h>
</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 "ViewSnapshotStore.h"
</span><span class="cx"> #import "WKContentView.h"
</span><span class="cx"> #import "WKContentViewInteraction.h"
</span><ins>+#import "WKGeolocationProviderIOS.h"
+#import "WKProcessPoolInternal.h"
</ins><span class="cx"> #import "WKWebViewConfigurationInternal.h"
</span><span class="cx"> #import "WKWebViewContentProviderRegistry.h"
</span><span class="cx"> #import "WKWebViewInternal.h"
</span><span class="lines">@@ -228,7 +230,7 @@
</span><span class="cx">
</span><span class="cx"> bool PageClientImpl::decidePolicyForGeolocationPermissionRequest(WebFrameProxy& frame, WebSecurityOrigin& origin, GeolocationPermissionRequestProxy& request)
</span><span class="cx"> {
</span><del>- [m_contentView _decidePolicyForGeolocationRequestFromOrigin:origin frame:frame request:request];
</del><ins>+ [[wrapper(m_webView->_page->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&)layerTreeTransaction;
</span><span class="cx">
</span><del>-- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebKit::WebSecurityOrigin&)origin frame:(WebKit::WebFrameProxy&)frame request:(WebKit::GeolocationPermissionRequestProxy&)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 "SmartMagnificationController.h"
</span><span class="cx"> #import "WKBrowsingContextControllerInternal.h"
</span><span class="cx"> #import "WKBrowsingContextGroupPrivate.h"
</span><del>-#import "WKGeolocationProviderIOS.h"
</del><span class="cx"> #import "WKInspectorHighlightView.h"
</span><span class="cx"> #import "WKPreferencesInternal.h"
</span><span class="cx"> #import "WKProcessGroupPrivate.h"
</span><del>-#import "WKProcessPoolInternal.h"
</del><span class="cx"> #import "WKWebViewConfiguration.h"
</span><span class="cx"> #import "WKWebViewInternal.h"
</span><span class="cx"> #import "WebContext.h"
</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&)origin frame:(WebFrameProxy&)frame request:(GeolocationPermissionRequestProxy&)permissionRequest
-{
- [[wrapper(_page->process().context()) _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&origin) frame:toAPI(&frame) request:toAPI(&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 <WebKit/WKBase.h>
</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&)origin frame:(WebKit::WebFrameProxy&)frame request:(WebKit::GeolocationPermissionRequestProxy&)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 "GeolocationPermissionRequestProxy.h"
</span><ins>+#import "WKUIDelegatePrivate.h"
+#import "WKWebView.h"
</ins><span class="cx"> #import "WebContext.h"
</span><span class="cx"> #import "WebGeolocationManagerProxy.h"
</span><span class="cx"> #import "WebSecurityOrigin.h"
</span><span class="cx"> #import <WebGeolocationPosition.h>
</span><span class="cx"> #import <WebCore/GeolocationPosition.h>
</span><del>-#import <WebKit/WKGeolocationPermissionRequest.h>
</del><ins>+#import <WebCore/URL.h>
</ins><span class="cx"> #import <wtf/Assertions.h>
</span><span class="cx"> #import <wtf/PassRefPtr.h>
</span><span class="cx"> #import <wtf/RefPtr.h>
</span><span class="lines">@@ -45,6 +47,7 @@
</span><span class="cx"> #import <WebKit/WebGeolocationCoreLocationProvider.h>
</span><span class="cx"> #import <WebKit/WebAllowDenyPolicyListener.h>
</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& urlString, id<WebAllowDenyPolicyListener>, UIWindow*);
</del><ins>+void decidePolicyForGeolocationRequestFromOrigin(SecurityOrigin*, const String& urlString, id<WebAllowDenyPolicyListener>, UIWindow*);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct GeolocationRequestData {
</span><del>- RefPtr<WebCore::SecurityOrigin> origin;
</del><ins>+ RefPtr<SecurityOrigin> origin;
</ins><span class="cx"> RefPtr<WebFrameProxy> frame;
</span><span class="cx"> RefPtr<GeolocationPermissionRequestProxy> permissionRequest;
</span><del>- RetainPtr<UIWindow> window;
</del><ins>+ RetainPtr<WKWebView> 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&)origin frame:(WebFrameProxy&)frame request:(GeolocationPermissionRequestProxy&)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<WebCore::SecurityOrigin*>(&toImpl(origin)->securityOrigin());
- geolocationRequestData.frame = toImpl(frame);
- geolocationRequestData.permissionRequest = toImpl(permissionRequest);
- geolocationRequestData.window = window;
</del><ins>+ geolocationRequestData.origin = &origin;
+ geolocationRequestData.frame = &frame;
+ geolocationRequestData.permissionRequest = &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<GeolocationRequestData> requests = WTF::move(_requestsWaitingForCoreLocationAuthorization);
</span><span class="cx"> for (const auto& request : requests) {
</span><del>- RetainPtr<WKWebAllowDenyPolicyListener> policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithPermissionRequestProxy:request.permissionRequest.get()]);
- decidePolicyForGeolocationRequestFromOrigin(request.origin.get(), request.frame->url(), policyListener.get(), request.window.get());
</del><ins>+ bool requiresUserAuthorization = true;
+
+ id<WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([request.view UIDelegate]);
+ if ([uiDelegate respondsToSelector:@selector(_webView:shouldRequestGeolocationAuthorizationForURL:isMainFrame:mainFrameURL:)]) {
+ const WebFrameProxy* mainFrame = request.frame->page()->mainFrame();
+ bool isMainFrame = request.frame == mainFrame;
+ URL requestFrameURL(URL(), request.frame->url());
+ URL mainFrameURL(URL(), mainFrame->url());
+ requiresUserAuthorization = [uiDelegate _webView:request.view.get()
+ shouldRequestGeolocationAuthorizationForURL:requestFrameURL
+ isMainFrame:isMainFrame
+ mainFrameURL:mainFrameURL];
+ }
+
+ if (requiresUserAuthorization) {
+ RetainPtr<WKWebAllowDenyPolicyListener> policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithPermissionRequestProxy:request.permissionRequest.get()]);
+ decidePolicyForGeolocationRequestFromOrigin(request.origin.get(), request.frame->url(), policyListener.get(), [request.view window]);
+ } else
+ request.permissionRequest->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->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->timestamp(), position->latitude(), position->longitude(), position->accuracy(), position->canProvideAltitude(), position->altitude(), position->canProvideAltitudeAccuracy(), position->altitudeAccuracy(), position->canProvideHeading(), position->heading(), position->canProvideSpeed(), position->speed());
</span><span class="cx"> _geolocationManager->providerDidChangePosition(_lastActivePosition.get());
</span></span></pre>
</div>
</div>
</body>
</html>