nsIUrlListManager.idl 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* -*- Mode: C++; tab-width: 4; 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 nsIPrincipal;
  7. /**
  8. * Interface for a class that manages updates of the url classifier database.
  9. */
  10. // Interface for JS function callbacks
  11. [scriptable, function, uuid(fa4caf12-d057-4e7e-81e9-ce066ceee90b)]
  12. interface nsIUrlListManagerCallback : nsISupports {
  13. void handleEvent(in ACString value);
  14. };
  15. [scriptable, uuid(d60a08ee-5c83-4eb6-bdfb-79fd0716501e)]
  16. interface nsIUrlListManager : nsISupports
  17. {
  18. /**
  19. * Get the gethash url for this table
  20. */
  21. ACString getGethashUrl(in ACString tableName);
  22. /**
  23. * Add a table to the list of tables we are managing. The name is a
  24. * string of the format provider_name-semantic_type-table_type. For
  25. * @param tableName A string of the format
  26. * provider_name-semantic_type-table_type. For example,
  27. * goog-white-enchash or goog-black-url.
  28. * @param providerName The name of the entity providing the list.
  29. * @param updateUrl The URL from which to fetch updates.
  30. * @param gethashUrl The URL from which to fetch hash completions.
  31. */
  32. boolean registerTable(in ACString tableName,
  33. in ACString providerName,
  34. in ACString updateUrl,
  35. in ACString gethashUrl);
  36. /**
  37. * Turn on update checking for a table. I.e., during the next server
  38. * check, download updates for this table.
  39. */
  40. void enableUpdate(in ACString tableName);
  41. /**
  42. * Turn off update checking for a table.
  43. */
  44. void disableUpdate(in ACString tableName);
  45. /**
  46. * Toggle update checking, if necessary.
  47. */
  48. void maybeToggleUpdateChecking();
  49. /**
  50. * Lookup a key. Should not raise exceptions. Calls the callback
  51. * function with a comma-separated list of tables to which the key
  52. * belongs.
  53. */
  54. void safeLookup(in nsIPrincipal key,
  55. in nsIUrlListManagerCallback cb);
  56. };