michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIFactory.h" michael@0: #include "nsISupports.h" michael@0: #include "nsIComponentManager.h" michael@0: #include "mozilla/ModuleUtils.h" michael@0: michael@0: #include "nsWidgetsCID.h" michael@0: michael@0: #include "nsChildView.h" michael@0: #include "nsCocoaWindow.h" michael@0: #include "nsAppShell.h" michael@0: #include "nsAppShellSingleton.h" michael@0: #include "nsFilePicker.h" michael@0: #include "nsColorPicker.h" michael@0: michael@0: #include "nsClipboard.h" michael@0: #include "nsClipboardHelper.h" michael@0: #include "nsTransferable.h" michael@0: #include "nsHTMLFormatConverter.h" michael@0: #include "nsDragService.h" michael@0: #include "nsToolkit.h" michael@0: michael@0: #include "nsLookAndFeel.h" michael@0: michael@0: #include "nsSound.h" michael@0: #include "nsIdleServiceX.h" michael@0: #include "NativeKeyBindings.h" michael@0: #include "OSXNotificationCenter.h" michael@0: michael@0: #include "nsScreenManagerCocoa.h" michael@0: #include "nsDeviceContextSpecX.h" michael@0: #include "nsPrintOptionsX.h" michael@0: #include "nsPrintDialogX.h" michael@0: #include "nsPrintSession.h" michael@0: #include "nsToolkitCompsCID.h" michael@0: michael@0: #include "mozilla/Module.h" michael@0: michael@0: using namespace mozilla; michael@0: using namespace mozilla::widget; michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsCocoaWindow) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildView) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPicker) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerCocoa) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsX, Init) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceX, Init) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) michael@0: NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceX, nsIdleServiceX::GetInstance) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(OSXNotificationCenter, Init) michael@0: michael@0: #include "nsMenuBarX.h" michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeMenuServiceX) michael@0: michael@0: #include "nsBidiKeyboard.h" michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard) michael@0: michael@0: #include "nsNativeThemeCocoa.h" michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeCocoa) michael@0: michael@0: #include "nsMacDockSupport.h" michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacDockSupport) michael@0: michael@0: #include "nsMacWebAppUtils.h" michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacWebAppUtils) michael@0: michael@0: #include "nsStandaloneNativeMenu.h" michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandaloneNativeMenu) michael@0: michael@0: #include "GfxInfo.h" michael@0: namespace mozilla { michael@0: namespace widget { michael@0: // This constructor should really be shared with all platforms. michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) michael@0: } michael@0: } michael@0: michael@0: NS_DEFINE_NAMED_CID(NS_WINDOW_CID); michael@0: NS_DEFINE_NAMED_CID(NS_POPUP_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CHILD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SOUND_CID); michael@0: NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_THEMERENDERER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_NATIVEMENUSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_MACDOCKSUPPORT_CID); michael@0: NS_DEFINE_NAMED_CID(NS_MACWEBAPPUTILS_CID); michael@0: NS_DEFINE_NAMED_CID(NS_STANDALONENATIVEMENU_CID); michael@0: NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); michael@0: michael@0: static const mozilla::Module::CIDEntry kWidgetCIDs[] = { michael@0: { &kNS_WINDOW_CID, false, NULL, nsCocoaWindowConstructor }, michael@0: { &kNS_POPUP_CID, false, NULL, nsCocoaWindowConstructor }, michael@0: { &kNS_CHILD_CID, false, NULL, nsChildViewConstructor }, michael@0: { &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor }, michael@0: { &kNS_SOUND_CID, false, NULL, nsSoundConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor }, michael@0: { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, michael@0: { &kNS_CLIPBOARD_CID, false, NULL, nsClipboardConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor }, michael@0: { &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor }, michael@0: { &kNS_THEMERENDERER_CID, false, NULL, nsNativeThemeCocoaConstructor }, michael@0: { &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerCocoaConstructor }, michael@0: { &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsXConstructor }, michael@0: { &kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceXConstructor, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceXConstructor }, michael@0: { &kNS_SYSTEMALERTSSERVICE_CID, false, NULL, OSXNotificationCenterConstructor }, michael@0: { &kNS_NATIVEMENUSERVICE_CID, false, NULL, nsNativeMenuServiceXConstructor }, michael@0: { &kNS_MACDOCKSUPPORT_CID, false, NULL, nsMacDockSupportConstructor }, michael@0: { &kNS_MACWEBAPPUTILS_CID, false, NULL, nsMacWebAppUtilsConstructor }, michael@0: { &kNS_STANDALONENATIVEMENU_CID, false, NULL, nsStandaloneNativeMenuConstructor }, michael@0: { &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor }, michael@0: { NULL } michael@0: }; michael@0: michael@0: static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { michael@0: { "@mozilla.org/widgets/window/mac;1", &kNS_WINDOW_CID }, michael@0: { "@mozilla.org/widgets/popup/mac;1", &kNS_POPUP_CID }, michael@0: { "@mozilla.org/widgets/childwindow/mac;1", &kNS_CHILD_CID }, michael@0: { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/widget/appshell/mac;1", &kNS_APPSHELL_CID }, michael@0: { "@mozilla.org/sound;1", &kNS_SOUND_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, michael@0: { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, michael@0: { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID }, michael@0: { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID }, michael@0: { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID }, michael@0: { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, michael@0: { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, michael@0: { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID, michael@0: mozilla::Module::MAIN_PROCESS_ONLY }, michael@0: { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, michael@0: { "@mozilla.org/system-alerts-service;1", &kNS_SYSTEMALERTSSERVICE_CID }, michael@0: { "@mozilla.org/widget/nativemenuservice;1", &kNS_NATIVEMENUSERVICE_CID }, michael@0: { "@mozilla.org/widget/macdocksupport;1", &kNS_MACDOCKSUPPORT_CID }, michael@0: { "@mozilla.org/widget/mac-web-app-utils;1", &kNS_MACWEBAPPUTILS_CID }, michael@0: { "@mozilla.org/widget/standalonenativemenu;1", &kNS_STANDALONENATIVEMENU_CID }, michael@0: { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, michael@0: { NULL } michael@0: }; michael@0: michael@0: static void michael@0: nsWidgetCocoaModuleDtor() michael@0: { michael@0: NativeKeyBindings::Shutdown(); michael@0: nsLookAndFeel::Shutdown(); michael@0: nsToolkit::Shutdown(); michael@0: nsAppShellShutdown(); michael@0: } michael@0: michael@0: static const mozilla::Module kWidgetModule = { michael@0: mozilla::Module::kVersion, michael@0: kWidgetCIDs, michael@0: kWidgetContracts, michael@0: NULL, michael@0: NULL, michael@0: nsAppShellInit, michael@0: nsWidgetCocoaModuleDtor michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsWidgetMacModule) = &kWidgetModule;