Fix the internal macOS build after r251171
https://bugs.webkit.org/show_bug.cgi?id=203022

Reviewed by Dan Bernstein.

Attempts to include <HIServices/AccessibilityPriv.h> in WebKit result in:

```
fatal error: 'HIServices/AccessibilityPriv.h' file not found
```

At least on macOS 10.15, it appears that HIServices.framework exists within the ApplicationServices framework.
To fix this build error, we can instead turn AccessibilityPrivSPI.h into an SPI header for ApplicationServices,
ApplicationServicesSPI.h, and use it in several places where we currently directly import <ApplicationServices/
ApplicationServicesPriv.h>.

* Platform/IPC/cocoa/ConnectionCocoa.mm:

Bring some more constants that were defined in the !USE(APPLE_INTERNAL_SDK) case into the ApplicationServices
SPI header.

* Platform/spi/mac/ApplicationServicesSPI.h: Renamed from Source/WebKit/Platform/spi/mac/AccessibilityPrivSPI.h.
* Shared/mac/AuxiliaryProcessMac.mm:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 01bcbf1..57dfa2f 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,31 @@
+2019-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Fix the internal macOS build after r251171
+        https://bugs.webkit.org/show_bug.cgi?id=203022
+
+        Reviewed by Dan Bernstein.
+
+        Attempts to include <HIServices/AccessibilityPriv.h> in WebKit result in:
+
+        ```
+        fatal error: 'HIServices/AccessibilityPriv.h' file not found
+        ```
+
+        At least on macOS 10.15, it appears that HIServices.framework exists within the ApplicationServices framework.
+        To fix this build error, we can instead turn AccessibilityPrivSPI.h into an SPI header for ApplicationServices,
+        ApplicationServicesSPI.h, and use it in several places where we currently directly import <ApplicationServices/
+        ApplicationServicesPriv.h>.
+
+        * Platform/IPC/cocoa/ConnectionCocoa.mm:
+
+        Bring some more constants that were defined in the !USE(APPLE_INTERNAL_SDK) case into the ApplicationServices
+        SPI header.
+
+        * Platform/spi/mac/ApplicationServicesSPI.h: Renamed from Source/WebKit/Platform/spi/mac/AccessibilityPrivSPI.h.
+        * Shared/mac/AuxiliaryProcessMac.mm:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
+
 2019-10-15  Kate Cheney  <katherine_cheney@apple.com>
 
         REGRESSION (~244100) [Mac WK2 Debug] Layout Test http/tests/resourceLoadStatistics/prune-statistics.html is a flaky failure (197285)
diff --git a/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm b/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm
index 87dd28f..2391290 100644
--- a/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm
+++ b/Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm
@@ -55,14 +55,7 @@
 
 #if PLATFORM(MAC)
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <ApplicationServices/ApplicationServicesPriv.h>
-#else
-typedef enum {
-    AXSuspendStatusRunning = 0,
-    AXSuspendStatusSuspended,
-} AXSuspendStatus;
-#endif
+#import "ApplicationServicesSPI.h"
 
 extern "C" AXError _AXUIElementNotifyProcessSuspendStatus(AXSuspendStatus);
 
diff --git a/Source/WebKit/Platform/spi/mac/AccessibilityPrivSPI.h b/Source/WebKit/Platform/spi/mac/ApplicationServicesSPI.h
similarity index 90%
rename from Source/WebKit/Platform/spi/mac/AccessibilityPrivSPI.h
rename to Source/WebKit/Platform/spi/mac/ApplicationServicesSPI.h
index 784cda3..a31f2da 100644
--- a/Source/WebKit/Platform/spi/mac/AccessibilityPrivSPI.h
+++ b/Source/WebKit/Platform/spi/mac/ApplicationServicesSPI.h
@@ -25,16 +25,11 @@
 
 #pragma once
 
+#if PLATFORM(MAC)
+
 #if USE(APPLE_INTERNAL_SDK)
 
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wundef"
-
-#if PLATFORM(MAC)
-#include <HIServices/AccessibilityPriv.h>
-#endif
-
-#pragma clang diagnostic pop
+#import <ApplicationServices/ApplicationServicesPriv.h>
 
 #else
 
@@ -53,6 +48,13 @@
     kAXClientTypeDictation,
 };
 
+typedef enum {
+    AXSuspendStatusRunning = 0,
+    AXSuspendStatusSuspended,
+} AXSuspendStatus;
+
+#endif
+
 extern AXClientType _AXGetClientForCurrentRequestUntrusted(void);
 
-#endif // PLATFORM(APPLE_INTERNAL_SDK)
+#endif // PLATFORM(MAC)
diff --git a/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm b/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
index 3675271..735e17e 100644
--- a/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
+++ b/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
@@ -28,6 +28,7 @@
 #if PLATFORM(MAC) || PLATFORM(MACCATALYST)
 #import "AuxiliaryProcess.h"
 
+#import "ApplicationServicesSPI.h"
 #import "CodeSigning.h"
 #import "QuarantineSPI.h"
 #import "SandboxInitializationParameters.h"
@@ -56,7 +57,6 @@
 #import <wtf/text/StringBuilder.h>
 
 #if USE(APPLE_INTERNAL_SDK)
-#import <ApplicationServices/ApplicationServicesPriv.h>
 #import <rootless.h>
 #endif
 
diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
index 84f96e6..f9952c1 100644
--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -1714,6 +1714,7 @@
 		F4D5F51D206087A10038BBA8 /* WKTextInputListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */; };
 		F4D5F51F206087A10038BBA8 /* WKQuickboardListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D5F51B206087A10038BBA8 /* WKQuickboardListViewController.h */; };
 		F4DB54E62319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DB54E42319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h */; };
+		F4EC94E32356CC57000BB614 /* ApplicationServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D04E2821F7C73D0076741D /* ApplicationServicesSPI.h */; };
 		F6113E25126CE1820057D0A7 /* APIUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E24126CE1820057D0A7 /* APIUserContentURLPattern.h */; };
 		F6113E29126CE19B0057D0A7 /* WKUserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = F6113E27126CE19B0057D0A7 /* WKUserContentURLPattern.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		F634445612A885C8000612D8 /* APISecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = F634445512A885C8000612D8 /* APISecurityOrigin.h */; };
@@ -2548,7 +2549,7 @@
 		29AD3097164B4E210072DEA9 /* LegacyCustomProtocolManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LegacyCustomProtocolManagerProxy.messages.in; path = CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in; sourceTree = "<group>"; };
 		29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAccessibilityWebPageObjectBase.h; sourceTree = "<group>"; };
 		29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObjectBase.mm; sourceTree = "<group>"; };
-		29D04E2821F7C73D0076741D /* AccessibilityPrivSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccessibilityPrivSPI.h; sourceTree = "<group>"; };
+		29D04E2821F7C73D0076741D /* ApplicationServicesSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplicationServicesSPI.h; sourceTree = "<group>"; };
 		2D0035221BC7414800DA8716 /* PDFPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPlugin.h; path = PDF/PDFPlugin.h; sourceTree = "<group>"; };
 		2D0035231BC7414800DA8716 /* PDFPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPlugin.mm; path = PDF/PDFPlugin.mm; sourceTree = "<group>"; };
 		2D0C56FB229F1DEA00BD33E7 /* DeviceManagementSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceManagementSoftLink.h; sourceTree = "<group>"; };
@@ -7512,8 +7513,8 @@
 		A1E6886E1F6E2B82007006A6 /* mac */ = {
 			isa = PBXGroup;
 			children = (
-				29D04E2821F7C73D0076741D /* AccessibilityPrivSPI.h */,
 				F48D2A8421583A0200C6752B /* AppKitSPI.h */,
+				29D04E2821F7C73D0076741D /* ApplicationServicesSPI.h */,
 				A1E6886F1F6E2BAB007006A6 /* QuarantineSPI.h */,
 			);
 			path = mac;
@@ -9413,6 +9414,7 @@
 				1AE286841C7F93860069AC4F /* APIWebsiteDataRecord.h in Headers */,
 				1A6563E51B7A8C50009CF787 /* APIWindowFeatures.h in Headers */,
 				F48D2A8521583A7E00C6752B /* AppKitSPI.h in Headers */,
+				F4EC94E32356CC57000BB614 /* ApplicationServicesSPI.h in Headers */,
 				1AD4C1931B39F33200ABC28E /* ApplicationStateTracker.h in Headers */,
 				1AEFD27911D16C81008219D3 /* ArgumentCoder.h in Headers */,
 				1AEFD2F711D1807B008219D3 /* ArgumentCoders.h in Headers */,
diff --git a/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm b/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm
index d0d5657..53fcb84 100644
--- a/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm
+++ b/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "WKAccessibilityWebPageObjectBase.h"
 
-#import "AccessibilityPrivSPI.h"
+#import "ApplicationServicesSPI.h"
 #import "WebFrame.h"
 #import "WebPage.h"
 #import "WKArray.h"