mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
More gtkmozembed followups from bug 78081, r=timeless
This commit is contained in:
parent
6c345eefe2
commit
91818d35b0
@ -719,20 +719,12 @@ GetHistoryFileName(char **aHistoryFile)
|
||||
// Get the history file in our profile dir.
|
||||
// Notice we are not just getting NS_APP_HISTORY_50_FILE
|
||||
// because it is used by the "real" global history component.
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
if (EmbedPrivate::sProfileDir) {
|
||||
nsCString path;
|
||||
EmbedPrivate::sProfileDir->GetNativePath(path);
|
||||
*aHistoryFile = g_strdup_printf("%s/history.dat", path.get());
|
||||
BROKEN_STRING_BUILDER(aHistoryFile);
|
||||
} else
|
||||
#else
|
||||
if (EmbedPrivate::sProfileDirS) {
|
||||
*aHistoryFile = g_strdup_printf("%s/history.dat", EmbedPrivate::sProfileDirS);
|
||||
BROKEN_STRING_BUILDER(aHistoryFile);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
*aHistoryFile = g_strdup_printf("%s/history.dat", g_get_tmp_dir());
|
||||
BROKEN_STRING_BUILDER(aHistoryFile);
|
||||
}
|
||||
|
@ -75,14 +75,6 @@
|
||||
// for the clipboard actions we need to do
|
||||
#include "nsIClipboardCommands.h"
|
||||
|
||||
#ifndef MOZ_ENABLE_LIBXUL
|
||||
// for profiles
|
||||
#include "nsProfileDirServiceProvider.h"
|
||||
#include "nsEmbedAPI.h"
|
||||
// for NS_APPSHELL_CID
|
||||
#include "nsWidgetsCID.h"
|
||||
#endif
|
||||
|
||||
// app component registration
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
@ -181,17 +173,8 @@ PRUint32 EmbedPrivate::sWidgetCount = 0;
|
||||
char *EmbedPrivate::sPath = nsnull;
|
||||
char *EmbedPrivate::sCompPath = nsnull;
|
||||
nsVoidArray *EmbedPrivate::sWindowList = nsnull;
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
nsILocalFile *EmbedPrivate::sProfileDir = nsnull;
|
||||
nsISupports *EmbedPrivate::sProfileLock = nsnull;
|
||||
#else
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
char *EmbedPrivate::sProfileDirS = nsnull;
|
||||
char *EmbedPrivate::sProfileName = nsnull;
|
||||
nsIPref *EmbedPrivate::sPrefs = nsnull;
|
||||
nsIAppShell *EmbedPrivate::sAppShell = nsnull;
|
||||
nsProfileDirServiceProvider *EmbedPrivate::sProfileDirServiceProvider = nsnull;
|
||||
#endif
|
||||
GtkWidget *EmbedPrivate::sOffscreenWindow = 0;
|
||||
GtkWidget *EmbedPrivate::sOffscreenFixed = 0;
|
||||
|
||||
@ -257,22 +240,10 @@ GTKEmbedDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
|
||||
}
|
||||
|
||||
if (!strcmp(aKey, NS_APP_USER_PROFILE_50_DIR)) {
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
if (EmbedPrivate::sProfileDir) {
|
||||
*aPersist = PR_TRUE;
|
||||
return EmbedPrivate::sProfileDir->Clone(aResult);
|
||||
}
|
||||
#else
|
||||
nsCOMPtr<nsILocalFile> profDir =
|
||||
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = profDir->InitWithNativePath(nsDependentCString(EmbedPrivate::sProfileDirS));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
NS_ADDREF(*aResult = profDir);
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
*aResult = nsnull;
|
||||
@ -826,8 +797,6 @@ EmbedPrivate::PushStartup(void)
|
||||
} else
|
||||
NS_ASSERTION(EmbedPrivate::sCompPath, "Warning: Failed to init Component Path.\n");
|
||||
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
|
||||
const char *grePath = sPath;
|
||||
NS_ASSERTION(grePath, "Warning: Failed to init grePath.\n");
|
||||
|
||||
@ -854,35 +823,6 @@ EmbedPrivate::PushStartup(void)
|
||||
XRE_NotifyProfile();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
rv = NS_InitEmbedding(binDir, sAppFileLocProvider);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// we no longer need a reference to the DirectoryServiceProvider
|
||||
if (sAppFileLocProvider) {
|
||||
NS_RELEASE(sAppFileLocProvider);
|
||||
sAppFileLocProvider = nsnull;
|
||||
}
|
||||
|
||||
rv = StartupProfile();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to start up profiles.\n");
|
||||
|
||||
nsCOMPtr<nsIAppShell> appShell;
|
||||
appShell = do_CreateInstance(kAppShellCID);
|
||||
if (!appShell) {
|
||||
NS_WARNING("Failed to create appshell in EmbedPrivate::PushStartup!\n");
|
||||
return;
|
||||
}
|
||||
sAppShell = appShell.get();
|
||||
NS_ADDREF(sAppShell);
|
||||
#ifdef MOZILLA_1_8_BRANCH
|
||||
sAppShell->Create(0, nsnull);
|
||||
sAppShell->Spinup();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
rv = RegisterAppComponents();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n");
|
||||
}
|
||||
@ -899,23 +839,6 @@ EmbedPrivate::PopStartup(void)
|
||||
// destroy the offscreen window
|
||||
DestroyOffscreenWindow();
|
||||
|
||||
#ifndef MOZ_ENABLE_LIBXUL
|
||||
// shut down the profiles
|
||||
ShutdownProfile();
|
||||
|
||||
if (sAppShell) {
|
||||
#ifdef MOZILLA_1_8_BRANCH
|
||||
// Shutdown the appshell service.
|
||||
sAppShell->Spindown();
|
||||
#endif
|
||||
NS_RELEASE(sAppShell);
|
||||
sAppShell = 0;
|
||||
}
|
||||
|
||||
// shut down XPCOM/Embedding
|
||||
NS_TermEmbedding();
|
||||
#else
|
||||
|
||||
// we no longer need a reference to the DirectoryServiceProvider
|
||||
if (EmbedPrivate::sAppFileLocProvider) {
|
||||
NS_RELEASE(EmbedPrivate::sAppFileLocProvider);
|
||||
@ -924,7 +847,7 @@ EmbedPrivate::PopStartup(void)
|
||||
|
||||
// shut down XPCOM/Embedding
|
||||
XRE_TermEmbedding();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
EmbedGlobalHistory::DeleteInstance();
|
||||
#endif
|
||||
@ -967,7 +890,6 @@ EmbedPrivate::SetAppComponents(const nsModuleComponentInfo* aComps,
|
||||
void
|
||||
EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
|
||||
{
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
if (EmbedPrivate::sProfileDir) {
|
||||
if (sWidgetCount) {
|
||||
NS_ERROR("Cannot change profile directory during run.");
|
||||
@ -1001,23 +923,6 @@ EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
|
||||
// Failed
|
||||
NS_IF_RELEASE(EmbedPrivate::sProfileDir);
|
||||
NS_IF_RELEASE(EmbedPrivate::sProfileLock);
|
||||
#else
|
||||
if (sProfileDirS) {
|
||||
nsMemory::Free(sProfileDirS);
|
||||
sProfileDirS = nsnull;
|
||||
}
|
||||
|
||||
if (sProfileName) {
|
||||
nsMemory::Free(sProfileName);
|
||||
sProfileName = nsnull;
|
||||
}
|
||||
|
||||
if (aDir)
|
||||
sProfileDirS = (char *)nsMemory::Clone(aDir, strlen(aDir) + 1);
|
||||
|
||||
if (aName)
|
||||
sProfileName = (char *)nsMemory::Clone(aName, strlen(aName) + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -1507,58 +1412,6 @@ EmbedPrivate::GetAtkObjectForCurrentDocument()
|
||||
}
|
||||
#endif /* MOZ_ACCESSIBILITY_ATK */
|
||||
|
||||
#ifndef MOZ_ENABLE_LIBXUL
|
||||
/* static */
|
||||
nsresult
|
||||
EmbedPrivate::StartupProfile(void)
|
||||
{
|
||||
// initialize profiles
|
||||
if (sProfileDirS && sProfileName) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> profileDir;
|
||||
NS_NewNativeLocalFile(nsDependentCString(sProfileDirS), PR_TRUE,
|
||||
getter_AddRefs(profileDir));
|
||||
if (!profileDir)
|
||||
return NS_ERROR_FAILURE;
|
||||
rv = profileDir->AppendNative(nsDependentCString(sProfileName));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsProfileDirServiceProvider> locProvider;
|
||||
NS_NewProfileDirServiceProvider(PR_TRUE, getter_AddRefs(locProvider));
|
||||
if (!locProvider)
|
||||
return NS_ERROR_FAILURE;
|
||||
rv = locProvider->Register();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = locProvider->SetProfileDir(profileDir);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
// Keep a ref so we can shut it down.
|
||||
NS_ADDREF(sProfileDirServiceProvider = locProvider);
|
||||
// get prefs
|
||||
nsCOMPtr<nsIPref> pref;
|
||||
pref = do_GetService(NS_PREF_CONTRACTID);
|
||||
if (!pref)
|
||||
return NS_ERROR_FAILURE;
|
||||
sPrefs = pref.get();
|
||||
NS_ADDREF(sPrefs);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
EmbedPrivate::ShutdownProfile(void)
|
||||
{
|
||||
if (sProfileDirServiceProvider) {
|
||||
sProfileDirServiceProvider->Shutdown();
|
||||
NS_RELEASE(sProfileDirServiceProvider);
|
||||
}
|
||||
NS_IF_RELEASE(sPrefs);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
EmbedPrivate::RegisterAppComponents(void)
|
||||
|
@ -55,11 +55,6 @@
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
#ifndef MOZ_ENABLE_LIBXUL
|
||||
// for profiles
|
||||
#include "nsIPref.h"
|
||||
#endif
|
||||
|
||||
// app component registration
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
@ -84,9 +79,6 @@ class EmbedEventListener;
|
||||
|
||||
class nsPIDOMWindow;
|
||||
class nsIDirectoryServiceProvider;
|
||||
#ifndef MOZ_ENABLE_LIBXUL
|
||||
class nsProfileDirServiceProvider;
|
||||
#endif
|
||||
|
||||
class EmbedCommon {
|
||||
public:
|
||||
@ -125,11 +117,6 @@ class EmbedPrivate {
|
||||
static void SetPath (const char *aPath);
|
||||
static void SetCompPath (const char *aPath);
|
||||
|
||||
#ifndef MOZ_ENABLE_LIBXUL
|
||||
static nsresult StartupProfile (void);
|
||||
static void ShutdownProfile(void);
|
||||
#endif
|
||||
|
||||
static void SetAppComponents (const nsModuleComponentInfo* aComps,
|
||||
int aNumComponents);
|
||||
static void SetProfilePath (const char *aDir, const char *aName);
|
||||
@ -224,18 +211,9 @@ class EmbedPrivate {
|
||||
static nsIAppShell *sAppShell;
|
||||
// the list of all open windows
|
||||
static nsVoidArray *sWindowList;
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
// what is our profile path?
|
||||
static nsILocalFile *sProfileDir;
|
||||
static nsISupports *sProfileLock;
|
||||
#else
|
||||
// what is our profile path?
|
||||
static char *sProfileDirS;
|
||||
static char *sProfileName;
|
||||
// for profiles
|
||||
static nsProfileDirServiceProvider *sProfileDirServiceProvider;
|
||||
static nsIPref *sPrefs;
|
||||
#endif
|
||||
|
||||
static nsIDirectoryServiceProvider * sAppFileLocProvider;
|
||||
|
||||
|
@ -52,30 +52,10 @@ LOCAL_INCLUDES += \
|
||||
-I. \
|
||||
$(NULL)
|
||||
|
||||
#Define for building GtkmozEmbed with MOZILLA_1_8_BRANCH
|
||||
#MOZILLA_1_8_BRANCH = 1
|
||||
|
||||
ifndef MOZ_ENABLE_LIBXUL
|
||||
MOZ_GTKEMBED_DYN = 1
|
||||
endif
|
||||
ifdef MOZILLA_1_8_BRANCH
|
||||
DEFINES += -DMOZILLA_1_8_BRANCH
|
||||
endif
|
||||
|
||||
ifdef MOZ_MICROBEMBED_DYN
|
||||
MOZ_GTKEMBED_DYN = 1
|
||||
endif
|
||||
|
||||
#ifdef MOZ_GNOMEVFS_CFLAGS
|
||||
#DEFINES += -DMOZ_ENABLE_GNOMEVFS
|
||||
#endif
|
||||
|
||||
ifdef MOZ_GTKEMBED_DYN
|
||||
FORCE_SHARED_LIB = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
DEFINES += -DMOZILLA_INTERNAL_API
|
||||
endif
|
||||
|
||||
DEFINES += -DIMPL_XREAPI
|
||||
|
||||
# New Stuff in GtkMozEmbed
|
||||
@ -177,24 +157,8 @@ CPPSRCS += \
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef MOZ_ENABLE_LIBXUL
|
||||
REQUIRES += \
|
||||
profdirserviceprovider \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifndef MOZ_ENABLE_LIBXUL
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(DEPTH)/embedding/base/libembed_base_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(DEPTH)/profile/dirserviceprovider/src/libprofdirserviceprovider_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
EXPORTS = \
|
||||
gtkmozembed.h \
|
||||
gtkmozembed_glue.cpp \
|
||||
@ -208,29 +172,6 @@ EXPORTS += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_GTKEMBED_DYN
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
EXTRA_DSO_LDOPTS += -L$(DIST)/lib -lgtksuperwin
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gtk gtk2 qt xlib,$(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(XLDFLAGS) \
|
||||
$(XLIBS) \
|
||||
$(MOZ_GTK_LDFLAGS) \
|
||||
$(MOZ_XFT_LIBS) \
|
||||
$(MOZ_GTK2_LIBS) \
|
||||
$(XT_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
ifdef MOZ_GNOMEVFS_CFLAGS
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(MOZ_GNOMEVFS_LIBS) \
|
||||
$(NULL)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
|
@ -77,15 +77,14 @@ CPPSRCS += dlldeps-xul.cpp
|
||||
endif
|
||||
|
||||
# dependent libraries
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2))
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(DEPTH)/embedding/browser/gtk/src/$(LIB_PREFIX)gtkembedmoz.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(foreach component,$(COMPONENT_LIBS),$(DEPTH)/staticlib/components/$(LIB_PREFIX)$(component).$(LIB_SUFFIX)) \
|
||||
|
Loading…
Reference in New Issue
Block a user