sdk_forward_declarations.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. // This file contains forward declarations for items in later SDKs than the
  5. // default one with which Chromium is built.
  6. #ifndef BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
  7. #define BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
  8. #include <AvailabilityMacros.h>
  9. #include <AvailabilityVersions.h>
  10. #include <os/availability.h>
  11. // NOTE: If an #import is needed only for a newer SDK, it might be found below.
  12. #include "base/base_export.h"
  13. // ----------------------------------------------------------------------------
  14. // Definitions from SDKs newer than the one that Chromium compiles against.
  15. //
  16. // HOW TO DO THIS:
  17. //
  18. // 1. In this file:
  19. // a. Use an #if !defined() guard
  20. // b. Include all API_AVAILABLE/NS_CLASS_AVAILABLE_MAC annotations
  21. // c. Optionally import frameworks
  22. // 2. In your source file:
  23. // a. Correctly annotate availability with @available/__builtin_available/
  24. // API_AVAILABLE
  25. //
  26. // This way, when the SDK is rolled, the section full of definitions
  27. // corresponding to it can be easily deleted.
  28. //
  29. // EXAMPLES OF HOW TO DO THIS:
  30. //
  31. // Suppose there's a simple extension of NSApplication in macOS 10.25. Then:
  32. //
  33. // #if !defined(MAC_OS_X_VERSION_10_25) || \
  34. // MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_25
  35. //
  36. // @interface NSApplication (MacOSHouseCatSDK)
  37. // @property(readonly) CGFloat purrRate API_AVAILABLE(macos(10.25));
  38. // @end
  39. //
  40. // #endif // MAC_OS_X_VERSION_10_25
  41. //
  42. //
  43. // Suppose the CoreShoelace framework is introduced in macOS 10.77. Then:
  44. //
  45. // #if !defined(MAC_OS_X_VERSION_10_77) || \
  46. // MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_77
  47. //
  48. // API_AVAILABLE(macos(10.77))
  49. // @interface NSCoreShoelace : NSObject
  50. // @property (readonly) NSUInteger stringLength;
  51. // @end
  52. //
  53. // #else
  54. //
  55. // #import <CoreShoelace/CoreShoelace.h>
  56. //
  57. // #endif // MAC_OS_X_VERSION_10_77
  58. //
  59. // ----------------------------------------------------------------------------
  60. #if !defined(MAC_OS_VERSION_11_0)
  61. #include <CoreMedia/CoreMedia.h>
  62. enum : CMVideoCodecType { kCMVideoCodecType_VP9 = 'vp09' };
  63. extern "C" {
  64. void VTRegisterSupplementalVideoDecoderIfAvailable(CMVideoCodecType codecType);
  65. }
  66. #endif // MAC_OS_VERSION_11_0
  67. #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_