<!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>[182648] trunk/Source</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/182648">182648</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2015-04-10 18:45:04 -0700 (Fri, 10 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Allow LaunchServices to handle URLs on link navigations
<rdar://problem/19446826>
https://bugs.webkit.org/show_bug.cgi?id=143544
Reviewed by Anders Carlsson.
Source/WebCore:
* WebCore.xcodeproj/project.pbxproj:
* platform/spi/ios/LaunchServicesSPI.h: Added.
Add new SPI header.
Source/WebKit/mac:
* Configurations/WebKitLegacy.xcconfig:
Link MobileCoreServices.
* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(shouldTryAppLink):
(WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
(WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
(WebFrameLoaderClient::setUpPolicyListener):
Only let LaunchServices have a crack at the URL if the navigation is:
1) a main frame navigation
2) a result of a user gesture
Source/WebKit2:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::tryAppLink):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
Only let LaunchServices have a crack at the URL if the navigation is:
1) a main frame navigation
2) a result of a user gesture
Source/WTF:
* wtf/Platform.h:
Add HAVE macro for this functionality.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacConfigurationsWebKitLegacyxcconfig">trunk/Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaNavigationStatemm">trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformspiiosLaunchServicesSPIh">trunk/Source/WebCore/platform/spi/ios/LaunchServicesSPI.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WTF/ChangeLog        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-04-08 Sam Weinig <sam@webkit.org>
+
+ Allow LaunchServices to handle URLs on link navigations
+ <rdar://problem/19446826>
+ https://bugs.webkit.org/show_bug.cgi?id=143544
+
+ Reviewed by Anders Carlsson.
+
+ * wtf/Platform.h:
+ Add HAVE macro for this functionality.
+
</ins><span class="cx"> 2015-04-09 Andy Estes <aestes@apple.com>
</span><span class="cx">
</span><span class="cx"> [Cocoa] Add a HAVE(AVKIT) and use it
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WTF/wtf/Platform.h        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -538,6 +538,10 @@
</span><span class="cx"> #define WTF_USE_WEB_THREAD 1
</span><span class="cx"> #define WTF_USE_QUICK_LOOK 1
</span><span class="cx">
</span><ins>+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000
+#define HAVE_APP_LINKS 1
+#endif
+
</ins><span class="cx"> #if CPU(ARM64)
</span><span class="cx"> #define ENABLE_JIT_CONSTANT_BLINDING 0
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebCore/ChangeLog        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-04-08 Sam Weinig <sam@webkit.org>
+
+ Allow LaunchServices to handle URLs on link navigations
+ <rdar://problem/19446826>
+ https://bugs.webkit.org/show_bug.cgi?id=143544
+
+ Reviewed by Anders Carlsson.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/spi/ios/LaunchServicesSPI.h: Added.
+ Add new SPI header.
+
</ins><span class="cx"> 2015-04-10 Bem Jones-Bey <bjonesbe@adobe.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, added CSS Shapes to features.json file.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -2508,6 +2508,7 @@
</span><span class="cx">                 7C4C96DD1AD4483500365A50 /* JSReadableStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96D91AD4483500365A50 /* JSReadableStream.h */; };
</span><span class="cx">                 7C4C96DE1AD4483500365A50 /* JSReadableStreamReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */; };
</span><span class="cx">                 7C4C96DF1AD4483500365A50 /* JSReadableStreamReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */; };
</span><ins>+                7C4C96E31AD44ABF00365A50 /* LaunchServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96E21AD44ABF00365A50 /* LaunchServicesSPI.h */; };
</ins><span class="cx">                 7C4EDD741A7B607800198C4D /* FontCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C4EDD731A7B607800198C4D /* FontCocoa.mm */; };
</span><span class="cx">                 7C522D4B15B477E8009B7C95 /* InspectorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */; };
</span><span class="cx">                 7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */; };
</span><span class="lines">@@ -5853,7 +5854,7 @@
</span><span class="cx">                 CE12523B1A16711000864480 /* NSFileManagerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE12523A1A16711000864480 /* NSFileManagerSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CE12523D1A1676CD00864480 /* QuartzCoreSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE12523C1A1676CD00864480 /* QuartzCoreSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CE1252411A16B1B600864480 /* MediaPlayerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1252401A16B1B600864480 /* MediaPlayerSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                CE1252431A16C01A00864480 /* CoreUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1252421A16C01A00864480 /* CoreUISPI.h */; };
</del><ins>+                CE1252431A16C01A00864480 /* CoreUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1252421A16C01A00864480 /* CoreUISPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 CE1252451A16C22500864480 /* DynamicLinkerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1252441A16C22500864480 /* DynamicLinkerSPI.h */; };
</span><span class="cx">                 CE1252471A16C2C200864480 /* NSPointerFunctionsSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1252461A16C2C200864480 /* NSPointerFunctionsSPI.h */; };
</span><span class="cx">                 CE1252491A16C3BC00864480 /* MobileGestaltSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1252481A16C3BC00864480 /* MobileGestaltSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -9759,6 +9760,7 @@
</span><span class="cx">                 7C4C96D91AD4483500365A50 /* JSReadableStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStream.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamReader.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStreamReader.h; sourceTree = "<group>"; };
</span><ins>+                7C4C96E21AD44ABF00365A50 /* LaunchServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LaunchServicesSPI.h; path = ios/LaunchServicesSPI.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7C4EDD731A7B607800198C4D /* FontCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FontCocoa.mm; sourceTree = "<group>"; };
</span><span class="cx">                 7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorOverlay.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C522D4A15B478B2009B7C95 /* InspectorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorOverlay.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -18731,10 +18733,11 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 CE1252421A16C01A00864480 /* CoreUISPI.h */,
</span><span class="cx">                                 CEC337AE1A46086D009B8523 /* GraphicsServicesSPI.h */,
</span><ins>+                                7C4C96E21AD44ABF00365A50 /* LaunchServicesSPI.h */,
+                                CE1252401A16B1B600864480 /* MediaPlayerSPI.h */,
</ins><span class="cx">                                 CE1252481A16C3BC00864480 /* MobileGestaltSPI.h */,
</span><del>-                                CE1252401A16B1B600864480 /* MediaPlayerSPI.h */,
</del><ins>+                                6FAD4A561A9D0FAE009F7D3C /* OpenGLESSPI.h */,
</ins><span class="cx">                                 CE1252381A166FA000864480 /* QuickLookSPI.h */,
</span><del>-                                6FAD4A561A9D0FAE009F7D3C /* OpenGLESSPI.h */,
</del><span class="cx">                         );
</span><span class="cx">                         name = ios;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -25478,6 +25481,7 @@
</span><span class="cx">                                 B2FA3DCF0AB75A6F000E5AC4 /* JSSVGPathSegLinetoAbs.h in Headers */,
</span><span class="cx">                                 B2FA3DD10AB75A6F000E5AC4 /* JSSVGPathSegLinetoHorizontalAbs.h in Headers */,
</span><span class="cx">                                 B2FA3DD30AB75A6F000E5AC4 /* JSSVGPathSegLinetoHorizontalRel.h in Headers */,
</span><ins>+                                7C4C96E31AD44ABF00365A50 /* LaunchServicesSPI.h in Headers */,
</ins><span class="cx">                                 B2FA3DD50AB75A6F000E5AC4 /* JSSVGPathSegLinetoRel.h in Headers */,
</span><span class="cx">                                 B2FA3DD70AB75A6F000E5AC4 /* JSSVGPathSegLinetoVerticalAbs.h in Headers */,
</span><span class="cx">                                 B2FA3DD90AB75A6F000E5AC4 /* JSSVGPathSegLinetoVerticalRel.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspiiosLaunchServicesSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/spi/ios/LaunchServicesSPI.h (0 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/ios/LaunchServicesSPI.h         (rev 0)
+++ trunk/Source/WebCore/platform/spi/ios/LaunchServicesSPI.h        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LaunchServicesSPI_h
+#define LaunchServicesSPI_h
+
+#import <Foundation/Foundation.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000
+#import <MobileCoreServices/LSAppLinkPriv.h>
+#endif
+
+#endif
+
+typedef void (^LSAppLinkOpenCompletionHandler)(BOOL success, NSError *error);
+
+#if !USE(APPLE_INTERNAL_SDK)
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000
+@interface LSAppLink : NSObject <NSSecureCoding>
+@end
+
+@interface LSAppLink (Details)
++ (void)openWithURL:(NSURL *)aURL completionHandler:(LSAppLinkOpenCompletionHandler)completionHandler;
+@end
+#endif
+
+#endif
+
+#endif // LaunchServicesSPI_h
</ins></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-04-08 Sam Weinig <sam@webkit.org>
+
+ Allow LaunchServices to handle URLs on link navigations
+ <rdar://problem/19446826>
+ https://bugs.webkit.org/show_bug.cgi?id=143544
+
+ Reviewed by Anders Carlsson.
+
+ * Configurations/WebKitLegacy.xcconfig:
+ Link MobileCoreServices.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (shouldTryAppLink):
+ (WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
+ (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+ (WebFrameLoaderClient::setUpPolicyListener):
+ Only let LaunchServices have a crack at the URL if the navigation is:
+ 1) a main frame navigation
+ 2) a result of a user gesture
+
</ins><span class="cx"> 2015-04-10 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Build fix.
</span></span></pre></div>
<a id="trunkSourceWebKitmacConfigurationsWebKitLegacyxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx"> PRODUCT_NAME = WebKitLegacy;
</span><span class="cx"> UMBRELLA_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR)/WebKit.framework/Versions/A/Frameworks;
</span><span class="cx">
</span><del>-OTHER_LDFLAGS[sdk=iphone*] = $(inherited) -lobjc -lsqlite3 -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework OpenGLES -lMobileGestalt;
</del><ins>+OTHER_LDFLAGS[sdk=iphone*] = $(inherited) -lobjc -lsqlite3 -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework OpenGLES -framework MobileCoreServices -lMobileGestalt;
</ins><span class="cx"> OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Carbon -framework Cocoa -framework DiskArbitration -framework IOKit -framework OpenGL;
</span><span class="cx">
</span><span class="cx"> SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(CONFIGURATION));
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -221,7 +221,7 @@
</span><span class="cx">
</span><span class="cx"> virtual RemoteAXObjectRef accessibilityRemoteObject() override { return 0; }
</span><span class="cx">
</span><del>- RetainPtr<WebFramePolicyListener> setUpPolicyListener(WebCore::FramePolicyFunction);
</del><ins>+ RetainPtr<WebFramePolicyListener> setUpPolicyListener(WebCore::FramePolicyFunction, NSURL *appLinkURL = nil);
</ins><span class="cx">
</span><span class="cx"> NSDictionary *actionDictionary(const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>) const;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebFrameLoaderClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -151,6 +151,11 @@
</span><span class="cx"> #import <WebCore/RuntimeApplicationChecksIOS.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if HAVE(APP_LINKS)
+#import <WebCore/LaunchServicesSPI.h>
+#import <WebCore/WebCoreThreadRun.h>
+#endif
+
</ins><span class="cx"> #if ENABLE(CONTENT_FILTERING)
</span><span class="cx"> #import <WebCore/PolicyChecker.h>
</span><span class="cx"> #endif
</span><span class="lines">@@ -172,9 +177,16 @@
</span><span class="cx"> @interface WebFramePolicyListener : NSObject <WebPolicyDecisionListener, WebFormSubmissionListener> {
</span><span class="cx"> RefPtr<Frame> _frame;
</span><span class="cx"> FramePolicyFunction _policyFunction;
</span><ins>+#if HAVE(APP_LINKS)
+ RetainPtr<NSURL> _appLinkURL;
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id)initWithFrame:(Frame*)frame policyFunction:(FramePolicyFunction)policyFunction;
</span><ins>+#if HAVE(APP_LINKS)
+- (id)initWithFrame:(Frame*)frame policyFunction:(FramePolicyFunction)policyFunction appLinkURL:(NSURL *)url;
+#endif
+
</ins><span class="cx"> - (void)invalidate;
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -871,24 +883,45 @@
</span><span class="cx"> decisionListener:setUpPolicyListener(WTF::move(function)).get()];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+
+static BOOL shouldTryAppLink(WebView *webView, const NavigationAction& action, Frame* targetFrame)
+{
+#if HAVE(APP_LINKS)
+ BOOL mainFrameNavigation = !targetFrame || targetFrame->isMainFrame();
+ if (!mainFrameNavigation)
+ return NO;
+
+ if (!action.processingUserGesture())
+ return NO;
+
+ return YES;
+#else
+ return NO;
+#endif
+}
+
</ins><span class="cx"> void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName, FramePolicyFunction function)
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+ BOOL tryAppLink = shouldTryAppLink(webView, action, nullptr);
+
</ins><span class="cx"> [[webView _policyDelegateForwarder] webView:webView
</span><span class="cx"> decidePolicyForNewWindowAction:actionDictionary(action, formState)
</span><span class="cx"> request:request.nsURLRequest(UpdateHTTPBody)
</span><span class="cx"> newFrameName:frameName
</span><del>- decisionListener:setUpPolicyListener(WTF::move(function)).get()];
</del><ins>+ decisionListener:setUpPolicyListener(WTF::move(function), tryAppLink ? (NSURL *)request.url() : nil).get()];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState> formState, FramePolicyFunction function)
</span><span class="cx"> {
</span><span class="cx"> WebView *webView = getWebView(m_webFrame.get());
</span><ins>+ BOOL tryAppLink = shouldTryAppLink(webView, action, core(m_webFrame.get()));
+
</ins><span class="cx"> [[webView _policyDelegateForwarder] webView:webView
</span><span class="cx"> decidePolicyForNavigationAction:actionDictionary(action, formState)
</span><span class="cx"> request:request.nsURLRequest(UpdateHTTPBody)
</span><span class="cx"> frame:m_webFrame.get()
</span><del>- decisionListener:setUpPolicyListener(WTF::move(function)).get()];
</del><ins>+ decisionListener:setUpPolicyListener(WTF::move(function), tryAppLink ? (NSURL *)request.url() : nil).get()];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebFrameLoaderClient::cancelPolicyCheck()
</span><span class="lines">@@ -1472,12 +1505,17 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RetainPtr<WebFramePolicyListener> WebFrameLoaderClient::setUpPolicyListener(FramePolicyFunction function)
</del><ins>+RetainPtr<WebFramePolicyListener> WebFrameLoaderClient::setUpPolicyListener(FramePolicyFunction function, NSURL *appLinkURL)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: <rdar://5634381> We need to support multiple active policy listeners.
</span><span class="cx"> [m_policyListener invalidate];
</span><span class="cx">
</span><del>- m_policyListener = adoptNS([[WebFramePolicyListener alloc] initWithFrame:core(m_webFrame.get()) policyFunction:function]);
</del><ins>+#if HAVE(APP_LINKS)
+ if (appLinkURL)
+ m_policyListener = adoptNS([[WebFramePolicyListener alloc] initWithFrame:core(m_webFrame.get()) policyFunction:function appLinkURL:appLinkURL]);
+ else
+#endif
+ m_policyListener = adoptNS([[WebFramePolicyListener alloc] initWithFrame:core(m_webFrame.get()) policyFunction:function]);
</ins><span class="cx">
</span><span class="cx"> return m_policyListener;
</span><span class="cx"> }
</span><span class="lines">@@ -2271,6 +2309,19 @@
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if HAVE(APP_LINKS)
+- (id)initWithFrame:(Frame*)frame policyFunction:(FramePolicyFunction)policyFunction appLinkURL:(NSURL *)appLinkURL
+{
+ self = [self initWithFrame:frame policyFunction:policyFunction];
+ if (!self)
+ return nil;
+
+ _appLinkURL = appLinkURL;
+
+ return self;
+}
+#endif
+
</ins><span class="cx"> - (void)invalidate
</span><span class="cx"> {
</span><span class="cx"> _frame = nullptr;
</span><span class="lines">@@ -2309,6 +2360,20 @@
</span><span class="cx">
</span><span class="cx"> - (void)use
</span><span class="cx"> {
</span><ins>+#if HAVE(APP_LINKS)
+ if (_appLinkURL && _frame) {
+ [LSAppLink openWithURL:_appLinkURL.get() completionHandler:^(BOOL success, NSError *) {
+ WebThreadRun(^{
+ if (success)
+ [self receivedPolicyDecision:PolicyIgnore];
+ else
+ [self receivedPolicyDecision:PolicyUse];
+ });
+ }];
+ return;
+ }
+#endif
+
</ins><span class="cx"> [self receivedPolicyDecision:PolicyUse];
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebKit2/ChangeLog        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-04-08 Sam Weinig <sam@webkit.org>
+
+ Allow LaunchServices to handle URLs on link navigations
+ <rdar://problem/19446826>
+ https://bugs.webkit.org/show_bug.cgi?id=143544
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::tryAppLink):
+ (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+ Only let LaunchServices have a crack at the URL if the navigation is:
+ 1) a main frame navigation
+ 2) a result of a user gesture
+
</ins><span class="cx"> 2015-04-10 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Replace setFixedLayoutSizeEnabled: with an enum of layout modes
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaNavigationStatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (182647 => 182648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2015-04-11 01:00:07 UTC (rev 182647)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2015-04-11 01:45:04 UTC (rev 182648)
</span><span class="lines">@@ -64,6 +64,10 @@
</span><span class="cx"> #import <WebCore/Credential.h>
</span><span class="cx"> #import <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><ins>+#if HAVE(APP_LINKS)
+#import <WebCore/LaunchServicesSPI.h>
+#endif
+
</ins><span class="cx"> #if USE(QUICK_LOOK)
</span><span class="cx"> #import "QuickLookDocumentData.h"
</span><span class="cx"> #endif
</span><span class="lines">@@ -224,28 +228,58 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void tryAppLink(RefPtr<API::NavigationAction> navigationAction, std::function<void (bool)> completionHandler)
+{
+#if HAVE(APP_LINKS)
+ bool mainFrameNavigation = !navigationAction->targetFrame() || navigationAction->targetFrame()->isMainFrame();
+ bool isProcessingUserGesture = navigationAction->isProcessingUserGesture();
+ if (mainFrameNavigation && isProcessingUserGesture) {
+ auto* localCompletionHandler = new std::function<void (bool)>(WTF::move(completionHandler));
+ [LSAppLink openWithURL:navigationAction->request().url() completionHandler:[localCompletionHandler](BOOL success, NSError *) {
+ dispatch_async(dispatch_get_main_queue(), [localCompletionHandler, success] {
+ (*localCompletionHandler)(success);
+ delete localCompletionHandler;
+ });
+ }];
+ return;
+ }
+#endif
+
+ completionHandler(false);
+}
+
</ins><span class="cx"> void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageProxy&, API::NavigationAction& navigationAction, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData)
</span><span class="cx"> {
</span><span class="cx"> if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandler) {
</span><del>- RetainPtr<NSURLRequest> nsURLRequest = adoptNS(wrapper(*API::URLRequest::create(navigationAction.request()).leakRef()));
</del><ins>+ RefPtr<API::NavigationAction> localNavigationAction = &navigationAction;
+ RefPtr<WebFramePolicyListenerProxy> localListener = WTF::move(listener);
</ins><span class="cx">
</span><del>- if (!navigationAction.targetFrame()) {
- listener->use();
- return;
- }
</del><ins>+ tryAppLink(localNavigationAction, [localListener, localNavigationAction] (bool followedLinkToApp) {
+ if (followedLinkToApp) {
+ localListener->ignore();
+ return;
+ }
</ins><span class="cx">
</span><del>- if ([NSURLConnection canHandleRequest:nsURLRequest.get()]) {
- listener->use();
- return;
- }
</del><ins>+ if (!localNavigationAction->targetFrame()) {
+ localListener->use();
+ return;
+ }
</ins><span class="cx">
</span><ins>+ RetainPtr<NSURLRequest> nsURLRequest = adoptNS(wrapper(*API::URLRequest::create(localNavigationAction->request()).leakRef()));
+ if ([NSURLConnection canHandleRequest:nsURLRequest.get()]) {
+ localListener->use();
+ return;
+ }
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><del>- // A file URL shouldn't fall through to here, but if it did,
- // it would be a security risk to open it.
- if (![[nsURLRequest URL] isFileURL])
- [[NSWorkspace sharedWorkspace] openURL:[nsURLRequest URL]];
</del><ins>+ // A file URL shouldn't fall through to here, but if it did,
+ // it would be a security risk to open it.
+ if (![[nsURLRequest URL] isFileURL])
+ [[NSWorkspace sharedWorkspace] openURL:[nsURLRequest URL]];
</ins><span class="cx"> #endif
</span><del>- listener->ignore();
</del><ins>+ localListener->ignore();
+ });
+
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -253,14 +287,23 @@
</span><span class="cx"> if (!navigationDelegate)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ RefPtr<API::NavigationAction> localNavigationAction = &navigationAction;
</ins><span class="cx"> RefPtr<WebFramePolicyListenerProxy> localListener = WTF::move(listener);
</span><span class="cx"> RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:decidePolicyForNavigationAction:decisionHandler:));
</span><del>- [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:wrapper(navigationAction) decisionHandler:[localListener, checker](WKNavigationActionPolicy actionPolicy) {
</del><ins>+ [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:wrapper(navigationAction) decisionHandler:[localListener, localNavigationAction, checker](WKNavigationActionPolicy actionPolicy) {
</ins><span class="cx"> checker->didCallCompletionHandler();
</span><span class="cx">
</span><span class="cx"> switch (actionPolicy) {
</span><span class="cx"> case WKNavigationActionPolicyAllow:
</span><del>- localListener->use();
</del><ins>+ tryAppLink(localNavigationAction, [localListener](bool followedLinkToApp) {
+ if (followedLinkToApp) {
+ localListener->ignore();
+ return;
+ }
+
+ localListener->use();
+ });
+
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case WKNavigationActionPolicyCancel:
</span></span></pre>
</div>
</div>
</body>
</html>