1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_MAC_LAUNCH_SERVICES_SPI_H_ 6 #define BASE_MAC_LAUNCH_SERVICES_SPI_H_ 7 8 #import <AppKit/AppKit.h> 9 #include <CoreFoundation/CoreFoundation.h> 10 11 // Private SPIs exposed by LaunchServices. Largely derived from usage of these 12 // in open source WebKit code and some inspection of the LaunchServices binary. 13 14 extern "C" { 15 16 using LSASNRef = const struct CF_BRIDGED_TYPE(id) __LSASN*; 17 18 extern const CFStringRef _kLSOpenOptionActivateKey; 19 extern const CFStringRef _kLSOpenOptionAddToRecentsKey; 20 extern const CFStringRef _kLSOpenOptionArgumentsKey; 21 extern const CFStringRef _kLSOpenOptionBackgroundLaunchKey; 22 extern const CFStringRef _kLSOpenOptionHideKey; 23 extern const CFStringRef _kLSOpenOptionPreferRunningInstanceKey; 24 25 using _LSOpenCompletionHandler = void (^)(LSASNRef, Boolean, CFErrorRef); 26 void _LSOpenURLsWithCompletionHandler( 27 CFArrayRef urls, 28 CFURLRef application_url, 29 CFDictionaryRef options, 30 _LSOpenCompletionHandler completion_handler); 31 32 @interface NSRunningApplication () 33 - (id)initWithApplicationSerialNumber:(LSASNRef)asn; 34 @end 35 36 } // extern "C" 37 38 #endif // BASE_MAC_LAUNCH_SERVICES_SPI_H_ 39