nsICaptivePortalService.idl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "nsISupports.idl"
  5. [scriptable, uuid(b5fd5629-d04c-4138-9529-9311f291ecd4)]
  6. interface nsICaptivePortalServiceCallback : nsISupports
  7. {
  8. /**
  9. * Invoke callbacks after captive portal detection finished.
  10. */
  11. void complete(in bool success, in nsresult error);
  12. };
  13. /**
  14. * Service used for captive portal detection.
  15. * The service is only active in the main process. It is also available in the
  16. * content process, but only to mirror the captive portal state from the main
  17. * process.
  18. */
  19. [scriptable, uuid(bdbe0555-fc3d-4f7b-9205-c309ceb2d641)]
  20. interface nsICaptivePortalService : nsISupports
  21. {
  22. const long UNKNOWN = 0;
  23. const long NOT_CAPTIVE = 1;
  24. const long UNLOCKED_PORTAL = 2;
  25. const long LOCKED_PORTAL = 3;
  26. /**
  27. * Called from XPCOM to trigger a captive portal recheck.
  28. * A network request will only be performed if no other checks are currently
  29. * ongoing.
  30. * Will not do anything if called in the content process.
  31. */
  32. void recheckCaptivePortal();
  33. /**
  34. * Returns the state of the captive portal.
  35. */
  36. readonly attribute long state;
  37. /**
  38. * Returns the time difference between NOW and the last time a request was
  39. * completed in milliseconds.
  40. */
  41. readonly attribute unsigned long long lastChecked;
  42. };
  43. %{C++
  44. /**
  45. * This observer notification will be emitted when the captive portal state
  46. * changes. After receiving it, the ContentParent will send an IPC message
  47. * to the ContentChild, which will set the state in the captive portal service
  48. * in the child.
  49. */
  50. #define NS_IPC_CAPTIVE_PORTAL_SET_STATE "ipc:network:captive-portal-set-state"
  51. %}