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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "mozilla/ModuleUtils.h" |
michael@0 | 7 | |
michael@0 | 8 | #include "nsCOMPtr.h" |
michael@0 | 9 | #include "nsWidgetsCID.h" |
michael@0 | 10 | #include "nsAppShell.h" |
michael@0 | 11 | #include "AndroidBridge.h" |
michael@0 | 12 | |
michael@0 | 13 | #include "nsWindow.h" |
michael@0 | 14 | #include "nsLookAndFeel.h" |
michael@0 | 15 | #include "nsAppShellSingleton.h" |
michael@0 | 16 | #include "nsScreenManagerAndroid.h" |
michael@0 | 17 | |
michael@0 | 18 | #include "nsIdleServiceAndroid.h" |
michael@0 | 19 | #include "nsClipboard.h" |
michael@0 | 20 | #include "nsClipboardHelper.h" |
michael@0 | 21 | #include "nsTransferable.h" |
michael@0 | 22 | #include "nsPrintOptionsAndroid.h" |
michael@0 | 23 | #include "nsPrintSession.h" |
michael@0 | 24 | #include "nsDeviceContextAndroid.h" |
michael@0 | 25 | #include "nsHTMLFormatConverter.h" |
michael@0 | 26 | #include "nsIMEPicker.h" |
michael@0 | 27 | #include "nsXULAppAPI.h" |
michael@0 | 28 | |
michael@0 | 29 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) |
michael@0 | 30 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerAndroid) |
michael@0 | 31 | NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceAndroid, nsIdleServiceAndroid::GetInstance) |
michael@0 | 32 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) |
michael@0 | 33 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) |
michael@0 | 34 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) |
michael@0 | 35 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsAndroid, Init) |
michael@0 | 36 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) |
michael@0 | 37 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecAndroid) |
michael@0 | 38 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) |
michael@0 | 39 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsIMEPicker) |
michael@0 | 40 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidBridge) |
michael@0 | 41 | |
michael@0 | 42 | #include "GfxInfo.h" |
michael@0 | 43 | namespace mozilla { |
michael@0 | 44 | namespace widget { |
michael@0 | 45 | // This constructor should really be shared with all platforms. |
michael@0 | 46 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) |
michael@0 | 47 | } |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); |
michael@0 | 51 | NS_DEFINE_NAMED_CID(NS_WINDOW_CID); |
michael@0 | 52 | NS_DEFINE_NAMED_CID(NS_CHILD_CID); |
michael@0 | 53 | NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); |
michael@0 | 54 | NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); |
michael@0 | 55 | NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); |
michael@0 | 56 | NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID); |
michael@0 | 57 | NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID); |
michael@0 | 58 | NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); |
michael@0 | 59 | NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); |
michael@0 | 60 | NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); |
michael@0 | 61 | NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); |
michael@0 | 62 | NS_DEFINE_NAMED_CID(NS_IMEPICKER_CID); |
michael@0 | 63 | NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); |
michael@0 | 64 | NS_DEFINE_NAMED_CID(NS_ANDROIDBRIDGE_CID); |
michael@0 | 65 | |
michael@0 | 66 | static const mozilla::Module::CIDEntry kWidgetCIDs[] = { |
michael@0 | 67 | { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor }, |
michael@0 | 68 | { &kNS_CHILD_CID, false, nullptr, nsWindowConstructor }, |
michael@0 | 69 | { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor }, |
michael@0 | 70 | { &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerAndroidConstructor }, |
michael@0 | 71 | { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceAndroidConstructor }, |
michael@0 | 72 | { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor }, |
michael@0 | 73 | { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor }, |
michael@0 | 74 | { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor }, |
michael@0 | 75 | { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsAndroidConstructor }, |
michael@0 | 76 | { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor }, |
michael@0 | 77 | { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecAndroidConstructor }, |
michael@0 | 78 | { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor }, |
michael@0 | 79 | { &kNS_IMEPICKER_CID, false, nullptr, nsIMEPickerConstructor }, |
michael@0 | 80 | { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor }, |
michael@0 | 81 | { &kNS_ANDROIDBRIDGE_CID, false, nullptr, nsAndroidBridgeConstructor }, |
michael@0 | 82 | { nullptr } |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 | static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { |
michael@0 | 86 | { "@mozilla.org/widgets/window/android;1", &kNS_WINDOW_CID }, |
michael@0 | 87 | { "@mozilla.org/widgets/child_window/android;1", &kNS_CHILD_CID }, |
michael@0 | 88 | { "@mozilla.org/widget/appshell/android;1", &kNS_APPSHELL_CID }, |
michael@0 | 89 | { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, |
michael@0 | 90 | { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, |
michael@0 | 91 | { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, |
michael@0 | 92 | { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID }, |
michael@0 | 93 | { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID }, |
michael@0 | 94 | { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID }, |
michael@0 | 95 | { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID }, |
michael@0 | 96 | { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID }, |
michael@0 | 97 | { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, |
michael@0 | 98 | { "@mozilla.org/imepicker;1", &kNS_IMEPICKER_CID }, |
michael@0 | 99 | { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, |
michael@0 | 100 | { "@mozilla.org/android/bridge;1", &kNS_ANDROIDBRIDGE_CID }, |
michael@0 | 101 | { nullptr } |
michael@0 | 102 | }; |
michael@0 | 103 | |
michael@0 | 104 | static void |
michael@0 | 105 | nsWidgetAndroidModuleDtor() |
michael@0 | 106 | { |
michael@0 | 107 | nsLookAndFeel::Shutdown(); |
michael@0 | 108 | nsAppShellShutdown(); |
michael@0 | 109 | } |
michael@0 | 110 | |
michael@0 | 111 | static const mozilla::Module kWidgetModule = { |
michael@0 | 112 | mozilla::Module::kVersion, |
michael@0 | 113 | kWidgetCIDs, |
michael@0 | 114 | kWidgetContracts, |
michael@0 | 115 | nullptr, |
michael@0 | 116 | nullptr, |
michael@0 | 117 | nsAppShellInit, |
michael@0 | 118 | nsWidgetAndroidModuleDtor |
michael@0 | 119 | }; |
michael@0 | 120 | |
michael@0 | 121 | NSMODULE_DEFN(nsWidgetAndroidModule) = &kWidgetModule; |