Commit 315143ed authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Correctly annotate availability for universal link support.

BUG=1044828

Change-Id: Idd5a5f4fed6ca3d7a9bcae0a14b130e4c6ce9022
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2020182
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735053}
parent 90c2a294
...@@ -46,11 +46,9 @@ IntentPickerAppInfo AppInfoForAppUrl(NSURL* app_url) { ...@@ -46,11 +46,9 @@ IntentPickerAppInfo AppInfoForAppUrl(NSURL* app_url) {
// TODO(avi): When we move to the 10.15 SDK, use correct weak-linking of this // TODO(avi): When we move to the 10.15 SDK, use correct weak-linking of this
// framework rather than dlopen(), and correct @available syntax to access this // framework rather than dlopen(), and correct @available syntax to access this
// class. // class.
SFUniversalLink* GetUniversalLink(const GURL& url) { SFUniversalLink* API_AVAILABLE(macos(10.15)) GetUniversalLink(const GURL& url) {
static void* safari_services = []() -> void* { static void* safari_services = []() -> void* {
if (@available(macOS 10.15, *))
return dlopen(kSafariServicesFrameworkPath, RTLD_LAZY); return dlopen(kSafariServicesFrameworkPath, RTLD_LAZY);
return nullptr;
}(); }();
static const Class SFUniversalLink_class = static const Class SFUniversalLink_class =
...@@ -64,9 +62,11 @@ SFUniversalLink* GetUniversalLink(const GURL& url) { ...@@ -64,9 +62,11 @@ SFUniversalLink* GetUniversalLink(const GURL& url) {
} }
base::Optional<IntentPickerAppInfo> AppInfoForUrl(const GURL& url) { base::Optional<IntentPickerAppInfo> AppInfoForUrl(const GURL& url) {
if (@available(macOS 10.15, *)) {
SFUniversalLink* link = GetUniversalLink(url); SFUniversalLink* link = GetUniversalLink(url);
if (link) if (link)
return AppInfoForAppUrl(link.applicationURL); return AppInfoForAppUrl(link.applicationURL);
}
return base::nullopt; return base::nullopt;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment