nsModule.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 "mozilla/ModuleUtils.h"
  6. #include "nsBrowserCompsCID.h"
  7. #include "DirectoryProvider.h"
  8. #if defined(XP_WIN)
  9. #include "nsWindowsShellService.h"
  10. #elif defined(MOZ_WIDGET_GTK)
  11. #include "nsGNOMEShellService.h"
  12. #endif
  13. #include "rdf.h"
  14. #include "nsFeedSniffer.h"
  15. #include "nsNetCID.h"
  16. using namespace mozilla::browser;
  17. /////////////////////////////////////////////////////////////////////////////
  18. NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider)
  19. #if defined(XP_WIN)
  20. NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
  21. #elif defined(MOZ_WIDGET_GTK)
  22. NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
  23. #endif
  24. NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
  25. NS_DEFINE_NAMED_CID(NS_BROWSERDIRECTORYPROVIDER_CID);
  26. #if defined(XP_WIN)
  27. NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
  28. #elif defined(MOZ_WIDGET_GTK)
  29. NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
  30. #endif
  31. NS_DEFINE_NAMED_CID(NS_FEEDSNIFFER_CID);
  32. static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
  33. { &kNS_BROWSERDIRECTORYPROVIDER_CID, false, nullptr, DirectoryProviderConstructor },
  34. #if defined(XP_WIN)
  35. { &kNS_SHELLSERVICE_CID, false, nullptr, nsWindowsShellServiceConstructor },
  36. #elif defined(MOZ_WIDGET_GTK)
  37. { &kNS_SHELLSERVICE_CID, false, nullptr, nsGNOMEShellServiceConstructor },
  38. #endif
  39. { &kNS_FEEDSNIFFER_CID, false, nullptr, nsFeedSnifferConstructor },
  40. { nullptr }
  41. };
  42. static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
  43. { NS_BROWSERDIRECTORYPROVIDER_CONTRACTID, &kNS_BROWSERDIRECTORYPROVIDER_CID },
  44. #if defined(XP_WIN)
  45. { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
  46. #elif defined(MOZ_WIDGET_GTK)
  47. { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
  48. #endif
  49. { NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID },
  50. { nullptr }
  51. };
  52. static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
  53. { XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
  54. { NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
  55. { nullptr }
  56. };
  57. static const mozilla::Module kBrowserModule = {
  58. mozilla::Module::kVersion,
  59. kBrowserCIDs,
  60. kBrowserContracts,
  61. kBrowserCategories
  62. };
  63. NSMODULE_DEFN(nsBrowserCompsModule) = &kBrowserModule;