зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1524687: Part 9 - Convert gtk widget module to static registration. r=erahm
--HG-- extra : rebase_source : 7cbb575ae4ab96258bf827ef826aec18ccfba554 extra : source : 9c24919ac5c2056255dec5725af1fa1548f29ca2
This commit is contained in:
Родитель
6d47286458
Коммит
f349027d4c
|
@ -720,7 +720,7 @@ target="_blank">Mozilla Bug 715041</a>
|
|||
}
|
||||
|
||||
try {
|
||||
componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, oldIdleServiceFactoryObj);
|
||||
componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, null);
|
||||
}
|
||||
catch(err) {
|
||||
dump("test_bug715041.xul: ShiftLocalTimerBackCleanUp() Failed to register factory, original idle service!\n");
|
||||
|
@ -784,13 +784,6 @@ target="_blank">Mozilla Bug 715041</a>
|
|||
dump("test_bug715041.xul: Failed to convert ID to CID for old idle service.\n");
|
||||
}
|
||||
|
||||
try {
|
||||
componentMgr.unregisterFactory(oldIdleServiceCID, oldIdleServiceFactoryObj);
|
||||
}
|
||||
catch(err) {
|
||||
dump("test_bug715041.xul: Failed to unregister old idle service factory object!\n");
|
||||
}
|
||||
|
||||
try {
|
||||
componentMgr.registerFactory(idleServiceCID, "Test Simple Idle/Back Notifications", idleServiceContractID, idleServiceObj);
|
||||
}
|
||||
|
|
|
@ -765,7 +765,7 @@ target="_blank">Mozilla Bug 715041</a>
|
|||
}
|
||||
|
||||
try {
|
||||
componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, oldIdleServiceFactoryObj);
|
||||
componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, null);
|
||||
}
|
||||
catch(err) {
|
||||
dump("test_bug715041_removal.xul: RemoveLastAddLastCleanUp() Failed to register factory, original idle service!\n");
|
||||
|
@ -812,13 +812,6 @@ target="_blank">Mozilla Bug 715041</a>
|
|||
dump("test_bug715041._removalxul: Failed to convert ID to CID for old idle service.\n");
|
||||
}
|
||||
|
||||
try {
|
||||
componentMgr.unregisterFactory(oldIdleServiceCID, oldIdleServiceFactoryObj);
|
||||
}
|
||||
catch(err) {
|
||||
dump("test_bug715041_removal.xul: Failed to unregister old idle service factory object!\n");
|
||||
}
|
||||
|
||||
try {
|
||||
componentMgr.registerFactory(idleServiceCID, "Test Simple Idle/Back Notifications", idleServiceContractID, idleServiceObj);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ const CONTRACT_ID = "@mozilla.org/colorpicker;1";
|
|||
Cu.forcePermissiveCOWs();
|
||||
|
||||
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
var oldClassID = "", oldFactory = null;
|
||||
var oldClassID = "";
|
||||
var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID();
|
||||
var newFactory = function(window) {
|
||||
return {
|
||||
|
@ -36,16 +36,11 @@ var MockColorPicker = {
|
|||
if (!registrar.isCIDRegistered(newClassID)) {
|
||||
try {
|
||||
oldClassID = registrar.contractIDToCID(CONTRACT_ID);
|
||||
oldFactory = Cm.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory);
|
||||
} catch (ex) {
|
||||
oldClassID = "";
|
||||
oldFactory = null;
|
||||
dump("TEST-INFO | can't get colorpicker registered component, " +
|
||||
"assuming there is none");
|
||||
}
|
||||
if (oldClassID != "" && oldFactory != null) {
|
||||
registrar.unregisterFactory(oldClassID, oldFactory);
|
||||
}
|
||||
registrar.registerFactory(newClassID, "", CONTRACT_ID, this.factory);
|
||||
}
|
||||
},
|
||||
|
@ -63,8 +58,8 @@ var MockColorPicker = {
|
|||
this.factory = null;
|
||||
|
||||
registrar.unregisterFactory(newClassID, previousFactory);
|
||||
if (oldClassID != "" && oldFactory != null) {
|
||||
registrar.registerFactory(oldClassID, "", CONTRACT_ID, oldFactory);
|
||||
if (oldClassID != "") {
|
||||
registrar.registerFactory(oldClassID, "", CONTRACT_ID, null);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
Cu.forcePermissiveCOWs();
|
||||
|
||||
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
var oldClassID, oldFactory;
|
||||
var oldClassID;
|
||||
var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID();
|
||||
var newFactory = function(window) {
|
||||
return {
|
||||
|
@ -59,8 +59,6 @@ var MockFilePicker = {
|
|||
this.factory = newFactory(window);
|
||||
if (!registrar.isCIDRegistered(newClassID)) {
|
||||
oldClassID = registrar.contractIDToCID(CONTRACT_ID);
|
||||
oldFactory = Cm.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory);
|
||||
registrar.unregisterFactory(oldClassID, oldFactory);
|
||||
registrar.registerFactory(newClassID, "", CONTRACT_ID, this.factory);
|
||||
}
|
||||
},
|
||||
|
@ -84,9 +82,9 @@ var MockFilePicker = {
|
|||
var previousFactory = this.factory;
|
||||
this.reset();
|
||||
this.factory = null;
|
||||
if (oldFactory) {
|
||||
if (oldClassID) {
|
||||
registrar.unregisterFactory(newClassID, previousFactory);
|
||||
registrar.registerFactory(oldClassID, "", CONTRACT_ID, oldFactory);
|
||||
registrar.registerFactory(oldClassID, "", CONTRACT_ID, null);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "nsWidgetsCID.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsICrashReporter.h"
|
||||
#include "nsIIdleService.h"
|
||||
|
||||
#ifndef TEST_NAME
|
||||
# error "Must #define TEST_NAME before including places_test_harness_tail.h"
|
||||
|
@ -53,15 +54,9 @@ void do_test_finished() {
|
|||
|
||||
void disable_idle_service() {
|
||||
(void)fprintf(stderr, TEST_INFO_STR "Disabling Idle Service.\n");
|
||||
static NS_DEFINE_IID(kIdleCID, NS_IDLE_SERVICE_CID);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFactory> idleFactory = do_GetClassObject(kIdleCID, &rv);
|
||||
do_check_success(rv);
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||
do_check_success(rv);
|
||||
rv = registrar->UnregisterFactory(kIdleCID, idleFactory);
|
||||
do_check_success(rv);
|
||||
|
||||
nsCOMPtr<nsIIdleService> idle = do_GetService("@mozilla.org/widget/idleservice;1");
|
||||
idle->SetDisabled(true);
|
||||
}
|
||||
|
||||
TEST(IHistory, Test) {
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
Headers = [
|
||||
'/widget/gtk/nsWidgetFactory.h',
|
||||
]
|
||||
|
||||
InitFunc = 'nsWidgetGtk2ModuleCtor'
|
||||
UnloadFunc = 'nsWidgetGtk2ModuleDtor'
|
||||
|
||||
Classes = [
|
||||
{
|
||||
'cid': '{2d96b3df-c051-11d1-a827-0040959a28c9}',
|
||||
'contract_ids': ['@mozilla.org/widget/appshell/gtk;1'],
|
||||
'legacy_constructor': 'nsAppShellConstructor',
|
||||
'headers': ['/widget/gtk/nsWidgetFactory.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}',
|
||||
'contract_ids': ['@mozilla.org/gfx/screenmanager;1'],
|
||||
'singleton': True,
|
||||
'type': 'mozilla::widget::ScreenManager',
|
||||
'headers': ['mozilla/StaticPtr.h', 'mozilla/widget/ScreenManager.h'],
|
||||
'constructor': 'mozilla::widget::ScreenManager::GetAddRefedSingleton',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{a9339876-0027-430f-b953-84c9c11c2da3}',
|
||||
'contract_ids': ['@mozilla.org/widget/taskbarprogress/gtk;1'],
|
||||
'type': 'TaskbarProgress',
|
||||
'headers': ['/widget/gtk/TaskbarProgress.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{0f872c8c-3ee6-46bd-92a2-69652c6b474e}',
|
||||
'contract_ids': ['@mozilla.org/colorpicker;1'],
|
||||
'type': 'nsColorPicker',
|
||||
'headers': ['/widget/gtk/nsColorPicker.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{bd57cee8-1dd1-11b2-9fe7-95cf4709aea3}',
|
||||
'contract_ids': ['@mozilla.org/filepicker;1'],
|
||||
'type': 'nsFilePicker',
|
||||
'headers': ['/widget/gtk/nsFilePicker.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{948a0023-e3a7-11d2-96cf-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/htmlformatconverter;1'],
|
||||
'type': 'nsHTMLFormatConverter',
|
||||
'headers': ['/widget/nsHTMLFormatConverter.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}',
|
||||
'contract_ids': ['@mozilla.org/sound;1'],
|
||||
'singleton': True,
|
||||
'type': 'nsISound',
|
||||
'constructor': 'nsSound::GetInstance',
|
||||
'headers': ['/widget/gtk/nsSound.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{fc2389b8-c650-4093-9e42-b05e5f0685b7}',
|
||||
'contract_ids': ['@mozilla.org/widget/image-to-gdk-pixbuf;1'],
|
||||
'type': 'nsImageToPixbuf',
|
||||
'headers': ['/widget/gtk/nsImageToPixbuf.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{8b5314bc-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/transferable;1'],
|
||||
'type': 'nsTransferable',
|
||||
'headers': ['/widget/nsTransferable.h'],
|
||||
},
|
||||
]
|
||||
|
||||
if defined('MOZ_X11'):
|
||||
Classes += [
|
||||
{
|
||||
'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboard;1'],
|
||||
'type': 'nsIClipboard',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboardhelper;1'],
|
||||
'type': 'nsClipboardHelper',
|
||||
'headers': ['/widget/nsClipboardHelper.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{8b5314bb-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/dragservice;1'],
|
||||
'singleton': True,
|
||||
'type': 'nsDragService',
|
||||
'headers': ['/widget/gtk/nsDragService.h'],
|
||||
'constructor': 'nsDragService::GetInstance',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{d755a760-9f27-11df-0800-200c9a664242}',
|
||||
'contract_ids': ['@mozilla.org/gfx/info;1'],
|
||||
'type': 'mozilla::widget::GfxInfo',
|
||||
'headers': ['/widget/GfxInfoX11.h'],
|
||||
'init_method': 'Init',
|
||||
},
|
||||
{
|
||||
'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}',
|
||||
'contract_ids': ['@mozilla.org/widget/idleservice;1'],
|
||||
'singleton': True,
|
||||
'type': 'nsIdleService',
|
||||
'headers': ['/widget/gtk/nsIdleServiceGTK.h'],
|
||||
'constructor': 'nsIdleServiceGTK::GetInstance',
|
||||
},
|
||||
]
|
||||
|
||||
if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'gtk':
|
||||
Classes += [
|
||||
{
|
||||
'cid': '{e221df9b-3d66-4045-9a66-5720949f8d10}',
|
||||
'contract_ids': ['@mozilla.org/applicationchooser;1'],
|
||||
'type': 'nsApplicationChooser',
|
||||
'headers': ['/widget/gtk/nsApplicationChooser.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
]
|
||||
|
||||
if defined('NS_PRINTING'):
|
||||
Classes += [
|
||||
{
|
||||
'cid': '{d3f69889-e13a-4321-980c-a39332e21f34}',
|
||||
'contract_ids': ['@mozilla.org/gfx/devicecontextspec;1'],
|
||||
'type': 'nsDeviceContextSpecGTK',
|
||||
'headers': ['/widget/gtk/nsDeviceContextSpecG.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{06beec76-a183-4d9f-85dd-085f26da565a}',
|
||||
'contract_ids': ['@mozilla.org/widget/printdialog-service;1'],
|
||||
'type': 'nsPrintDialogServiceGTK',
|
||||
'headers': ['/widget/gtk/nsPrintDialogGTK.h'],
|
||||
'init_method': 'Init',
|
||||
},
|
||||
{
|
||||
'cid': '{2f977d53-5485-11d4-87e2-0010a4e75ef2}',
|
||||
'contract_ids': ['@mozilla.org/gfx/printsession;1'],
|
||||
'type': 'nsPrintSession',
|
||||
'headers': ['/widget/nsPrintSession.h'],
|
||||
'init_method': 'Init',
|
||||
},
|
||||
{
|
||||
'cid': '{841387c8-72e6-484b-9296-bf6eea80d58a}',
|
||||
'contract_ids': ['@mozilla.org/gfx/printsettings-service;1'],
|
||||
'type': 'nsPrintSettingsServiceGTK',
|
||||
'headers': ['/widget/gtk/nsPrintSettingsServiceGTK.h'],
|
||||
'init_method': 'Init',
|
||||
},
|
||||
{
|
||||
'cid': '{a6cf9129-15b3-11d2-932e-00805f8add32}',
|
||||
'contract_ids': ['@mozilla.org/gfx/printerenumerator;1'],
|
||||
'type': 'nsPrinterEnumeratorGTK',
|
||||
'headers': ['/widget/gtk/nsDeviceContextSpecG.h'],
|
||||
},
|
||||
]
|
|
@ -112,6 +112,10 @@ UNIFIED_SOURCES += [
|
|||
'WidgetStyleCache.cpp',
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
'components.conf',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
* 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/. */
|
||||
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "nsWidgetFactory.h"
|
||||
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/WidgetUtils.h"
|
||||
#include "NativeKeyBindings.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
@ -15,41 +17,18 @@
|
|||
#include "nsGtkKeyUtils.h"
|
||||
#include "nsLookAndFeel.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsTransferable.h"
|
||||
#include "nsHTMLFormatConverter.h"
|
||||
#include "HeadlessClipboard.h"
|
||||
#include "IMContextWrapper.h"
|
||||
#ifdef MOZ_X11
|
||||
# include "nsClipboardHelper.h"
|
||||
# include "nsClipboard.h"
|
||||
# include "nsDragService.h"
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
# include "nsApplicationChooser.h"
|
||||
#endif
|
||||
#include "TaskbarProgress.h"
|
||||
#include "nsColorPicker.h"
|
||||
#include "nsFilePicker.h"
|
||||
#include "nsSound.h"
|
||||
#include "nsGTKToolkit.h"
|
||||
#include "WakeLockListener.h"
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
# include "nsPrintSettingsServiceGTK.h"
|
||||
# include "nsPrintSession.h"
|
||||
# include "nsDeviceContextSpecG.h"
|
||||
#endif
|
||||
|
||||
#include "nsImageToPixbuf.h"
|
||||
#include "nsPrintDialogGTK.h"
|
||||
|
||||
#if defined(MOZ_X11)
|
||||
# include "nsIdleServiceGTK.h"
|
||||
# include "GfxInfoX11.h"
|
||||
#endif
|
||||
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/widget/ScreenManager.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -57,215 +36,26 @@
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
||||
#ifdef MOZ_X11
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceGTK,
|
||||
nsIdleServiceGTK::GetInstance)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDragService,
|
||||
nsDragService::GetInstance)
|
||||
#endif
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISound, nsSound::GetInstance)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager,
|
||||
ScreenManager::GetAddRefedSingleton)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageToPixbuf)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(TaskbarProgress)
|
||||
|
||||
#if defined(MOZ_X11)
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
// This constructor should really be shared with all platforms.
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
#endif
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecGTK)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceGTK, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorGTK)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceGTK, Init)
|
||||
#endif
|
||||
|
||||
static nsresult nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult) {
|
||||
*aResult = nullptr;
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFilePicker> picker = new nsFilePicker;
|
||||
|
||||
return picker->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
static nsresult nsApplicationChooserConstructor(nsISupports *aOuter,
|
||||
REFNSIID aIID, void **aResult) {
|
||||
*aResult = nullptr;
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
nsCOMPtr<nsIApplicationChooser> chooser = new nsApplicationChooser;
|
||||
|
||||
if (!chooser) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return chooser->QueryInterface(aIID, aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
static nsresult nsColorPickerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult) {
|
||||
*aResult = nullptr;
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIColorPicker> picker = new nsColorPicker;
|
||||
|
||||
if (!picker) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return picker->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
static nsresult nsClipboardConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult) {
|
||||
*aResult = nullptr;
|
||||
if (aOuter != nullptr) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
||||
NS_IMPL_COMPONENT_FACTORY(nsIClipboard) {
|
||||
nsCOMPtr<nsIClipboard> inst;
|
||||
if (gfxPlatform::IsHeadless()) {
|
||||
inst = new HeadlessClipboard();
|
||||
} else {
|
||||
RefPtr<nsClipboard> clipboard = new nsClipboard();
|
||||
nsresult rv = clipboard->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
inst = clipboard;
|
||||
auto clipboard = MakeRefPtr<nsClipboard>();
|
||||
if (NS_FAILED(clipboard->Init())) {
|
||||
return nullptr;
|
||||
}
|
||||
inst = clipboard.forget();
|
||||
}
|
||||
|
||||
return inst->QueryInterface(aIID, aResult);
|
||||
return inst.forget().downcast<nsISupports>();
|
||||
}
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
NS_DEFINE_NAMED_CID(NS_APPLICATIONCHOOSER_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_GTK_TASKBARPROGRESS_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SOUND_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
|
||||
#ifdef MOZ_X11
|
||||
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
|
||||
#ifdef NS_PRINTING
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_IMAGE_TO_PIXBUF_CID);
|
||||
#if defined(MOZ_X11)
|
||||
NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
|
||||
#endif
|
||||
|
||||
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{&kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor,
|
||||
Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS},
|
||||
{&kNS_COLORPICKER_CID, false, nullptr, nsColorPickerConstructor,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_FILEPICKER_CID, false, nullptr, nsFilePickerConstructor,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
{&kNS_APPLICATIONCHOOSER_CID, false, nullptr,
|
||||
nsApplicationChooserConstructor, Module::MAIN_PROCESS_ONLY},
|
||||
#endif
|
||||
{&kNS_GTK_TASKBARPROGRESS_CID, false, nullptr, TaskbarProgressConstructor},
|
||||
{&kNS_SOUND_CID, false, nullptr, nsISoundConstructor,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor},
|
||||
#ifdef MOZ_X11
|
||||
{&kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor},
|
||||
{&kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
#endif
|
||||
{&kNS_HTMLFORMATCONVERTER_CID, false, nullptr,
|
||||
nsHTMLFormatConverterConstructor},
|
||||
{&kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
#ifdef NS_PRINTING
|
||||
{&kNS_PRINTSETTINGSSERVICE_CID, false, nullptr,
|
||||
nsPrintSettingsServiceGTKConstructor},
|
||||
{&kNS_PRINTER_ENUMERATOR_CID, false, nullptr,
|
||||
nsPrinterEnumeratorGTKConstructor},
|
||||
{&kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor},
|
||||
{&kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr,
|
||||
nsDeviceContextSpecGTKConstructor},
|
||||
{&kNS_PRINTDIALOGSERVICE_CID, false, nullptr,
|
||||
nsPrintDialogServiceGTKConstructor},
|
||||
#endif
|
||||
{&kNS_IMAGE_TO_PIXBUF_CID, false, nullptr, nsImageToPixbufConstructor},
|
||||
#if defined(MOZ_X11)
|
||||
{&kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGTKConstructor},
|
||||
{&kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor},
|
||||
#endif
|
||||
{nullptr}};
|
||||
nsresult nsWidgetGtk2ModuleCtor() { return nsAppShellInit(); }
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
||||
{"@mozilla.org/widget/appshell/gtk;1", &kNS_APPSHELL_CID,
|
||||
Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS},
|
||||
{"@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
{"@mozilla.org/applicationchooser;1", &kNS_APPLICATIONCHOOSER_CID,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
#endif
|
||||
{"@mozilla.org/widget/taskbarprogress/gtk;1", &kNS_GTK_TASKBARPROGRESS_CID},
|
||||
{"@mozilla.org/sound;1", &kNS_SOUND_CID, Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID},
|
||||
#ifdef MOZ_X11
|
||||
{"@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID},
|
||||
{"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
#endif
|
||||
{"@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID},
|
||||
{"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
|
||||
Module::MAIN_PROCESS_ONLY},
|
||||
#ifdef NS_PRINTING
|
||||
{"@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID},
|
||||
{"@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID},
|
||||
{"@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID},
|
||||
{"@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID},
|
||||
{NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID},
|
||||
#endif
|
||||
{"@mozilla.org/widget/image-to-gdk-pixbuf;1", &kNS_IMAGE_TO_PIXBUF_CID},
|
||||
#if defined(MOZ_X11)
|
||||
{"@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID},
|
||||
{"@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID},
|
||||
#endif
|
||||
{nullptr}};
|
||||
|
||||
static void nsWidgetGtk2ModuleDtor() {
|
||||
void nsWidgetGtk2ModuleDtor() {
|
||||
// Shutdown all XP level widget classes.
|
||||
WidgetUtils::Shutdown();
|
||||
|
||||
|
@ -282,15 +72,3 @@ static void nsWidgetGtk2ModuleDtor() {
|
|||
WakeLockListener::Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
static const mozilla::Module kWidgetModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kWidgetCIDs,
|
||||
kWidgetContracts,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nsAppShellInit,
|
||||
nsWidgetGtk2ModuleDtor,
|
||||
Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS};
|
||||
|
||||
NSMODULE_DEFN(nsWidgetGtk2Module) = &kWidgetModule;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* 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/. */
|
||||
|
||||
#ifndef widget_gtk_nsWidgetFactory_h
|
||||
#define widget_gtk_nsWidgetFactory_h
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
nsresult nsAppShellConstructor(nsISupports *outer, const nsIID &iid,
|
||||
void **result);
|
||||
|
||||
nsresult nsWidgetGtk2ModuleCtor();
|
||||
void nsWidgetGtk2ModuleDtor();
|
||||
|
||||
#endif // defined widget_gtk_nsWidgetFactory_h
|
|
@ -127,9 +127,12 @@ EXPORTS += [
|
|||
'GfxInfoBase.h',
|
||||
'GfxInfoCollector.h',
|
||||
'InputData.h',
|
||||
'nsBaseDragService.h',
|
||||
'nsBaseFilePicker.h',
|
||||
'nsBaseScreen.h',
|
||||
'nsBaseWidget.h',
|
||||
'nsIDeviceContextSpec.h',
|
||||
'nsIdleService.h',
|
||||
'nsIKeyEventInPluginCallback.h',
|
||||
'nsIPluginWidget.h',
|
||||
'nsIPrintDialogService.h',
|
||||
|
|
|
@ -50,8 +50,8 @@ static nsresult nsAppShellInit() {
|
|||
|
||||
static void nsAppShellShutdown() { NS_RELEASE(sAppShell); }
|
||||
|
||||
static nsresult nsAppShellConstructor(nsISupports *outer, const nsIID &iid,
|
||||
void **result) {
|
||||
nsresult nsAppShellConstructor(nsISupports *outer, const nsIID &iid,
|
||||
void **result) {
|
||||
NS_ENSURE_TRUE(!outer, NS_ERROR_NO_AGGREGATION);
|
||||
NS_ENSURE_TRUE(sAppShell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
|
|
@ -64,6 +64,14 @@ interface nsIIdleService : nsISupports
|
|||
* just as many times.
|
||||
*/
|
||||
void removeIdleObserver(in nsIObserver observer, in unsigned long time);
|
||||
|
||||
/**
|
||||
* If true, the idle service is temporarily disabled, and all idle events
|
||||
* will be ignored.
|
||||
*
|
||||
* This should only be used in automation.
|
||||
*/
|
||||
attribute boolean disabled;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
|
@ -624,6 +624,16 @@ bool nsIdleService::UsePollMode() {
|
|||
return PollIdleTime(&dummy);
|
||||
}
|
||||
|
||||
nsresult nsIdleService::GetDisabled(bool* aResult) {
|
||||
*aResult = mDisabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsIdleService::SetDisabled(bool aDisabled) {
|
||||
mDisabled = aDisabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsIdleService::StaticIdleTimerCallback(nsITimer* aTimer, void* aClosure) {
|
||||
static_cast<nsIdleService*>(aClosure)->IdleTimerCallback();
|
||||
}
|
||||
|
@ -678,6 +688,14 @@ void nsIdleService::IdleTimerCallback(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (mDisabled) {
|
||||
MOZ_LOG(sLog, LogLevel::Info,
|
||||
("idleService: Skipping idle callback while disabled"));
|
||||
|
||||
ReconfigureTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
// Tell expired listeners they are expired,and find the next timeout
|
||||
Telemetry::AutoTimer<Telemetry::IDLE_NOTIFY_IDLE_MS> timer;
|
||||
|
||||
|
|
|
@ -194,6 +194,12 @@ class nsIdleService : public nsIIdleServiceInternal {
|
|||
*/
|
||||
uint32_t mDeltaToNextIdleSwitchInS;
|
||||
|
||||
/**
|
||||
* If true, the idle service is temporarily disabled, and all idle events
|
||||
* will be ignored.
|
||||
*/
|
||||
bool mDisabled = false;
|
||||
|
||||
/**
|
||||
* Absolute value for when the last user interaction took place.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче