IWebInterfaceBrowserCookieManager.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Engine/Source/Runtime/WebBrowser/Public/IWebBrowserCookieManager.h
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. struct FWebInterfaceBrowserCookie
  5. {
  6. public:
  7. // The cookie name.
  8. FString Name;
  9. // The cookie value.
  10. FString Value;
  11. // If is empty a host cookie will be created instead of a domain
  12. // cookie. Domain cookies are stored with a leading "." and are visible to
  13. // sub-domains whereas host cookies are not.
  14. FString Domain;
  15. // If is non-empty only URLs at or below the path will get the cookie
  16. // value.
  17. FString Path;
  18. // If true the cookie will only be sent for HTTPS requests.
  19. bool bSecure;
  20. // If true the cookie will only be sent for HTTP requests.
  21. bool bHttpOnly;
  22. // If true the cookie will expire at the specified Expires datetime.
  23. bool bHasExpires;
  24. // The cookie expiration date is only valid if bHasExpires is true.
  25. FDateTime Expires;
  26. };
  27. class IWebInterfaceBrowserCookieManager
  28. {
  29. public:
  30. typedef struct FWebInterfaceBrowserCookie FCookie;
  31. public:
  32. /**
  33. * Sets a cookie given a valid URL.
  34. *
  35. * This function expects each attribute to be well-formed. It will
  36. * check for disallowed characters (e.g. the ';' character is disallowed
  37. * within the cookie Value field) and fail without setting the cookie if
  38. * such characters are found.
  39. *
  40. * @param URL The base URL to match when searching for cookies to remove. Use blank to match all URLs.
  41. * @param Cookie The struct defining the state of the cookie to set
  42. * @param Completed A callback function that will be invoked asynchronously on the game thread when the set is complete passing success bool.
  43. */
  44. virtual void SetCookie(const FString& URL, const FCookie& Cookie, TFunction<void(bool)> Completed = nullptr) = 0;
  45. /**
  46. * Delete all browser cookies.
  47. *
  48. * Removes all matching cookies. Leave both URL and CookieName blank to delete the entire cookie database.
  49. * The actual deletion will be scheduled on the browser IO thread, so the operation may not have completed when the function returns.
  50. *
  51. * @param URL The base URL to match when searching for cookies to remove. Use blank to match all URLs.
  52. * @param CookieName The name of the cookie to delete. If left unspecified, all cookies will be removed.
  53. * @param Completed A callback function that will be invoked asynchronously on the game thread when the deletion is complete passing in the number of deleted objects.
  54. */
  55. virtual void DeleteCookies(const FString& URL = TEXT(""), const FString& CookieName = TEXT(""), TFunction<void(int)> Completed = nullptr) = 0;
  56. };