Commit 8213cb85 authored by Tatiana Meshkova's avatar Tatiana Meshkova

Added Dummy filepicker component, need implementation

parent ade92cd2
......@@ -2,3 +2,4 @@ binary-component libprompt.so
binary-component libhistory.so
binary-component libchromehelper.so
binary-component libtouchhelper.so
binary-component libwidgetfactory.so
......@@ -76,4 +76,5 @@ AC_OUTPUT([
jscomps/Makefile
touchhelper/Makefile
jsscripts/Makefile
widgetfactory/Makefile
])
......@@ -21,6 +21,7 @@ $OBJPREFIX/chromehelper/.libs/libchromehelper.so
$OBJPREFIX/history/.libs/libhistory.so
$OBJPREFIX/prompt/.libs/libprompt.so
$OBJPREFIX/touchhelper/.libs/libtouchhelper.so
$OBJPREFIX/widgetfactory/.libs/libwidgetfactory.so
EmbedLiteBinComponents.manifest
EmbedLiteJSComponents.manifest
jscomps/AboutRedirector.js
......
......@@ -17,6 +17,7 @@
#include "nsILoginManager.h"
#include "nsIFormHistory.h"
#include "nsWidgetsCID.h"
using namespace mozilla::embedlite;
......@@ -62,21 +63,6 @@ EmbedPromptRegister::Init()
}
}
#if 0
oldFactory = do_GetClassObject("@mozilla.org/filepicker;1");
if (oldFactory) {
nsCID* cid = NULL;
rv = cr->ContractIDToCID("@mozilla.org/filepicker;1", &cid);
if (!NS_FAILED(rv)) {
rv = cr->UnregisterFactory(*cid, oldFactory.get());
NS_Free(cid);
if (NS_FAILED(rv)) {
return NS_ERROR_FAILURE;
}
}
}
#endif
nsCID promptCID = EMBED_LITE_PROMPT_SERVICE_CID;
rv = cr->RegisterFactory(promptCID, "EmbedLite Prompt",
"@mozilla.org/prompter;1", f);
......
......@@ -12,7 +12,7 @@ NS_IMPL_ISUPPORTS1(GenericFactory, nsIFactory)
NS_IMETHODIMP
GenericFactory::CreateInstance(nsISupports* aOuter, REFNSIID aIID,
void** aResult)
void** aResult)
{
return mCtor(aOuter, aIID, aResult);
}
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 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 "EmbedWidgetFactoryRegister.h"
#include "nsServiceManagerUtils.h"
#include "nsIObserverService.h"
#include "nsIComponentRegistrar.h"
#include "nsIComponentManager.h"
#include "GenericFactory.h"
#include "mozilla/ModuleUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsILoginManager.h"
#include "nsIFormHistory.h"
#include "nsWidgetsCID.h"
#include "nsFilePicker.h"
using namespace mozilla::embedlite;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEmbedFilePicker)
EmbedWidgetFactoryRegister::EmbedWidgetFactoryRegister()
{
}
EmbedWidgetFactoryRegister::~EmbedWidgetFactoryRegister()
{
}
NS_IMPL_ISUPPORTS1(EmbedWidgetFactoryRegister, nsSupportsWeakReference)
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
nsresult
EmbedWidgetFactoryRegister::Init()
{
nsCOMPtr<nsIComponentRegistrar> cr;
nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(cr));
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
nsCOMPtr<nsIComponentManager> cm;
rv = NS_GetComponentManager (getter_AddRefs (cm));
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
nsCOMPtr<nsIFactory> fp = new mozilla::embedlite::GenericFactory(nsEmbedFilePickerConstructor);
if (!fp) {
NS_WARNING("Unable to create factory for component");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIFactory> oldFactory = do_GetClassObject("@mozilla.org/filepicker;1");
if (oldFactory) {
nsCID* cid = NULL;
rv = cr->ContractIDToCID("@mozilla.org/filepicker;1", &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",
"@mozilla.org/filepicker;1", fp);
return NS_OK;
}
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 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 EmbedWidgetFactoryRegister_H_
#define EmbedWidgetFactoryRegister_H_
#include "nsWeakReference.h"
class EmbedWidgetFactoryRegister : public nsSupportsWeakReference
{
public:
EmbedWidgetFactoryRegister();
virtual ~EmbedWidgetFactoryRegister();
NS_DECL_ISUPPORTS
nsresult Init();
};
#define NS_EMBED_WIDGETFACTORY_CONTRACTID "@mozilla.org/embed-widget-factory-component;1"
#define NS_EMBED_WIDGETFACTORY_SERVICE_CLASSNAME "Embed Widget Factory Component"
#define NS_EMBED_WIDGETFACTORY_SERVICE_CID \
{ 0xa0ee14a6, \
0x815a, \
0x11e2, \
{ 0xb0, 0x73, 0x9b, 0xe0, 0x48, 0x40, 0x2e }}
#endif /*EmbedWidgetFactoryRegister_H_*/
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "GenericFactory.h"
namespace mozilla {
namespace embedlite {
NS_IMPL_ISUPPORTS1(GenericFactory, nsIFactory)
NS_IMETHODIMP
GenericFactory::CreateInstance(nsISupports* aOuter, REFNSIID aIID,
void** aResult)
{
return mCtor(aOuter, aIID, aResult);
}
NS_IMETHODIMP
GenericFactory::LockFactory(bool aLock)
{
NS_ERROR("Vestigial method, never called!");
return NS_ERROR_FAILURE;
}
} // namespace mozilla
} // namespace mozilla
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 mozilla_GenericFactory_h
#define mozilla_GenericFactory_h
#include "mozilla/Attributes.h"
#include "mozilla/Module.h"
namespace mozilla {
namespace embedlite {
/**
* A generic factory which uses a constructor function to create instances.
* This class is intended for use by the component manager and the generic
* module.
*/
class GenericFactory MOZ_FINAL : public nsIFactory
{
public:
typedef Module::ConstructorProcPtr ConstructorProcPtr;
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
GenericFactory(ConstructorProcPtr ctor)
: mCtor(ctor)
{
NS_ASSERTION(mCtor, "GenericFactory with no constructor");
}
private:
ConstructorProcPtr mCtor;
};
} // namespace mozilla
} // namespace mozilla
#endif // mozilla_GenericFactory_h
libbzdir = $(libdir)/mozembedlite/components
libbz_LTLIBRARIES = libwidgetfactory.la
libwidgetfactory_la_SOURCES = \
EmbedWidgetFactoryRegister.cpp \
nsFilePicker.cpp \
GenericFactory.cpp \
nsEmbedChildModule.cpp \
$(NULL)
libwidgetfactory_la_CPPFLAGS = \
$(ENGINE_CFLAGS) \
$(NULL)
libwidgetfactory_la_LDFLAGS = -module -avoid-version
libwidgetfactory_la_LIBADD = \
$(ENGINE_LIBS) \
$(NULL)
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 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 "nsServiceManagerUtils.h"
#include "nsICategoryManager.h"
#include "mozilla/ModuleUtils.h"
#include "nsIAppStartupNotifier.h"
#include "EmbedWidgetFactoryRegister.h"
#include "nsNetCID.h"
#include <iostream>
/* ===== XPCOM registration stuff ======== */
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(EmbedWidgetFactoryRegister, Init)
NS_DEFINE_NAMED_CID(NS_EMBED_WIDGETFACTORY_SERVICE_CID);
static const mozilla::Module::CIDEntry kEMBEDWIDGETFACTORYCIDs[] = {
{ &kNS_EMBED_WIDGETFACTORY_SERVICE_CID, false, NULL, EmbedWidgetFactoryRegisterConstructor },
{ NULL }
};
static const mozilla::Module::ContractIDEntry kEMBEDWIDGETFACTORYContracts[] = {
{ NS_EMBED_WIDGETFACTORY_CONTRACTID, &kNS_EMBED_WIDGETFACTORY_SERVICE_CID },
{ NULL }
};
static const mozilla::Module::CategoryEntry kEMBEDWIDGETFACTORYCategories[] = {
{ APPSTARTUP_CATEGORY, NS_EMBED_WIDGETFACTORY_SERVICE_CLASSNAME, NS_EMBED_WIDGETFACTORY_CONTRACTID },
{ NULL }
};
static nsresult
EmbedWidgetFactory_Initialize()
{
return NS_OK;
}
static void
EmbedWidgetFactory_Shutdown()
{
}
static const mozilla::Module kEMBEDWIDGETFACTORYModule = {
mozilla::Module::kVersion,
kEMBEDWIDGETFACTORYCIDs,
kEMBEDWIDGETFACTORYContracts,
kEMBEDWIDGETFACTORYCategories,
NULL,
EmbedWidgetFactory_Initialize,
EmbedWidgetFactory_Shutdown
};
NSMODULE_DEFN(nsEmbedWidgetFactoryModule) = &kEMBEDWIDGETFACTORYModule;
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 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 "nsFilePicker.h"
#include "nsNetUtil.h"
#include "nsIWidget.h"
#include "nsDirectoryServiceDefs.h"
//-----------------------------
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsEmbedFilePicker, nsIFilePicker)
nsEmbedFilePicker::nsEmbedFilePicker()
{
/* member initializers and constructor code */
}
nsEmbedFilePicker::~nsEmbedFilePicker()
{
/* destructor code */
}
NS_IMETHODIMP nsEmbedFilePicker::Init(nsIDOMWindow* parent, const nsAString& title, int16_t mode)
{
printf("nsEmbedFilePicker::Init NOT IMPLEMENTED: win:%p, title:%s, mode:%i", parent, NS_ConvertUTF16toUTF8(title).get(), mode);
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::AppendFilters(int32_t filterMask)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::AppendFilter(const nsAString& title, const nsAString& filter)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetDefaultString(nsAString& aDefaultString)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::SetDefaultString(const nsAString& aDefaultString)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetDefaultExtension(nsAString& aDefaultExtension)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::SetDefaultExtension(const nsAString& aDefaultExtension)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetFilterIndex(int32_t* aFilterIndex)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::SetFilterIndex(int32_t aFilterIndex)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetDisplayDirectory(nsIFile* *aDisplayDirectory)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::SetDisplayDirectory(nsIFile* aDisplayDirectory)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetFile(nsIFile* *aFile)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetFileURL(nsIURI* *aFileURL)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetFiles(nsISimpleEnumerator* *aFiles)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::GetAddToRecentDocs(bool* aAddToRecentDocs)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::SetAddToRecentDocs(bool aAddToRecentDocs)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::Show(int16_t* _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsEmbedFilePicker::Open(nsIFilePickerShownCallback* aFilePickerShownCallback)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 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 NS_EMBED_FILEPICKER_H
#define NS_EMBED_FILEPICKER_H
#include "nsCOMArray.h"
#include "nsStringGlue.h"
#include "nsIFilePicker.h"
class nsEmbedFilePicker : public nsIFilePicker
{
public:
nsEmbedFilePicker();
NS_DECL_ISUPPORTS
NS_DECL_NSIFILEPICKER
private:
~nsEmbedFilePicker();
};
#define NS_EMBED_FILEPICKER_SERVICE_CID \
{ 0xeb16e75a, \
0x8156, \
0x11e2, \
{ 0xac, 0x82, 0x5f, 0xc3, 0xa0, 0x10, 0xd6 }}
#endif // NS_EMBED_FILEPICKER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment