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"
|
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 "nsPrintOptionsAndroid.h"
|
|
|
|
#include "nsPrintSession.h"
|
|
|
|
#include "nsDeviceContextAndroid.h"
|
2010-09-30 19:37:36 +04:00
|
|
|
#include "nsFilePicker.h"
|
2010-09-17 21:08:08 +04:00
|
|
|
#include "nsHTMLFormatConverter.h"
|
2010-11-10 17:40:00 +03:00
|
|
|
#include "nsIMEPicker.h"
|
2010-10-20 19:19:24 +04:00
|
|
|
#include "nsFilePickerProxy.h"
|
|
|
|
#include "nsXULAppAPI.h"
|
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)
|
2010-11-17 02:33:56 +03:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsAndroid, Init)
|
|
|
|
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)
|
2010-11-10 17:40:00 +03:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIMEPicker)
|
2011-11-15 07:12:14 +04:00
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidBridge)
|
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)
|
2011-01-06 07:54:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-20 19:19:24 +04:00
|
|
|
static nsresult
|
|
|
|
nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
|
|
|
void **aResult)
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
*aResult = nullptr;
|
|
|
|
if (aOuter != nullptr) {
|
2011-04-03 06:14:00 +04:00
|
|
|
return NS_ERROR_NO_AGGREGATION;
|
2010-10-20 19:19:24 +04:00
|
|
|
}
|
|
|
|
nsCOMPtr<nsIFilePicker> picker;
|
2011-04-03 06:14:00 +04:00
|
|
|
|
|
|
|
if (XRE_GetProcessType() == GeckoProcessType_Content)
|
|
|
|
picker = new nsFilePickerProxy();
|
|
|
|
else
|
|
|
|
picker = new nsFilePicker;
|
2010-10-20 19:19:24 +04:00
|
|
|
|
|
|
|
return picker->QueryInterface(aIID, aResult);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
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-30 19:37:36 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
|
2010-09-17 21:08:08 +04:00
|
|
|
NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
|
2010-11-10 17:40:00 +03:00
|
|
|
NS_DEFINE_NAMED_CID(NS_IMEPICKER_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);
|
2010-06-04 00:56:36 +04:00
|
|
|
|
2010-07-02 22:19:50 +04:00
|
|
|
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
|
|
|
{ &kNS_WINDOW_CID, false, NULL, nsWindowConstructor },
|
|
|
|
{ &kNS_CHILD_CID, false, NULL, nsWindowConstructor },
|
|
|
|
{ &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor },
|
|
|
|
{ &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerAndroidConstructor },
|
|
|
|
{ &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceAndroidConstructor },
|
2010-08-27 03:43:23 +04:00
|
|
|
{ &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor },
|
|
|
|
{ &kNS_CLIPBOARD_CID, false, NULL, nsClipboardConstructor },
|
|
|
|
{ &kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor },
|
2010-11-17 02:33:56 +03:00
|
|
|
{ &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsAndroidConstructor },
|
|
|
|
{ &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor },
|
|
|
|
{ &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecAndroidConstructor },
|
2010-09-30 19:37:36 +04:00
|
|
|
{ &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor },
|
2010-09-17 21:08:08 +04:00
|
|
|
{ &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor },
|
2010-11-10 17:40:00 +03:00
|
|
|
{ &kNS_IMEPICKER_CID, false, NULL, nsIMEPickerConstructor },
|
2011-01-06 07:54:31 +03:00
|
|
|
{ &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor },
|
2011-11-15 07:12:14 +04:00
|
|
|
{ &kNS_ANDROIDBRIDGE_CID, false, NULL, nsAndroidBridgeConstructor },
|
2010-07-02 22:19:50 +04:00
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
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 },
|
|
|
|
{ "@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-30 19:37:36 +04:00
|
|
|
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID },
|
2010-09-17 21:08:08 +04:00
|
|
|
{ "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
|
2010-11-10 17:40:00 +03:00
|
|
|
{ "@mozilla.org/imepicker;1", &kNS_IMEPICKER_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 },
|
2010-07-02 22:19:50 +04:00
|
|
|
{ NULL }
|
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
|
|
|
{
|
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,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
nsAppShellInit,
|
|
|
|
nsWidgetAndroidModuleDtor
|
|
|
|
};
|
2010-06-04 00:56:36 +04:00
|
|
|
|
2010-07-02 22:19:50 +04:00
|
|
|
NSMODULE_DEFN(nsWidgetAndroidModule) = &kWidgetModule;
|