nsIProgressEventSink.idl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. interface nsIURI;
  7. interface nsIRequest;
  8. /**
  9. * nsIProgressEventSink
  10. *
  11. * This interface is used to asynchronously convey channel status and progress
  12. * information that is generally not critical to the processing of the channel.
  13. * The information is intended to be displayed to the user in some meaningful
  14. * way.
  15. *
  16. * An implementation of this interface can be passed to a channel via the
  17. * channel's notificationCallbacks attribute. See nsIChannel for more info.
  18. *
  19. * The channel will begin passing notifications to the progress event sink
  20. * after its asyncOpen method has been called. Notifications will cease once
  21. * the channel calls its listener's onStopRequest method or once the channel
  22. * is canceled (via nsIRequest::cancel).
  23. *
  24. * NOTE: This interface is actually not specific to channels and may be used
  25. * with other implementations of nsIRequest.
  26. */
  27. [scriptable, uuid(87d55fba-cb7e-4f38-84c1-5c6c2b2a55e9)]
  28. interface nsIProgressEventSink : nsISupports
  29. {
  30. /**
  31. * Called to notify the event sink that progress has occurred for the
  32. * given request.
  33. *
  34. * @param aRequest
  35. * the request being observed (may QI to nsIChannel).
  36. * @param aContext
  37. * if aRequest is a channel, then this parameter is the listener
  38. * context passed to nsIChannel::asyncOpen.
  39. * @param aProgress
  40. * numeric value in the range 0 to aProgressMax indicating the
  41. * number of bytes transfered thus far.
  42. * @param aProgressMax
  43. * numeric value indicating maximum number of bytes that will be
  44. * transfered (or -1 if total is unknown).
  45. */
  46. void onProgress(in nsIRequest aRequest,
  47. in nsISupports aContext,
  48. in long long aProgress,
  49. in long long aProgressMax);
  50. /**
  51. * Called to notify the event sink with a status message for the given
  52. * request.
  53. *
  54. * @param aRequest
  55. * the request being observed (may QI to nsIChannel).
  56. * @param aContext
  57. * if aRequest is a channel, then this parameter is the listener
  58. * context passed to nsIChannel::asyncOpen.
  59. * @param aStatus
  60. * status code (not necessarily an error code) indicating the
  61. * state of the channel (usually the state of the underlying
  62. * transport). see nsISocketTransport for socket specific status
  63. * codes.
  64. * @param aStatusArg
  65. * status code argument to be used with the string bundle service
  66. * to convert the status message into localized, human readable
  67. * text. the meaning of this parameter is specific to the value
  68. * of the status code. for socket status codes, this parameter
  69. * indicates the host:port associated with the status code.
  70. */
  71. void onStatus(in nsIRequest aRequest,
  72. in nsISupports aContext,
  73. in nsresult aStatus,
  74. in wstring aStatusArg);
  75. };