Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* Copyright 2012 Mozilla Foundation and Mozilla contributors |
michael@0 | 3 | * |
michael@0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 5 | * you may not use this file except in compliance with the License. |
michael@0 | 6 | * You may obtain a copy of the License at |
michael@0 | 7 | * |
michael@0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 9 | * |
michael@0 | 10 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 13 | * See the License for the specific language governing permissions and |
michael@0 | 14 | * limitations under the License. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #include "base/basictypes.h" |
michael@0 | 18 | |
michael@0 | 19 | #include "mozilla/ModuleUtils.h" |
michael@0 | 20 | |
michael@0 | 21 | #include "nsCOMPtr.h" |
michael@0 | 22 | #include "nsWidgetsCID.h" |
michael@0 | 23 | #include "nsAppShell.h" |
michael@0 | 24 | |
michael@0 | 25 | #include "nsWindow.h" |
michael@0 | 26 | #include "nsLookAndFeel.h" |
michael@0 | 27 | #include "nsAppShellSingleton.h" |
michael@0 | 28 | #include "nsScreenManagerQt.h" |
michael@0 | 29 | #include "nsIdleServiceQt.h" |
michael@0 | 30 | #include "nsTransferable.h" |
michael@0 | 31 | #include "nsBidiKeyboard.h" |
michael@0 | 32 | |
michael@0 | 33 | #include "nsHTMLFormatConverter.h" |
michael@0 | 34 | #include "nsXULAppAPI.h" |
michael@0 | 35 | |
michael@0 | 36 | #ifdef NS_PRINTING |
michael@0 | 37 | #include "nsDeviceContextSpecQt.h" |
michael@0 | 38 | #include "nsPrintSession.h" |
michael@0 | 39 | #include "nsPrintOptionsQt.h" |
michael@0 | 40 | #include "nsPrintDialogQt.h" |
michael@0 | 41 | #endif |
michael@0 | 42 | |
michael@0 | 43 | #include "nsClipboard.h" |
michael@0 | 44 | #include "nsClipboardHelper.h" |
michael@0 | 45 | |
michael@0 | 46 | #if defined(MOZ_X11) |
michael@0 | 47 | #include "GfxInfoX11.h" |
michael@0 | 48 | #endif |
michael@0 | 49 | |
michael@0 | 50 | using namespace mozilla::widget; |
michael@0 | 51 | |
michael@0 | 52 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) |
michael@0 | 53 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard) |
michael@0 | 54 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerQt) |
michael@0 | 55 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) |
michael@0 | 56 | NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceQt, nsIdleServiceQt::GetInstance) |
michael@0 | 57 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) |
michael@0 | 58 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) |
michael@0 | 59 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) |
michael@0 | 60 | #ifdef NS_PRINTING |
michael@0 | 61 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecQt) |
michael@0 | 62 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsQt, Init) |
michael@0 | 63 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorQt) |
michael@0 | 64 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) |
michael@0 | 65 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceQt, Init) |
michael@0 | 66 | #endif |
michael@0 | 67 | |
michael@0 | 68 | #if defined(MOZ_X11) |
michael@0 | 69 | namespace mozilla { |
michael@0 | 70 | namespace widget { |
michael@0 | 71 | // This constructor should really be shared with all platforms. |
michael@0 | 72 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) |
michael@0 | 73 | } |
michael@0 | 74 | } |
michael@0 | 75 | #endif |
michael@0 | 76 | |
michael@0 | 77 | |
michael@0 | 78 | NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); |
michael@0 | 79 | NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID); |
michael@0 | 80 | NS_DEFINE_NAMED_CID(NS_WINDOW_CID); |
michael@0 | 81 | NS_DEFINE_NAMED_CID(NS_CHILD_CID); |
michael@0 | 82 | NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); |
michael@0 | 83 | NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); |
michael@0 | 84 | NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); |
michael@0 | 85 | NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); |
michael@0 | 86 | NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID); |
michael@0 | 87 | NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID); |
michael@0 | 88 | #if defined(MOZ_X11) |
michael@0 | 89 | NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); |
michael@0 | 90 | #endif |
michael@0 | 91 | #ifdef NS_PRINTING |
michael@0 | 92 | NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); |
michael@0 | 93 | NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID); |
michael@0 | 94 | NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); |
michael@0 | 95 | NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); |
michael@0 | 96 | NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID); |
michael@0 | 97 | #endif |
michael@0 | 98 | |
michael@0 | 99 | static const mozilla::Module::CIDEntry kWidgetCIDs[] = { |
michael@0 | 100 | { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor }, |
michael@0 | 101 | { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor }, |
michael@0 | 102 | { &kNS_CHILD_CID, false, nullptr, nsWindowConstructor }, |
michael@0 | 103 | { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor }, |
michael@0 | 104 | { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor }, |
michael@0 | 105 | { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor }, |
michael@0 | 106 | { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceQtConstructor }, |
michael@0 | 107 | { &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerQtConstructor }, |
michael@0 | 108 | { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor }, |
michael@0 | 109 | { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor }, |
michael@0 | 110 | #if defined(MOZ_X11) |
michael@0 | 111 | { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor }, |
michael@0 | 112 | #endif |
michael@0 | 113 | #ifdef NS_PRINTING |
michael@0 | 114 | { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecQtConstructor }, |
michael@0 | 115 | { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceQtConstructor }, |
michael@0 | 116 | { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorQtConstructor }, |
michael@0 | 117 | { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor }, |
michael@0 | 118 | { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsQtConstructor }, |
michael@0 | 119 | #endif |
michael@0 | 120 | { nullptr } |
michael@0 | 121 | }; |
michael@0 | 122 | |
michael@0 | 123 | static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { |
michael@0 | 124 | { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, |
michael@0 | 125 | { "@mozilla.org/widget/appshell/qt;1", &kNS_APPSHELL_CID }, |
michael@0 | 126 | { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID }, |
michael@0 | 127 | { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID }, |
michael@0 | 128 | { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID }, |
michael@0 | 129 | { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, |
michael@0 | 130 | { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, |
michael@0 | 131 | { "@mozilla.org/widgets/child_window/qt;1", &kNS_CHILD_CID }, |
michael@0 | 132 | { "@mozilla.org/widgets/window/qt;1", &kNS_WINDOW_CID }, |
michael@0 | 133 | { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, |
michael@0 | 134 | #if defined(MOZ_X11) |
michael@0 | 135 | { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, |
michael@0 | 136 | #endif |
michael@0 | 137 | #ifdef NS_PRINTING |
michael@0 | 138 | { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID }, |
michael@0 | 139 | { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID }, |
michael@0 | 140 | { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID }, |
michael@0 | 141 | { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, |
michael@0 | 142 | { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID }, |
michael@0 | 143 | #endif |
michael@0 | 144 | { nullptr } |
michael@0 | 145 | }; |
michael@0 | 146 | |
michael@0 | 147 | static void |
michael@0 | 148 | nsWidgetQtModuleDtor() |
michael@0 | 149 | { |
michael@0 | 150 | nsLookAndFeel::Shutdown(); |
michael@0 | 151 | nsAppShellShutdown(); |
michael@0 | 152 | } |
michael@0 | 153 | |
michael@0 | 154 | static const mozilla::Module kWidgetModule = { |
michael@0 | 155 | mozilla::Module::kVersion, |
michael@0 | 156 | kWidgetCIDs, |
michael@0 | 157 | kWidgetContracts, |
michael@0 | 158 | nullptr, |
michael@0 | 159 | nullptr, |
michael@0 | 160 | nsAppShellInit, |
michael@0 | 161 | nsWidgetQtModuleDtor |
michael@0 | 162 | }; |
michael@0 | 163 | |
michael@0 | 164 | NSMODULE_DEFN(nsWidgetQtModule) = &kWidgetModule; |