CefCookieVisitor.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Interface to implement for visiting cookie values. The methods of this class
  10. /// will always be called on the UI thread.
  11. /// </summary>
  12. public abstract unsafe partial class CefCookieVisitor
  13. {
  14. private int visit(cef_cookie_visitor_t* self, cef_cookie_t* cookie, int count, int total, int* deleteCookie)
  15. {
  16. CheckSelf(self);
  17. var mCookie = CefCookie.FromNative(cookie);
  18. bool mDelete;
  19. var result = Visit(mCookie, count, total, out mDelete);
  20. *deleteCookie = mDelete ? 1 : 0;
  21. return result ? 1 : 0;
  22. }
  23. /// <summary>
  24. /// Method that will be called once for each cookie. |count| is the 0-based
  25. /// index for the current cookie. |total| is the total number of cookies.
  26. /// Set |deleteCookie| to true to delete the cookie currently being visited.
  27. /// Return false to stop visiting cookies. This method may never be called if
  28. /// no cookies are found.
  29. /// </summary>
  30. protected abstract bool Visit(CefCookie cookie, int count, int total, out bool delete);
  31. }
  32. }