Bug 966467 - Enable some service proxies only in content processes (r=vlad)

This commit is contained in:
Bill McCloskey 2014-02-09 16:13:05 -08:00
parent 9cea9b25bb
commit e63f9dd033
4 changed files with 52 additions and 9 deletions

View File

@ -45,6 +45,12 @@
# error Unknown widget module.
#endif
#ifndef MOZ_B2G
#define CONTENT_PROCESS_WIDGET_MODULES MODULE(nsContentProcessWidgetModule)
#else
#define CONTENT_PROCESS_WIDGET_MODULES
#endif
#ifdef ICON_DECODER
#define ICON_MODULE MODULE(nsIconDecoderModule)
#else
@ -199,6 +205,7 @@
MODULE(nsGfxModule) \
PROFILER_MODULE \
WIDGET_MODULES \
CONTENT_PROCESS_WIDGET_MODULES \
ICON_MODULE \
MODULE(nsPluginModule) \
MODULE(nsLayoutModule) \

View File

@ -113,18 +113,14 @@ FilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
}
nsCOMPtr<nsIFilePicker> picker;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
picker = new nsFilePickerProxy();
} else {
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
#ifdef MOZ_METRO
picker = new nsMetroFilePicker;
picker = new nsMetroFilePicker;
#else
NS_RUNTIMEABORT("build does not support metro.");
NS_RUNTIMEABORT("build does not support metro.");
#endif
} else {
picker = new nsFilePicker;
}
} else {
picker = new nsFilePicker;
}
return picker->QueryInterface(aIID, aResult);
}

View File

@ -25,6 +25,7 @@ UNIFIED_SOURCES += [
'nsBaseScreen.cpp',
'nsClipboardHelper.cpp',
'nsClipboardPrivacyHandler.cpp',
'nsContentProcessWidgetFactory.cpp',
'nsFilePickerProxy.cpp',
'nsHTMLFormatConverter.cpp',
'nsIdleService.cpp',

View File

@ -0,0 +1,39 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */
#include "mozilla/ModuleUtils.h"
#include "nsWidgetsCID.h"
#include "nsFilePickerProxy.h"
using namespace mozilla;
#ifndef MOZ_B2G
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::CONTENT_PROCESS_ONLY },
{ nullptr }
};
static const mozilla::Module kWidgetModule = {
mozilla::Module::kVersion,
kWidgetCIDs,
kWidgetContracts
};
NSMODULE_DEFN(nsContentProcessWidgetModule) = &kWidgetModule;
#endif /* MOZ_B2G */