nsIDownloadHistory.idl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. * vim: sw=2 ts=2 sts=2
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #include "nsISupports.idl"
  7. interface nsIURI;
  8. /**
  9. * This interface can be used to add a download to history. There is a separate
  10. * interface specifically for downloads in case embedders choose to track
  11. * downloads differently from other types of history.
  12. */
  13. [scriptable, uuid(4dcd6a12-a091-4f38-8360-022929635746)]
  14. interface nsIDownloadHistory : nsISupports {
  15. /**
  16. * Adds a download to history. This will also notify observers that the
  17. * URI aSource is visited with the topic NS_LINK_VISITED_EVENT_TOPIC if
  18. * aSource has not yet been visited.
  19. *
  20. * @param aSource
  21. * The source of the download we are adding to history. This cannot be
  22. * null.
  23. * @param aReferrer
  24. * [optional] The referrer of source URI.
  25. * @param aStartTime
  26. * [optional] The time the download was started. If the start time
  27. * is not given, the current time is used.
  28. * @param aDestination
  29. * [optional] The target where the download is to be saved on the local
  30. * filesystem.
  31. * @throws NS_ERROR_NOT_AVAILABLE
  32. * In a situation where a history implementation is not available,
  33. * where 'history implementation' refers to something like
  34. * nsIGlobalHistory and friends.
  35. * @note This addition is not guaranteed to be synchronous, since it delegates
  36. * the actual addition to the underlying history implementation. If you
  37. * need to observe the completion of the addition, use the underlying
  38. * history implementation's notifications system (e.g. nsINavHistoryObserver
  39. * for toolkit's implementation of this interface).
  40. */
  41. void addDownload(in nsIURI aSource, [optional] in nsIURI aReferrer,
  42. [optional] in PRTime aStartTime,
  43. [optional] in nsIURI aDestination);
  44. /**
  45. * Remove all downloads from history.
  46. *
  47. * @note This removal is not guaranteed to be synchronous, since it delegates
  48. * the actual removal to the underlying history implementation. If you
  49. * need to observe the completion of the removal, use the underlying
  50. * history implementation's notifications system (e.g. nsINavHistoryObserver
  51. * for toolkit's implementation of this interface).
  52. */
  53. void removeAllDownloads();
  54. };