2010-06-04 00:56:36 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-06-04 00:56:36 +04:00
|
|
|
|
2010-07-02 22:19:50 +04:00
|
|
|
#include "mozilla/ModuleUtils.h"
|
2015-02-19 09:50:19 +03:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
2010-06-04 00:56:36 +04:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsWidgetsCID.h"
|
|
|
|
#include "nsAppShell.h"
|
2011-11-15 07:12:14 +04:00
|
|
|
#include "AndroidBridge.h"
|
2010-06-04 00:56:36 +04:00
|
|
|
|
|
|
|
#include "nsWindow.h"
|
|
|
|
#include "nsLookAndFeel.h"
|
|
|
|
#include "nsAppShellSingleton.h"
|
|
|
|
#include "nsScreenManagerAndroid.h"
|
|
|
|
|
|
|
|
#include "nsIdleServiceAndroid.h"
|
2010-08-27 03:43:23 +04:00
|
|
|
#include "nsClipboard.h"
|
|
|
|
#include "nsClipboardHelper.h"
|
|
|
|
#include "nsTransferable.h"
|
2010-11-17 02:33:56 +03:00
|
|
|
#include "nsPrintSession.h"
|
2017-12-19 13:06:39 +03:00
|
|
|
#include "nsPrintSettingsServiceAndroid.h"
|
2010-11-17 02:33:56 +03:00
|
|
|
#include "nsDeviceContextAndroid.h"
|
2010-09-17 21:08:08 +04:00
|
|
|
#include "nsHTMLFormatConverter.h"
|
2010-10-20 19:19:24 +04:00
|
|
|
#include "nsXULAppAPI.h"
|
2014-06-04 23:28:04 +04:00
|
|
|
#include "nsAndroidProtocolHandler.h"
|
2010-06-04 00:56:36 +04:00
|
|
|
|
2016-08-04 16:17:54 +03:00
|
|
|
#include "nsToolkitCompsCID.h"
|
|
|
|
#include "AndroidAlerts.h"
|
2017-09-05 17:44:42 +03:00
|
|
|
#include "nsNativeThemeAndroid.h"
|
2016-08-04 16:17:54 +03:00
|
|
|
|
2010-06-04 00:56:36 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerAndroid)
|
2012-06-29 12:32:21 +04:00
|
|
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceAndroid, nsIdleServiceAndroid::GetInstance)
|
2010-08-27 03:43:23 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
|
2017-12-19 13:42:15 +03:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceAndroid, Init)
|
2010-11-17 02:33:56 +03:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecAndroid)
|
2010-09-17 21:08:08 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
2011-11-15 07:12:14 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidBridge)
|
2014-06-04 23:28:04 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidProtocolHandler)
|
2010-06-04 00:56:36 +04:00
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
#include "GfxInfo.h"
|
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
2011-01-21 00:27:22 +03:00
|
|
|
// This constructor should really be shared with all platforms.
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
|
2016-08-04 16:17:54 +03:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(AndroidAlerts)
|
2011-01-06 07:54:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-05 17:44:42 +03:00
|
|
|
static nsresult
|
|
|
|
nsNativeThemeAndroidConstructor(nsISupports *aOuter, REFNSIID aIID,
|
|
|
|
void **aResult)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
if (aOuter) {
|
|
|
|
rv = NS_ERROR_NO_AGGREGATION;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aResult = nullptr;
|
|
|
|
nsNativeThemeAndroid* inst = new nsNativeThemeAndroid();
|
|
|
|
NS_ADDREF(inst);
|
|
|
|
rv = inst->QueryInterface(aIID, aResult);
|
|
|
|
NS_RELEASE(inst);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2010-07-02 22:19:50 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_CHILD_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
|
2017-09-05 17:44:42 +03:00
|
|
|
NS_DEFINE_NAMED_CID(NS_THEMERENDERER_CID);
|
2010-07-02 22:19:50 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
|
2010-08-27 03:43:23 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
|
2010-11-17 02:33:56 +03:00
|
|
|
NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
|
|
|
|
NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
|
2010-09-17 21:08:08 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
|
2011-11-15 07:12:14 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_ANDROIDBRIDGE_CID);
|
2014-06-04 23:28:04 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_ANDROIDPROTOCOLHANDLER_CID);
|
2016-08-04 16:17:54 +03:00
|
|
|
NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
|
2010-06-04 00:56:36 +04:00
|
|
|
|
2010-07-02 22:19:50 +04:00
|
|
|
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
2013-10-11 00:42:52 +04:00
|
|
|
{ &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor },
|
|
|
|
{ &kNS_CHILD_CID, false, nullptr, nsWindowConstructor },
|
|
|
|
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
|
|
|
|
{ &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerAndroidConstructor },
|
2017-09-05 17:44:42 +03:00
|
|
|
{ &kNS_THEMERENDERER_CID, false, nullptr, nsNativeThemeAndroidConstructor },
|
2013-10-11 00:42:52 +04:00
|
|
|
{ &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceAndroidConstructor },
|
|
|
|
{ &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
|
|
|
|
{ &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor },
|
|
|
|
{ &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor },
|
2017-12-19 13:42:15 +03:00
|
|
|
{ &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintSettingsServiceAndroidConstructor },
|
2013-10-11 00:42:52 +04:00
|
|
|
{ &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
|
|
|
|
{ &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecAndroidConstructor },
|
|
|
|
{ &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
|
|
|
|
{ &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
|
|
|
|
{ &kNS_ANDROIDBRIDGE_CID, false, nullptr, nsAndroidBridgeConstructor },
|
2014-06-04 23:28:04 +04:00
|
|
|
{ &kNS_ANDROIDPROTOCOLHANDLER_CID, false, nullptr, nsAndroidProtocolHandlerConstructor },
|
2016-08-04 16:17:54 +03:00
|
|
|
{ &kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, mozilla::widget::AndroidAlertsConstructor },
|
2013-10-11 00:42:52 +04:00
|
|
|
{ nullptr }
|
2010-07-02 22:19:50 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
|
|
|
{ "@mozilla.org/widgets/window/android;1", &kNS_WINDOW_CID },
|
|
|
|
{ "@mozilla.org/widgets/child_window/android;1", &kNS_CHILD_CID },
|
|
|
|
{ "@mozilla.org/widget/appshell/android;1", &kNS_APPSHELL_CID },
|
|
|
|
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID },
|
2017-09-05 17:44:42 +03:00
|
|
|
{ "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID },
|
2010-07-02 22:19:50 +04:00
|
|
|
{ "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
|
2010-08-27 03:43:23 +04:00
|
|
|
{ "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
|
|
|
|
{ "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID },
|
|
|
|
{ "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID },
|
2010-11-17 02:33:56 +03:00
|
|
|
{ "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
|
|
|
|
{ "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
|
|
|
|
{ "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
|
2010-09-17 21:08:08 +04:00
|
|
|
{ "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
|
2011-01-06 07:54:31 +03:00
|
|
|
{ "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
|
2011-11-15 07:12:14 +04:00
|
|
|
{ "@mozilla.org/android/bridge;1", &kNS_ANDROIDBRIDGE_CID },
|
2014-06-04 23:28:04 +04:00
|
|
|
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "android", &kNS_ANDROIDPROTOCOLHANDLER_CID },
|
2016-08-04 16:17:54 +03:00
|
|
|
{ NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID },
|
2013-10-11 00:42:52 +04:00
|
|
|
{ nullptr }
|
2010-06-04 00:56:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2010-07-02 22:19:50 +04:00
|
|
|
nsWidgetAndroidModuleDtor()
|
2010-06-04 00:56:36 +04:00
|
|
|
{
|
2015-02-19 09:50:19 +03:00
|
|
|
// Shutdown all XP level widget classes.
|
|
|
|
mozilla::widget::WidgetUtils::Shutdown();
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
nsLookAndFeel::Shutdown();
|
2010-07-02 22:19:50 +04:00
|
|
|
nsAppShellShutdown();
|
2010-06-04 00:56:36 +04:00
|
|
|
}
|
|
|
|
|
2010-07-02 22:19:50 +04:00
|
|
|
static const mozilla::Module kWidgetModule = {
|
|
|
|
mozilla::Module::kVersion,
|
|
|
|
kWidgetCIDs,
|
|
|
|
kWidgetContracts,
|
2013-10-11 00:42:52 +04:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2010-07-02 22:19:50 +04:00
|
|
|
nsAppShellInit,
|
|
|
|
nsWidgetAndroidModuleDtor
|
|
|
|
};
|
2010-06-04 00:56:36 +04:00
|
|
|
|
2010-07-02 22:19:50 +04:00
|
|
|
NSMODULE_DEFN(nsWidgetAndroidModule) = &kWidgetModule;
|