1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Joe Hewitt <hewitt@netscape.com> (Original Author)
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #include "mozilla/ModuleUtils.h"
40 :
41 : #include "nsBrowserCompsCID.h"
42 : #include "DirectoryProvider.h"
43 :
44 : #if defined(XP_WIN)
45 : #include "nsWindowsShellService.h"
46 : #elif defined(XP_MACOSX)
47 : #include "nsMacShellService.h"
48 : #elif defined(MOZ_WIDGET_GTK2)
49 : #include "nsGNOMEShellService.h"
50 : #endif
51 :
52 : #if defined(XP_WIN) && !defined(__MINGW32__)
53 : #include "nsIEProfileMigrator.h"
54 : #elif defined(XP_MACOSX)
55 : #include "nsSafariProfileMigrator.h"
56 : #endif
57 :
58 : #include "rdf.h"
59 : #include "nsFeedSniffer.h"
60 : #include "AboutRedirector.h"
61 : #include "nsIAboutModule.h"
62 :
63 : #include "nsPrivateBrowsingServiceWrapper.h"
64 : #include "nsNetCID.h"
65 :
66 : using namespace mozilla::browser;
67 :
68 : /////////////////////////////////////////////////////////////////////////////
69 :
70 2838 : NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider)
71 : #if defined(XP_WIN)
72 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
73 : #elif defined(XP_MACOSX)
74 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
75 : #elif defined(MOZ_WIDGET_GTK2)
76 2 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
77 : #endif
78 :
79 : #if defined(XP_WIN) && !defined(__MINGW32__)
80 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEProfileMigrator)
81 : #elif defined(XP_MACOSX)
82 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafariProfileMigrator)
83 : #endif
84 :
85 2 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
86 :
87 940 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrivateBrowsingServiceWrapper, Init)
88 :
89 : NS_DEFINE_NAMED_CID(NS_BROWSERDIRECTORYPROVIDER_CID);
90 : #if defined(XP_WIN)
91 : NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
92 : #elif defined(MOZ_WIDGET_GTK2)
93 : NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
94 : #endif
95 : NS_DEFINE_NAMED_CID(NS_FEEDSNIFFER_CID);
96 : NS_DEFINE_NAMED_CID(NS_BROWSER_ABOUT_REDIRECTOR_CID);
97 : #if defined(XP_WIN) && !defined(__MINGW32__)
98 : NS_DEFINE_NAMED_CID(NS_WINIEPROFILEMIGRATOR_CID);
99 : #elif defined(XP_MACOSX)
100 : NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
101 : NS_DEFINE_NAMED_CID(NS_SAFARIPROFILEMIGRATOR_CID);
102 : #endif
103 : NS_DEFINE_NAMED_CID(NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID);
104 :
105 : static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
106 : { &kNS_BROWSERDIRECTORYPROVIDER_CID, false, NULL, DirectoryProviderConstructor },
107 : #if defined(XP_WIN)
108 : { &kNS_SHELLSERVICE_CID, false, NULL, nsWindowsShellServiceConstructor },
109 : #elif defined(MOZ_WIDGET_GTK2)
110 : { &kNS_SHELLSERVICE_CID, false, NULL, nsGNOMEShellServiceConstructor },
111 : #endif
112 : { &kNS_FEEDSNIFFER_CID, false, NULL, nsFeedSnifferConstructor },
113 : { &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create },
114 : #if defined(XP_WIN) && !defined(__MINGW32__)
115 : { &kNS_WINIEPROFILEMIGRATOR_CID, false, NULL, nsIEProfileMigratorConstructor },
116 : #elif defined(XP_MACOSX)
117 : { &kNS_SHELLSERVICE_CID, false, NULL, nsMacShellServiceConstructor },
118 : { &kNS_SAFARIPROFILEMIGRATOR_CID, false, NULL, nsSafariProfileMigratorConstructor },
119 : #endif
120 : { &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID, false, NULL, nsPrivateBrowsingServiceWrapperConstructor },
121 : { NULL }
122 : };
123 :
124 : static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
125 : { NS_BROWSERDIRECTORYPROVIDER_CONTRACTID, &kNS_BROWSERDIRECTORYPROVIDER_CID },
126 : #if defined(XP_WIN)
127 : { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
128 : #elif defined(MOZ_WIDGET_GTK2)
129 : { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
130 : #endif
131 : { NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID },
132 : #ifdef MOZ_SAFE_BROWSING
133 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
134 : #endif
135 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
136 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "feeds", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
137 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
138 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
139 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
140 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
141 : #ifdef MOZ_SERVICES_SYNC
142 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "sync-tabs", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
143 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "sync-progress", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
144 : #endif
145 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
146 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
147 : { NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
148 : #if defined(XP_WIN) && !defined(__MINGW32__)
149 : { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie", &kNS_WINIEPROFILEMIGRATOR_CID },
150 : #elif defined(XP_MACOSX)
151 : { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
152 : { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "safari", &kNS_SAFARIPROFILEMIGRATOR_CID },
153 : #endif
154 : { NS_PRIVATE_BROWSING_SERVICE_CONTRACTID, &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID },
155 : { NULL }
156 : };
157 :
158 : static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
159 : { XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
160 : { NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
161 : { NULL }
162 : };
163 :
164 : static const mozilla::Module kBrowserModule = {
165 : mozilla::Module::kVersion,
166 : kBrowserCIDs,
167 : kBrowserContracts,
168 : kBrowserCategories
169 : };
170 :
171 : NSMODULE_DEFN(nsBrowserCompsModule) = &kBrowserModule;
172 :
|