Skip to content

Commit

Permalink
[embedlite-components] Drop embed C++ FilePicker implementation from …
Browse files Browse the repository at this point in the history
…widget factory. JB#49804

Only GTK builds C++ implementation of the FilePicker in the
toolkit/components/moz.build.

Loading FilePicker offended whole widget factory from being loaded.

[embedlite-components] Fix correct nsClipBoard implementation to be loaded. JB#JB49804
  • Loading branch information
rainemak committed May 15, 2020
1 parent 29e873f commit dce0ba4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 508 deletions.
30 changes: 2 additions & 28 deletions widgetfactory/EmbedWidgetFactoryRegister.cpp
Expand Up @@ -17,15 +17,12 @@
#include "nsILoginManager.h"
#include "nsIFormHistory.h"
#include "nsWidgetsCID.h"
#include "nsFilePicker.h"
#include "nsClipboard.h"

using namespace mozilla::embedlite;

const char* clipBoardCONTRACTID = "@mozilla.org/widget/clipboard;1";
const char* filepickerCONTRACTID = "@mozilla.org/filepicker;1";

NS_GENERIC_FACTORY_CONSTRUCTOR(nsEmbedFilePicker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEmbedClipboard)

EmbedWidgetFactoryRegister::EmbedWidgetFactoryRegister()
Expand All @@ -49,34 +46,12 @@ EmbedWidgetFactoryRegister::Init()
rv = NS_GetComponentManager (getter_AddRefs (cm));
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);

nsCOMPtr<nsIFactory> fp = new mozilla::embedlite::EmbedliteGenericFactory(nsEmbedFilePickerConstructor);
nsCOMPtr<nsIFactory> fp = new mozilla::embedlite::EmbedliteGenericFactory(nsEmbedClipboardConstructor);
if (!fp) {
NS_WARNING("Unable to create factory for component");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIFactory> oldFactory = do_GetClassObject(filepickerCONTRACTID);
if (oldFactory) {
nsCID* cid = nullptr;
rv = cr->ContractIDToCID(filepickerCONTRACTID, &cid);
if (!NS_FAILED(rv)) {
rv = cr->UnregisterFactory(*cid, oldFactory.get());
NS_Free(cid);
if (NS_FAILED(rv)) {
return NS_ERROR_FAILURE;
}
}
}

nsCID fpickerCID = NS_EMBED_FILEPICKER_SERVICE_CID;
rv = cr->RegisterFactory(fpickerCID, "EmbedLite FilePicker",
filepickerCONTRACTID, fp);

fp = new mozilla::embedlite::EmbedliteGenericFactory(nsEmbedClipboardConstructor);
if (!fp) {
NS_WARNING("Unable to create factory for component");
return NS_ERROR_FAILURE;
}
oldFactory = do_GetClassObject(clipBoardCONTRACTID);
nsCOMPtr<nsIFactory> oldFactory = do_GetClassObject(clipBoardCONTRACTID);
if (oldFactory) {
nsCID* cid = nullptr;
rv = cr->ContractIDToCID(clipBoardCONTRACTID, &cid);
Expand All @@ -93,6 +68,5 @@ EmbedWidgetFactoryRegister::Init()
rv = cr->RegisterFactory(clipboardCID, "EmbedLite ClipBoard",
clipBoardCONTRACTID, fp);


return NS_OK;
}
1 change: 0 additions & 1 deletion widgetfactory/Makefile.am
Expand Up @@ -3,7 +3,6 @@ libbz_LTLIBRARIES = libwidgetfactory.la

libwidgetfactory_la_SOURCES = \
EmbedWidgetFactoryRegister.cpp \
nsFilePicker.cpp \
EmbedliteGenericFactory.cpp \
nsEmbedWidgetFactoryModule.cpp \
nsClipboard.cpp \
Expand Down

0 comments on commit dce0ba4

Please sign in to comment.