Changeset 244600 in webkit
- Timestamp:
- Apr 24, 2019 12:07:38 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r244582 r244600 1 2019-04-24 Tim Horton <timothy_horton@apple.com> 2 3 Clean up WKActionSheetAssistant's use of LaunchServices 4 https://bugs.webkit.org/show_bug.cgi?id=194645 5 <rdar://problem/47707952> 6 7 Reviewed by Andy Estes. 8 9 * wtf/Platform.h: 10 1 11 2019-04-24 chris fleizach <cfleizach@apple.com> 2 12 -
trunk/Source/WTF/wtf/Platform.h
r244582 r244600 1525 1525 1526 1526 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) 1527 #define HAVE_APP_LINKS_WITH_ISENABLED 1 1527 1528 #define HAVE_ROUTE_SHARING_POLICY_LONG_FORM_VIDEO 1 1528 1529 #endif -
trunk/Source/WebCore/PAL/ChangeLog
r244567 r244600 1 2019-04-24 Tim Horton <timothy_horton@apple.com> 2 3 Clean up WKActionSheetAssistant's use of LaunchServices 4 https://bugs.webkit.org/show_bug.cgi?id=194645 5 <rdar://problem/47707952> 6 7 Reviewed by Andy Estes. 8 9 * pal/spi/cocoa/LaunchServicesSPI.h: 10 1 11 2019-04-23 Commit Queue <commit-queue@webkit.org> 2 12 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h
r240211 r244600 61 61 62 62 @interface LSAppLink () 63 #if HAVE(APP_LINKS_WITH_ISENABLED) 64 + (NSArray<LSAppLink *> *)appLinksWithURL:(NSURL *)aURL limit:(NSUInteger)limit error:(NSError **)outError; 65 - (void)openWithCompletionHandler:(LSAppLinkOpenCompletionHandler)completionHandler; 66 @property (nonatomic, getter=isEnabled) BOOL enabled; 67 #else 63 68 + (void)getAppLinkWithURL:(NSURL *)aURL completionHandler:(LSAppLinkCompletionHandler)completionHandler; 69 - (void)openInWebBrowser:(BOOL)inWebBrowser setAppropriateOpenStrategyAndWebBrowserState:(NSDictionary<NSString *, id> *)state completionHandler:(LSAppLinkOpenCompletionHandler)completionHandler; 70 #endif 64 71 + (void)openWithURL:(NSURL *)aURL completionHandler:(LSAppLinkOpenCompletionHandler)completionHandler; 65 - (void)openInWebBrowser:(BOOL)inWebBrowser setAppropriateOpenStrategyAndWebBrowserState:(NSDictionary<NSString *, id> *)state completionHandler:(LSAppLinkOpenCompletionHandler)completionHandler;66 72 @property (readonly, strong) LSApplicationProxy *targetApplicationProxy; 67 73 @end -
trunk/Source/WebKit/ChangeLog
r244599 r244600 1 2019-04-24 Tim Horton <timothy_horton@apple.com> 2 3 Clean up WKActionSheetAssistant's use of LaunchServices 4 https://bugs.webkit.org/show_bug.cgi?id=194645 5 <rdar://problem/47707952> 6 7 Reviewed by Andy Estes. 8 9 * UIProcess/ios/WKActionSheetAssistant.mm: 10 (applicationHasAppLinkEntitlements): 11 (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): 12 (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]): 13 (appLinkForURL): Deleted. 14 Make this function much more early-returny and flat. 15 Adopt LS sync SPI instead of using a semaphore ourselves. 16 Adopt modern open SPI. 17 1 18 2019-04-24 Simon Fraser <simon.fraser@apple.com> 2 19 -
trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
r244368 r244600 74 74 static LSAppLink *appLinkForURL(NSURL *url) 75 75 { 76 #if HAVE(APP_LINKS_WITH_ISENABLED) 77 NSArray<LSAppLink *> *appLinks = [LSAppLink appLinksWithURL:url limit:1 error:nil]; 78 return appLinks.firstObject; 79 #else 76 80 BinarySemaphore semaphore; 77 81 __block LSAppLink *syncAppLink = nil; … … 85 89 86 90 return [syncAppLink autorelease]; 91 #endif 87 92 } 88 93 #endif … … 473 478 } 474 479 480 #if HAVE(APP_LINKS) 481 - (BOOL)_appendAppLinkOpenActionsForURL:(NSURL *)url actions:(NSMutableArray *)defaultActions elementInfo:(_WKActivatedElementInfo *)elementInfo 482 { 483 ASSERT(_delegate); 484 485 if (!applicationHasAppLinkEntitlements() || ![_delegate.get() actionSheetAssistant:self shouldIncludeAppLinkActionsForElement:elementInfo]) 486 return NO; 487 488 LSAppLink *appLink = appLinkForURL(url); 489 if (!appLink) 490 return NO; 491 492 NSString *openInDefaultBrowserTitle = WEB_UI_STRING("Open in Safari", "Title for Open in Safari Link action button"); 493 _WKElementAction *openInDefaultBrowserAction = [_WKElementAction _elementActionWithType:_WKElementActionTypeOpenInDefaultBrowser title:openInDefaultBrowserTitle actionHandler:^(_WKActivatedElementInfo *) { 494 #if HAVE(APP_LINKS_WITH_ISENABLED) 495 appLink.enabled = NO; 496 [appLink openWithCompletionHandler:nil]; 497 #else 498 [appLink openInWebBrowser:YES setAppropriateOpenStrategyAndWebBrowserState:nil completionHandler:^(BOOL success, NSError *error) { }]; 499 #endif 500 }]; 501 [defaultActions addObject:openInDefaultBrowserAction]; 502 503 NSString *externalApplicationName = [appLink.targetApplicationProxy localizedNameForContext:nil]; 504 if (!externalApplicationName) 505 return YES; 506 507 NSString *openInExternalApplicationTitle = [NSString stringWithFormat:WEB_UI_STRING("Open in “%@”", "Title for Open in External Application Link action button"), externalApplicationName]; 508 _WKElementAction *openInExternalApplicationAction = [_WKElementAction _elementActionWithType:_WKElementActionTypeOpenInExternalApplication title:openInExternalApplicationTitle actionHandler:^(_WKActivatedElementInfo *) { 509 #if HAVE(APP_LINKS_WITH_ISENABLED) 510 appLink.enabled = YES; 511 [appLink openWithCompletionHandler:nil]; 512 #else 513 [appLink openInWebBrowser:NO setAppropriateOpenStrategyAndWebBrowserState:nil completionHandler:^(BOOL success, NSError *error) { }]; 514 #endif 515 }]; 516 [defaultActions addObject:openInExternalApplicationAction]; 517 518 return YES; 519 } 520 #endif 521 475 522 - (void)_appendOpenActionsForURL:(NSURL *)url actions:(NSMutableArray *)defaultActions elementInfo:(_WKActivatedElementInfo *)elementInfo 476 523 { 477 524 #if HAVE(APP_LINKS) 478 ASSERT(_delegate); 479 if (applicationHasAppLinkEntitlements() && [_delegate.get() actionSheetAssistant:self shouldIncludeAppLinkActionsForElement:elementInfo]) { 480 LSAppLink *appLink = appLinkForURL(url); 481 if (appLink) { 482 NSString *title = WEB_UI_STRING("Open in Safari", "Title for Open in Safari Link action button"); 483 _WKElementAction *openInDefaultBrowserAction = [_WKElementAction _elementActionWithType:_WKElementActionTypeOpenInDefaultBrowser title:title actionHandler:^(_WKActivatedElementInfo *) { 484 #pragma clang diagnostic push 485 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 486 [appLink openInWebBrowser:YES setAppropriateOpenStrategyAndWebBrowserState:nil completionHandler:^(BOOL success, NSError *error) { }]; 487 #pragma clang diagnostic pop 488 }]; 489 [defaultActions addObject:openInDefaultBrowserAction]; 490 491 NSString *externalApplicationName = [appLink.targetApplicationProxy localizedNameForContext:nil]; 492 if (externalApplicationName) { 493 NSString *title = [NSString stringWithFormat:WEB_UI_STRING("Open in “%@”", "Title for Open in External Application Link action button"), externalApplicationName]; 494 _WKElementAction *openInExternalApplicationAction = [_WKElementAction _elementActionWithType:_WKElementActionTypeOpenInExternalApplication title:title actionHandler:^(_WKActivatedElementInfo *) { 495 #pragma clang diagnostic push 496 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 497 [appLink openInWebBrowser:NO setAppropriateOpenStrategyAndWebBrowserState:nil completionHandler:^(BOOL success, NSError *error) { }]; 498 #pragma clang diagnostic pop 499 }]; 500 [defaultActions addObject:openInExternalApplicationAction]; 501 } 502 } else 503 [defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeOpen assistant:self]]; 504 } else 505 [defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeOpen assistant:self]]; 506 #else 525 if ([self _appendAppLinkOpenActionsForURL:url actions:defaultActions elementInfo:elementInfo]) 526 return; 527 #endif 528 507 529 [defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeOpen assistant:self]]; 508 #endif509 530 } 510 531
Note: See TracChangeset
for help on using the changeset viewer.