<!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>[159833] 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/159833">159833</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2013-11-27 20:34:08 -0800 (Wed, 27 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Give the PageClient a chance to handle geolocation permission requests if the UIClient doesn't handle it
https://bugs.webkit.org/show_bug.cgi?id=124955
Reviewed by Dan Bernstein.
Use the new PageClient function to remove the need for WKContentView to take over the WKPageUIClient.
* UIProcess/API/ios/PageClientImplIOS.h:
* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
(-[WKContentView _commonInitWithProcessGroup:browsingContextGroup:]):
* UIProcess/API/ios/WKContentViewInternal.h:
* UIProcess/PageClient.h:
(WebKit::PageClient::decidePolicyForGeolocationPermissionRequest):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestGeolocationPermissionForFrame):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKContentViewInternalh">trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (159832 => 159833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-11-28 03:23:48 UTC (rev 159832)
+++ trunk/Source/WebKit2/ChangeLog        2013-11-28 04:34:08 UTC (rev 159833)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2013-11-27 Sam Weinig <sam@webkit.org>
</span><span class="cx">
</span><ins>+ Give the PageClient a chance to handle geolocation permission requests if the UIClient doesn't handle it
+ https://bugs.webkit.org/show_bug.cgi?id=124955
+
+ Reviewed by Dan Bernstein.
+
+ Use the new PageClient function to remove the need for WKContentView to take over the WKPageUIClient.
+
+ * UIProcess/API/ios/PageClientImplIOS.h:
+ * UIProcess/API/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
+ * UIProcess/API/ios/WKContentView.mm:
+ (-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
+ (-[WKContentView _commonInitWithProcessGroup:browsingContextGroup:]):
+ * UIProcess/API/ios/WKContentViewInternal.h:
+ * UIProcess/PageClient.h:
+ (WebKit::PageClient::decidePolicyForGeolocationPermissionRequest):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
+
+2013-11-27 Sam Weinig <sam@webkit.org>
+
</ins><span class="cx"> Fix the iOS build.
</span><span class="cx">
</span><span class="cx"> * UIProcess/API/ios/WKGeolocationProviderIOS.mm:
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h (159832 => 159833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h        2013-11-28 03:23:48 UTC (rev 159832)
+++ trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h        2013-11-28 04:34:08 UTC (rev 159833)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> virtual void pageClosed() OVERRIDE;
</span><span class="cx"> virtual void preferencesDidChange() OVERRIDE;
</span><span class="cx"> virtual void toolTipChanged(const String&, const String&) OVERRIDE;
</span><ins>+ virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&, WebSecurityOrigin&, GeolocationPermissionRequestProxy&) OVERRIDE;
</ins><span class="cx"> virtual void didChangeContentSize(const WebCore::IntSize&) OVERRIDE;
</span><span class="cx"> virtual void setCursor(const WebCore::Cursor&) OVERRIDE;
</span><span class="cx"> virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm (159832 => 159833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm        2013-11-28 03:23:48 UTC (rev 159832)
+++ trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm        2013-11-28 04:34:08 UTC (rev 159833)
</span><span class="lines">@@ -144,6 +144,12 @@
</span><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool PageClientImpl::decidePolicyForGeolocationPermissionRequest(WebFrameProxy& frame, WebSecurityOrigin& origin, GeolocationPermissionRequestProxy& request)
+{
+ [m_view _decidePolicyForGeolocationRequestFromOrigin:origin frame:frame request:request];
+ return true;
+}
+
</ins><span class="cx"> void PageClientImpl::didChangeContentSize(const IntSize& contentsSize)
</span><span class="cx"> {
</span><span class="cx"> [m_view _didChangeContentSize:contentsSize];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm (159832 => 159833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm        2013-11-28 03:23:48 UTC (rev 159832)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm        2013-11-28 04:34:08 UTC (rev 159833)
</span><span class="lines">@@ -33,9 +33,10 @@
</span><span class="cx"> #import "WKBrowsingContextControllerInternal.h"
</span><span class="cx"> #import "WKBrowsingContextGroupPrivate.h"
</span><span class="cx"> #import "WKGeolocationProviderIOS.h"
</span><del>-#import "WKProcessGroupPrivate.h"
</del><span class="cx"> #import "WKInteractionView.h"
</span><ins>+#import "WKProcessGroupPrivate.h"
</ins><span class="cx"> #import "WebContext.h"
</span><ins>+#import "WebFrameProxy.h"
</ins><span class="cx"> #import "WebPageGroup.h"
</span><span class="cx"> #import "WebSystemInterface.h"
</span><span class="cx"> #import <QuartzCore/CALayerHost.h>
</span><span class="lines">@@ -147,12 +148,9 @@
</span><span class="cx"> _page->didFinishZooming(scale);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void decidePolicyForGeolocationPermissionRequest(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo)
</del><ins>+- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin&)origin frame:(WebFrameProxy&)frame request:(GeolocationPermissionRequestProxy&)permissionRequest
</ins><span class="cx"> {
</span><del>- WKContentView *view = reinterpret_cast<WKContentView *>(const_cast<void*>(clientInfo));
- ASSERT([view isKindOfClass:[WKContentView class]]);
-
- [[view->_processGroup _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:origin frame:frame request:permissionRequest window:[view window]];
</del><ins>+ [[_processGroup _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&origin) frame:toAPI(&frame) request:toAPI(&permissionRequest) window:[self window]];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_commonInitWithProcessGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
</span><span class="lines">@@ -174,58 +172,6 @@
</span><span class="cx"> _page->setIntrinsicDeviceScaleFactor([UIScreen mainScreen].scale);
</span><span class="cx"> _page->setUseFixedLayout(true);
</span><span class="cx">
</span><del>- WKPageUIClient pageUIClient = {
- kWKPageUIClientCurrentVersion,
- self,
- 0, // createNewPage_deprecatedForUseWithV0
- 0, // showPage
- 0, // closeOtherPage
- 0, // takeFocus
- 0, // focus
- 0, // unfocus
- 0, // runJavaScriptAlert
- 0, // runJavaScriptConfirm
- 0, // runJavaScriptPrompt
- 0, // setStatusText
- 0, // mouseDidMoveOverElement_deprecatedForUseWithV0
- 0, // missingPluginButtonClicked
- 0, // didNotHandleKeyEvent
- 0, // didNotHandleWheelEvent
- 0, // toolbarsAreVisible
- 0, // setToolbarsAreVisible
- 0, // menuBarIsVisible
- 0, // setMenuBarIsVisible
- 0, // statusBarIsVisible
- 0, // setStatusBarIsVisible
- 0, // isResizable
- 0, // setIsResizable
- 0, // getWindowFrameOtherPage
- 0, // setWindowFrameOtherPage
- 0, // runBeforeUnloadConfirmPanel
- 0, // didDraw
- 0, // pageDidScroll
- 0, // exceededDatabaseQuota
- 0, // runOpenPanel
- decidePolicyForGeolocationPermissionRequest,
- 0, // headerHeight
- 0, // footerHeight
- 0, // drawHeader
- 0, // drawFooter
- 0, // printFrame
- 0, // runModal
- 0, // didCompleteRubberBandForMainFrame
- 0, // saveDataToFileInDownloadsFolder
- 0, // shouldInterruptJavaScript
- 0, // createOtherPage
- 0, // mouseDidMoveOverElement
- 0, // decidePolicyForNotificationPermissionRequest
- 0, // unavailablePluginButtonClicked
- 0, // showColorPicker
- 0, // hideColorPicker
- 0, // unavailablePluginButtonClicked
- };
- WKPageSetPageUIClient(toAPI(_page.get()), &pageUIClient);
-
</del><span class="cx"> _browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:toAPI(_page.get())]);
</span><span class="cx"> [_browsingContextController setLoadDelegateInternal:self];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKContentViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h (159832 => 159833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h        2013-11-28 03:23:48 UTC (rev 159832)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h        2013-11-28 04:34:08 UTC (rev 159833)
</span><span class="lines">@@ -37,7 +37,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> class DrawingAreaProxy;
</span><ins>+class GeolocationPermissionRequestProxy;
</ins><span class="cx"> class LayerTreeContext;
</span><ins>+class WebFrameProxy;
+class WebSecurityOrigin;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @class WebIOSEvent;
</span><span class="lines">@@ -60,4 +63,6 @@
</span><span class="cx"> - (BOOL)_interpretKeyEvent:(WebIOSEvent *)theEvent isCharEvent:(BOOL)isCharEvent;
</span><span class="cx"> - (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)viewportArguments;
</span><span class="cx">
</span><ins>+- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebKit::WebSecurityOrigin&)origin frame:(WebKit::WebFrameProxy&)frame request:(WebKit::GeolocationPermissionRequestProxy&)permissionRequest;
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (159832 => 159833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2013-11-28 03:23:48 UTC (rev 159832)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2013-11-28 04:34:08 UTC (rev 159833)
</span><span class="lines">@@ -120,6 +120,11 @@
</span><span class="cx">
</span><span class="cx"> virtual void toolTipChanged(const String&, const String&) = 0;
</span><span class="cx">
</span><ins>+ virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&, WebSecurityOrigin&, GeolocationPermissionRequestProxy&)
+ {
+ return false;
+ }
+
</ins><span class="cx"> #if USE(TILED_BACKING_STORE)
</span><span class="cx"> virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
</span><span class="cx"> virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (159832 => 159833)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2013-11-28 03:23:48 UTC (rev 159832)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2013-11-28 04:34:08 UTC (rev 159833)
</span><span class="lines">@@ -3931,8 +3931,13 @@
</span><span class="cx"> RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
</span><span class="cx"> RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
</span><span class="cx">
</span><del>- if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
- request->deny();
</del><ins>+ if (m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
+ return;
+
+ if (m_pageClient->decidePolicyForGeolocationPermissionRequest(*frame, *origin, *request))
+ return;
+
+ request->deny();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String& originString)
</span></span></pre>
</div>
</div>
</body>
</html>