WKNavigationAction.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C) 2014 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  14. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  17. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  23. * THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #import <WebKit/WKFoundation.h>
  26. #if TARGET_OS_IPHONE
  27. #import <Foundation/Foundation.h>
  28. #else
  29. #import <AppKit/AppKit.h>
  30. #endif
  31. NS_ASSUME_NONNULL_BEGIN
  32. @class WKFrameInfo;
  33. /*! @enum WKNavigationType
  34. @abstract The type of action triggering a navigation.
  35. @constant WKNavigationTypeLinkActivated A link with an href attribute was activated by the user.
  36. @constant WKNavigationTypeFormSubmitted A form was submitted.
  37. @constant WKNavigationTypeBackForward An item from the back-forward list was requested.
  38. @constant WKNavigationTypeReload The webpage was reloaded.
  39. @constant WKNavigationTypeFormResubmitted A form was resubmitted (for example by going back, going forward, or reloading).
  40. @constant WKNavigationTypeOther Navigation is taking place for some other reason.
  41. */
  42. typedef NS_ENUM(NSInteger, WKNavigationType) {
  43. WKNavigationTypeLinkActivated,
  44. WKNavigationTypeFormSubmitted,
  45. WKNavigationTypeBackForward,
  46. WKNavigationTypeReload,
  47. WKNavigationTypeFormResubmitted,
  48. WKNavigationTypeOther = -1,
  49. } API_AVAILABLE(macos(10.10), ios(8.0));
  50. /*!
  51. A WKNavigationAction object contains information about an action that may cause a navigation, used for making policy decisions.
  52. */
  53. WK_EXTERN API_AVAILABLE(macos(10.10), ios(8.0))
  54. @interface WKNavigationAction : NSObject
  55. /*! @abstract The frame requesting the navigation.
  56. */
  57. @property (nonatomic, readonly, copy) WKFrameInfo *sourceFrame;
  58. /*! @abstract The target frame, or nil if this is a new window navigation.
  59. */
  60. @property (nullable, nonatomic, readonly, copy) WKFrameInfo *targetFrame;
  61. /*! @abstract The type of action that triggered the navigation.
  62. @discussion The value is one of the constants of the enumerated type WKNavigationType.
  63. */
  64. @property (nonatomic, readonly) WKNavigationType navigationType;
  65. /*! @abstract The navigation's request.
  66. */
  67. @property (nonatomic, readonly, copy) NSURLRequest *request;
  68. #if !TARGET_OS_IPHONE
  69. /*! @abstract The modifier keys that were in effect when the navigation was requested.
  70. */
  71. @property (nonatomic, readonly) NSEventModifierFlags modifierFlags;
  72. /*! @abstract The number of the mouse button causing the navigation to be requested.
  73. */
  74. @property (nonatomic, readonly) NSInteger buttonNumber;
  75. #endif
  76. @end
  77. NS_ASSUME_NONNULL_END