mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 299988 - integrate gtkmozembed into libxul, r=chpe
This commit is contained in:
parent
28a0057aa8
commit
fa57a77957
@ -44,7 +44,8 @@ VPATH = @srcdir@
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = gtkembedmoz
|
||||
TOOL_DIRS=src
|
||||
|
||||
DIRS=src
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
TOOL_DIRS += tests
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIWebBrowserStream.h"
|
||||
#include "nsIWebBrowserFocus.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
||||
// for NS_APPSHELL_CID
|
||||
#include <nsWidgetsCID.h>
|
||||
@ -55,7 +57,8 @@
|
||||
#include <nsIWindowWatcher.h>
|
||||
|
||||
#include <nsILocalFile.h>
|
||||
#include <nsEmbedAPI.h>
|
||||
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
// all of the crap that we need for event listeners
|
||||
// and when chrome windows finish loading
|
||||
@ -70,9 +73,6 @@
|
||||
// for the focus hacking we need to do
|
||||
#include <nsIFocusController.h>
|
||||
|
||||
// for profiles
|
||||
#include <nsProfileDirServiceProvider.h>
|
||||
|
||||
// app component registration
|
||||
#include <nsIGenericFactory.h>
|
||||
#include <nsIComponentRegistrar.h>
|
||||
@ -99,15 +99,75 @@
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
PRUint32 EmbedPrivate::sWidgetCount = 0;
|
||||
|
||||
char *EmbedPrivate::sPath = nsnull;
|
||||
char *EmbedPrivate::sCompPath = nsnull;
|
||||
nsIAppShell *EmbedPrivate::sAppShell = nsnull;
|
||||
nsVoidArray *EmbedPrivate::sWindowList = nsnull;
|
||||
char *EmbedPrivate::sProfileDir = nsnull;
|
||||
char *EmbedPrivate::sProfileName = nsnull;
|
||||
nsILocalFile *EmbedPrivate::sProfileDir = nsnull;
|
||||
nsISupports *EmbedPrivate::sProfileLock = nsnull;
|
||||
GtkWidget *EmbedPrivate::sOffscreenWindow = 0;
|
||||
GtkWidget *EmbedPrivate::sOffscreenFixed = 0;
|
||||
|
||||
nsIDirectoryServiceProvider *EmbedPrivate::sAppFileLocProvider = nsnull;
|
||||
nsProfileDirServiceProvider *EmbedPrivate::sProfileDirServiceProvider = nsnull;
|
||||
|
||||
class GTKEmbedDirectoryProvider : public nsIDirectoryServiceProvider2
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
||||
};
|
||||
|
||||
static const GTKEmbedDirectoryProvider kDirectoryProvider;
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE2(GTKEmbedDirectoryProvider,
|
||||
nsIDirectoryServiceProvider,
|
||||
nsIDirectoryServiceProvider2)
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
GTKEmbedDirectoryProvider::AddRef()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
GTKEmbedDirectoryProvider::Release()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GTKEmbedDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
|
||||
nsIFile* *aResult)
|
||||
{
|
||||
if (EmbedPrivate::sAppFileLocProvider) {
|
||||
nsresult rv = EmbedPrivate::sAppFileLocProvider->GetFile(aKey, aPersist,
|
||||
aResult);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (EmbedPrivate::sProfileDir && !strcmp(aKey, NS_APP_USER_PROFILE_50_DIR)) {
|
||||
*aPersist = PR_TRUE;
|
||||
return EmbedPrivate::sProfileDir->Clone(aResult);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GTKEmbedDirectoryProvider::GetFiles(const char *aKey,
|
||||
nsISimpleEnumerator* *aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDirectoryServiceProvider2>
|
||||
dp2(do_QueryInterface(EmbedPrivate::sAppFileLocProvider));
|
||||
|
||||
if (!dp2)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return dp2->GetFiles(aKey, aResult);
|
||||
}
|
||||
|
||||
#define NS_PROMPTSERVICE_CID \
|
||||
{0x95611356, 0xf583, 0x46f5, {0x81, 0xff, 0x4b, 0x3e, 0x01, 0x62, 0xc6, 0x19}}
|
||||
@ -474,15 +534,32 @@ EmbedPrivate::PushStartup(void)
|
||||
// if this is the first widget, fire up xpcom
|
||||
if (sWidgetCount == 1) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> binDir;
|
||||
|
||||
nsCOMPtr<nsILocalFile> binDir;
|
||||
if (sCompPath) {
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(sCompPath), 1, getter_AddRefs(binDir));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
}
|
||||
|
||||
rv = NS_InitEmbedding(binDir, sAppFileLocProvider);
|
||||
const char *grePath = sPath;
|
||||
|
||||
if (!grePath)
|
||||
grePath = getenv("MOZILLA_FIVE_HOME");
|
||||
|
||||
if (!grePath)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsILocalFile> greDir;
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(grePath), PR_TRUE,
|
||||
getter_AddRefs(greDir));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
rv = XRE_InitEmbedding(greDir, binDir,
|
||||
NS_CONST_CAST(GTKEmbedDirectoryProvider*,
|
||||
&kDirectoryProvider),
|
||||
nsnull, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
@ -492,8 +569,8 @@ EmbedPrivate::PushStartup(void)
|
||||
sAppFileLocProvider = nsnull;
|
||||
}
|
||||
|
||||
rv = StartupProfile();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to start up profiles.\n");
|
||||
if (sProfileDir)
|
||||
XRE_NotifyProfile();
|
||||
|
||||
rv = RegisterAppComponents();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n");
|
||||
@ -525,9 +602,6 @@ EmbedPrivate::PopStartup(void)
|
||||
// destroy the offscreen window
|
||||
DestroyOffscreenWindow();
|
||||
|
||||
// shut down the profiles
|
||||
ShutdownProfile();
|
||||
|
||||
if (sAppShell) {
|
||||
// Shutdown the appshell service.
|
||||
sAppShell->Spindown();
|
||||
@ -536,10 +610,21 @@ EmbedPrivate::PopStartup(void)
|
||||
}
|
||||
|
||||
// shut down XPCOM/Embedding
|
||||
NS_TermEmbedding();
|
||||
XRE_TermEmbedding();
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void EmbedPrivate::SetPath(const char *aPath)
|
||||
{
|
||||
if (sPath)
|
||||
free(sPath);
|
||||
if (aPath)
|
||||
sPath = strdup(aPath);
|
||||
else
|
||||
sPath = nsnull;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
EmbedPrivate::SetCompPath(const char *aPath)
|
||||
@ -566,20 +651,31 @@ void
|
||||
EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
|
||||
{
|
||||
if (sProfileDir) {
|
||||
nsMemory::Free(sProfileDir);
|
||||
sProfileDir = nsnull;
|
||||
if (sWidgetCount) {
|
||||
NS_ERROR("Cannot change profile directory during run.");
|
||||
return;
|
||||
}
|
||||
|
||||
NS_RELEASE(sProfileDir);
|
||||
NS_RELEASE(sProfileLock);
|
||||
}
|
||||
|
||||
if (sProfileName) {
|
||||
nsMemory::Free(sProfileName);
|
||||
sProfileName = nsnull;
|
||||
nsresult rv =
|
||||
NS_NewNativeLocalFile(nsDependentCString(aDir), PR_TRUE, &sProfileDir);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = XRE_LockProfileDirectory(sProfileDir, &sProfileLock);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (sWidgetCount)
|
||||
XRE_NotifyProfile();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (aDir)
|
||||
sProfileDir = (char *)nsMemory::Clone(aDir, strlen(aDir) + 1);
|
||||
NS_WARNING("Failed to lock profile.");
|
||||
|
||||
if (aName)
|
||||
sProfileName = (char *)nsMemory::Clone(aName, strlen(aName) + 1);
|
||||
// Failed
|
||||
NS_IF_RELEASE(sProfileDir);
|
||||
NS_IF_RELEASE(sProfileLock);
|
||||
}
|
||||
|
||||
void
|
||||
@ -969,49 +1065,6 @@ EmbedPrivate::GetAtkObjectForCurrentDocument()
|
||||
}
|
||||
#endif /* MOZ_ACCESSIBILITY_ATK */
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
EmbedPrivate::StartupProfile(void)
|
||||
{
|
||||
// initialize profiles
|
||||
if (sProfileDir && sProfileName) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> profileDir;
|
||||
NS_NewNativeLocalFile(nsDependentCString(sProfileDir), 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);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
EmbedPrivate::ShutdownProfile(void)
|
||||
{
|
||||
if (sProfileDirServiceProvider) {
|
||||
sProfileDirServiceProvider->Shutdown();
|
||||
NS_RELEASE(sProfileDirServiceProvider);
|
||||
sProfileDirServiceProvider = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
EmbedPrivate::RegisterAppComponents(void)
|
||||
|
@ -61,7 +61,6 @@ class EmbedEventListener;
|
||||
|
||||
class nsPIDOMWindow;
|
||||
class nsIDirectoryServiceProvider;
|
||||
class nsProfileDirServiceProvider;
|
||||
|
||||
class EmbedPrivate {
|
||||
|
||||
@ -86,6 +85,7 @@ class EmbedPrivate {
|
||||
|
||||
static void PushStartup (void);
|
||||
static void PopStartup (void);
|
||||
static void SetPath (const char *aPath);
|
||||
static void SetCompPath (const char *aPath);
|
||||
static void SetAppComponents (const nsModuleComponentInfo* aComps,
|
||||
int aNumComponents);
|
||||
@ -150,6 +150,8 @@ class EmbedPrivate {
|
||||
|
||||
// the number of widgets that have been created
|
||||
static PRUint32 sWidgetCount;
|
||||
// the path to the GRE
|
||||
static char *sPath;
|
||||
// the path to components
|
||||
static char *sCompPath;
|
||||
// the list of application-specific components to register
|
||||
@ -160,10 +162,8 @@ class EmbedPrivate {
|
||||
// the list of all open windows
|
||||
static nsVoidArray *sWindowList;
|
||||
// what is our profile path?
|
||||
static char *sProfileDir;
|
||||
static char *sProfileName;
|
||||
// for profiles
|
||||
static nsProfileDirServiceProvider *sProfileDirServiceProvider;
|
||||
static nsILocalFile *sProfileDir;
|
||||
static nsISupports *sProfileLock;
|
||||
|
||||
static nsIDirectoryServiceProvider * sAppFileLocProvider;
|
||||
|
||||
@ -190,9 +190,6 @@ class EmbedPrivate {
|
||||
// this will get the PIDOMWindow for this widget
|
||||
nsresult GetPIDOMWindow (nsPIDOMWindow **aPIWin);
|
||||
|
||||
static nsresult StartupProfile (void);
|
||||
static void ShutdownProfile(void);
|
||||
|
||||
static nsresult RegisterAppComponents();
|
||||
|
||||
// offscreen window methods and the offscreen widget
|
||||
@ -200,7 +197,7 @@ class EmbedPrivate {
|
||||
static void DestroyOffscreenWindow(void);
|
||||
static GtkWidget *sOffscreenWindow;
|
||||
static GtkWidget *sOffscreenFixed;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* __EmbedPrivate_h */
|
||||
|
@ -45,7 +45,9 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = gtkembedmoz
|
||||
LIBRARY_NAME = gtkembedmoz
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
DEFINES += -DIMPL_XREAPI
|
||||
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
@ -61,6 +63,7 @@ REQUIRES = xpcom \
|
||||
embed_base \
|
||||
windowwatcher \
|
||||
profdirserviceprovider \
|
||||
xulapp \
|
||||
$(NULL)
|
||||
|
||||
ifdef ACCESSIBILITY
|
||||
@ -87,105 +90,12 @@ endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# Save the "real" FINAL_LINK_COMP* before we override them
|
||||
FAT_FINAL_LINK_COMPS := $(FINAL_LINK_COMPS)
|
||||
FAT_FINAL_LINK_COMP_NAMES := $(FINAL_LINK_COMP_NAMES)
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
include $(topsrcdir)/config/static-config.mk
|
||||
DEFINES += $(STATIC_DEFINES)
|
||||
CPPSRCS += $(STATIC_CPPSRCS)
|
||||
EXTRA_DSO_LDOPTS += $(STATIC_EXTRA_LIBS)
|
||||
EXTRA_DEPS += \
|
||||
$(STATIC_EXTRA_DEPS) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(DIST)/lib/libembed_base_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libprofdirserviceprovider_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
gtkmozembed.h \
|
||||
gtkmozembed_glue.cpp \
|
||||
gtkmozembed_internal.h
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
-lgtksuperwin \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK2
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_GTK_LDFLAGS) $(MOZ_GTK2_LIBS)
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
# This is so sick! We'll work backwards from the embedding manifest to
|
||||
# produce the set of components that we need to link in to a
|
||||
# ``minimal'' embedding harness.
|
||||
ifndef MINIMO
|
||||
EMBED_MANIFEST=$(topsrcdir)/embedding/config/basebrowser-unix
|
||||
endif
|
||||
|
||||
ifndef MOZ_FAT_EMBED
|
||||
FINAL_LINK_COMPS=embed-link-comps
|
||||
FINAL_LINK_COMP_NAMES=embed-link-comp-names
|
||||
endif
|
||||
|
||||
ifdef MINIMO
|
||||
FINAL_LINK_COMPS=$(topsrcdir)/minimo/base/linux/minimo-link-comps
|
||||
FINAL_LINK_COMP_NAMES=$(topsrcdir)/minimo/base/linux/minimo-link-names
|
||||
FINAL_LINK_LIBS=$(topsrcdir)/minimo/base/linux/minimo-link-libs
|
||||
endif
|
||||
|
||||
# Recreate these files each time to pick up any changes.
|
||||
# XXX This is a hack; the dependency system should do this for us.
|
||||
export::
|
||||
-rm -f embed-link-comps embed-link-comp-names components_list
|
||||
|
||||
# Create a map that we can use to go from library name to component
|
||||
# symbol. N.B. that this will break if the $(FINAL_LINK_COMP_NAMES)
|
||||
# and $(FINAL_LINK_COMPS) somehow get out-of-sync and aren't in
|
||||
# _exactly_ the same order. (Hey, this is a hack!)
|
||||
components_list: $(FAT_FINAL_LINK_COMPS) $(FAT_FINAL_LINK_COMP_NAMES)
|
||||
paste $(FAT_FINAL_LINK_COMPS) $(FAT_FINAL_LINK_COMP_NAMES) | sort -k 1,1 > $@
|
||||
|
||||
# Compute the embedding libs by extracting them from the embedding
|
||||
# manifest.
|
||||
#
|
||||
# We start by selecting anything that starts with `components/', as
|
||||
# these are the component libraries. We print the `first' field to
|
||||
# strip off any crap after the library name. Next, we select for files
|
||||
# ending with `.so' so we end up with only the libraries. We then rip
|
||||
# off the `components/lib' prefix and the `.so' suffix, leaving just
|
||||
# the library name. This list is sorted, and joined with the list of
|
||||
# components that were actually _built_ to cull out anything that's
|
||||
# included in the manifest, but wasn't built.
|
||||
embed-link-comps: $(EMBED_MANIFEST) components_list
|
||||
grep '^components/' $< | \
|
||||
awk '{ print $$1; }' | \
|
||||
grep '\.so$$' | \
|
||||
sed -e 's.^components/lib..' -e 's/\.so//' | \
|
||||
sort | \
|
||||
join -o 1.1 - components_list > $@
|
||||
|
||||
# Compute the symbols we'll need for the ``minimal embedding client''
|
||||
# by joining the compoent list with the sorted list of embedding
|
||||
# components.
|
||||
embed-link-comp-names: embed-link-comps components_list
|
||||
sort embed-link-comps | join -o 2.2 - components_list > $@
|
||||
|
||||
GARBAGE += embed-link-comp-names embed-link-comps components components_list
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
include $(topsrcdir)/config/static-rules.mk
|
||||
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
ifndef GNU_CC
|
||||
|
@ -45,17 +45,42 @@ extern "C" {
|
||||
|
||||
#include <stddef.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
#include "nscore.h"
|
||||
#else // MOZILLA_CLIENT
|
||||
#ifndef nscore_h__
|
||||
/* Because this header may be included from files which not part of the mozilla
|
||||
build system, define macros from nscore.h */
|
||||
|
||||
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
|
||||
#define NS_HIDDEN __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define NS_HIDDEN
|
||||
#endif
|
||||
|
||||
#define NS_FROZENCALL
|
||||
#define NS_EXPORT_(type) type
|
||||
#define NS_IMPORT_(type) type
|
||||
#endif // nscore_h__
|
||||
#endif // MOZILLA_CLIENT
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
|
||||
#define GTKMOZEMBED_API(type, name, params) \
|
||||
typedef type (NS_FROZENCALL * name##Type) params; \
|
||||
extern name##Type name NS_HIDDEN;
|
||||
|
||||
#else // XPCOM_GLUE
|
||||
|
||||
#ifdef _IMPL_GTKMOZEMBED
|
||||
#define GTKMOZEMBED_API(type) NS_EXPORT_(type)
|
||||
#define GTKMOZEMBED_API(type, name, params) NS_EXPORT_(type) name params;
|
||||
#else
|
||||
#define GTKMOZEMBED_API(type) NS_IMPORT_(type)
|
||||
#endif
|
||||
#else
|
||||
#define GTKMOZEMBED_API(type) type
|
||||
#define GTKMOZEMBED_API(type,name, params) NS_IMPORT_(type) name params;
|
||||
#endif
|
||||
|
||||
#endif // XPCOM_GLUE
|
||||
|
||||
#define GTK_TYPE_MOZ_EMBED (gtk_moz_embed_get_type())
|
||||
#define GTK_MOZ_EMBED(obj) GTK_CHECK_CAST((obj), GTK_TYPE_MOZ_EMBED, GtkMozEmbed)
|
||||
#define GTK_MOZ_EMBED_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED, GtkMozEmbedClass)
|
||||
@ -80,16 +105,16 @@ struct _GtkMozEmbedClass
|
||||
void (* location) (GtkMozEmbed *embed);
|
||||
void (* title) (GtkMozEmbed *embed);
|
||||
void (* progress) (GtkMozEmbed *embed, gint curprogress,
|
||||
gint maxprogress);
|
||||
gint maxprogress);
|
||||
void (* progress_all) (GtkMozEmbed *embed, const char *aURI,
|
||||
gint curprogress, gint maxprogress);
|
||||
gint curprogress, gint maxprogress);
|
||||
void (* net_state) (GtkMozEmbed *embed, gint state, guint status);
|
||||
void (* net_state_all) (GtkMozEmbed *embed, const char *aURI,
|
||||
gint state, guint status);
|
||||
gint state, guint status);
|
||||
void (* net_start) (GtkMozEmbed *embed);
|
||||
void (* net_stop) (GtkMozEmbed *embed);
|
||||
void (* new_window) (GtkMozEmbed *embed, GtkMozEmbed **newEmbed,
|
||||
guint chromemask);
|
||||
guint chromemask);
|
||||
void (* visibility) (GtkMozEmbed *embed, gboolean visibility);
|
||||
void (* destroy_brsr) (GtkMozEmbed *embed);
|
||||
gint (* open_uri) (GtkMozEmbed *embed, const char *aURI);
|
||||
@ -104,64 +129,54 @@ struct _GtkMozEmbedClass
|
||||
gint (* dom_mouse_over) (GtkMozEmbed *embed, gpointer dom_event);
|
||||
gint (* dom_mouse_out) (GtkMozEmbed *embed, gpointer dom_event);
|
||||
void (* security_change) (GtkMozEmbed *embed, gpointer request,
|
||||
guint state);
|
||||
guint state);
|
||||
void (* status_change) (GtkMozEmbed *embed, gpointer request,
|
||||
gint status, gpointer message);
|
||||
gint status, gpointer message);
|
||||
gint (* dom_activate) (GtkMozEmbed *embed, gpointer dom_event);
|
||||
gint (* dom_focus_in) (GtkMozEmbed *embed, gpointer dom_event);
|
||||
gint (* dom_focus_out) (GtkMozEmbed *embed, gpointer dom_event);
|
||||
};
|
||||
|
||||
GTKMOZEMBED_API(GtkType) gtk_moz_embed_get_type (void);
|
||||
GTKMOZEMBED_API(GtkWidget*) gtk_moz_embed_new (void);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_push_startup (void);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_pop_startup (void);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_set_comp_path (const char *aPath);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_set_profile_path (const char *aDir,
|
||||
const char *aName);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_load_url (GtkMozEmbed *embed,
|
||||
const char *url);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_stop_load (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(gboolean) gtk_moz_embed_can_go_back (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(gboolean) gtk_moz_embed_can_go_forward (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_go_back (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_go_forward (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_render_data (GtkMozEmbed *embed,
|
||||
const char *data,
|
||||
guint32 len,
|
||||
const char *base_uri,
|
||||
const char *mime_type);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_open_stream (GtkMozEmbed *embed,
|
||||
const char *base_uri,
|
||||
const char *mime_type);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_append_data (GtkMozEmbed *embed,
|
||||
const char *data,
|
||||
guint32 len);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_close_stream (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(char*) gtk_moz_embed_get_link_message (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(char*) gtk_moz_embed_get_js_status (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(char*) gtk_moz_embed_get_title (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(char*) gtk_moz_embed_get_location (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_reload (GtkMozEmbed *embed,
|
||||
gint32 flags);
|
||||
GTKMOZEMBED_API(void) gtk_moz_embed_set_chrome_mask (GtkMozEmbed *embed,
|
||||
guint32 flags);
|
||||
GTKMOZEMBED_API(guint32) gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed);
|
||||
GTKMOZEMBED_API(GtkType, gtk_moz_embed_get_type, (void))
|
||||
GTKMOZEMBED_API(GtkWidget*, gtk_moz_embed_new, (void))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_push_startup, (void))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_pop_startup, (void))
|
||||
|
||||
/* enum types */
|
||||
#define GTK_TYPE_MOZ_EMBED_PROGRESS_FLAGS \
|
||||
(gtk_moz_embed_progress_flags_get_type())
|
||||
#define GTK_TYPE_MOZ_EMBED_STATUS_ENUMS \
|
||||
(gtk_moz_embed_status_enums_get_type())
|
||||
#define GTK_TYPE_MOZ_EMBED_RELOAD_FLAGS \
|
||||
(gtk_moz_embed_reload_flags_get_type())
|
||||
#define GTK_TYPE_MOZ_EMBED_CHROME_FLAGS \
|
||||
(gtk_moz_embed_chrome_flags_get_type())
|
||||
/* Tell gtkmozembed where the gtkmozembed libs live. If this is not specified,
|
||||
The MOZILLA_FIVE_HOME environment variable is checked. */
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_set_path, (const char *aPath))
|
||||
|
||||
GTKMOZEMBED_API(GtkType) gtk_moz_embed_progress_flags_get_type (void);
|
||||
GTKMOZEMBED_API(GtkType) gtk_moz_embed_status_enums_get_type (void);
|
||||
GTKMOZEMBED_API(GtkType) gtk_moz_embed_reload_flags_get_type (void);
|
||||
GTKMOZEMBED_API(GtkType) gtk_moz_embed_chrome_flags_get_type (void);
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_set_comp_path, (const char *aPath))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_set_profile_path, (const char *aDir,
|
||||
const char *aName))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_load_url, (GtkMozEmbed *embed,
|
||||
const char *url))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_stop_load, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(gboolean, gtk_moz_embed_can_go_back, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(gboolean, gtk_moz_embed_can_go_forward, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_go_back, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_go_forward, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_render_data, (GtkMozEmbed *embed,
|
||||
const char *data,
|
||||
guint32 len,
|
||||
const char *base_uri,
|
||||
const char *mime_type))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_open_stream, (GtkMozEmbed *embed,
|
||||
const char *base_uri,
|
||||
const char *mime_type))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_append_data, (GtkMozEmbed *embed,
|
||||
const char *data,
|
||||
guint32 len))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_close_stream, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(char*, gtk_moz_embed_get_link_message, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(char*, gtk_moz_embed_get_js_status, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(char*, gtk_moz_embed_get_title, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(char*, gtk_moz_embed_get_location, (GtkMozEmbed *embed))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_reload, (GtkMozEmbed *embed,
|
||||
gint32 flags))
|
||||
GTKMOZEMBED_API(void, gtk_moz_embed_set_chrome_mask, (GtkMozEmbed *embed,
|
||||
guint32 flags))
|
||||
GTKMOZEMBED_API(guint32, gtk_moz_embed_get_chrome_mask, (GtkMozEmbed *embed))
|
||||
|
||||
/* These are straight out of nsIWebProgressListener.h */
|
||||
|
||||
@ -257,12 +272,12 @@ struct _GtkMozEmbedSingleClass
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
void (* new_window_orphan) (GtkMozEmbedSingle *embed,
|
||||
GtkMozEmbed **newEmbed,
|
||||
guint chromemask);
|
||||
GtkMozEmbed **newEmbed,
|
||||
guint chromemask);
|
||||
};
|
||||
|
||||
GTKMOZEMBED_API(GtkType) gtk_moz_embed_single_get_type (void);
|
||||
GTKMOZEMBED_API(GtkMozEmbedSingle *) gtk_moz_embed_single_get (void);
|
||||
GTKMOZEMBED_API(GtkType, gtk_moz_embed_single_get_type, (void))
|
||||
GTKMOZEMBED_API(GtkMozEmbedSingle *, gtk_moz_embed_single_get, (void))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -83,105 +83,6 @@
|
||||
#define NEW_TOOLKIT_STRING(x) g_strdup(NS_LossyConvertUTF16toASCII(x).get())
|
||||
#define GET_OBJECT_CLASS_TYPE(x) (GTK_OBJECT_CLASS(x)->type)
|
||||
|
||||
// Some "massaged" enum information for the GTK Type System
|
||||
static GtkFlagValue gtk_moz_embed_progress_flags_values[] = {
|
||||
{ GTK_MOZ_EMBED_FLAG_START,
|
||||
"GTK_MOZ_EMBED_FLAG_START", "start" },
|
||||
{ GTK_MOZ_EMBED_FLAG_REDIRECTING,
|
||||
"GTK_MOZ_EMBED_FLAG_REDIRECTING", "redirecting" },
|
||||
{ GTK_MOZ_EMBED_FLAG_TRANSFERRING,
|
||||
"GTK_MOZ_EMBED_FLAG_TRANSFERRING", "transferring" },
|
||||
{ GTK_MOZ_EMBED_FLAG_NEGOTIATING,
|
||||
"GTK_MOZ_EMBED_FLAG_NEGOTIATING", "negotiating" },
|
||||
{ GTK_MOZ_EMBED_FLAG_STOP,
|
||||
"GTK_MOZ_EMBED_FLAG_STOP", "stop" },
|
||||
{ GTK_MOZ_EMBED_FLAG_IS_REQUEST,
|
||||
"GTK_MOZ_EMBED_FLAG_IS_REQUEST", "is-request" },
|
||||
{ GTK_MOZ_EMBED_FLAG_IS_DOCUMENT,
|
||||
"GTK_MOZ_EMBED_FLAG_IS_DOCUMENT", "is-document" },
|
||||
{ GTK_MOZ_EMBED_FLAG_IS_NETWORK,
|
||||
"GTK_MOZ_EMBED_FLAG_IS_NETWORK", "is-network" },
|
||||
{ GTK_MOZ_EMBED_FLAG_IS_WINDOW,
|
||||
"GTK_MOZ_EMBED_FLAG_IS_WINDOW", "is-window" },
|
||||
{ GTK_MOZ_EMBED_FLAG_RESTORING,
|
||||
"GTK_MOZ_EMBED_FLAG_RESTORING", "restoring" },
|
||||
{ 0,
|
||||
NULL, NULL }
|
||||
};
|
||||
|
||||
static GtkEnumValue gtk_moz_embed_status_enums_values[] = {
|
||||
{ GTK_MOZ_EMBED_STATUS_FAILED_DNS,
|
||||
"GTK_MOZ_EMBED_STATUS_FAILED_DNS", "failed-dns" },
|
||||
{ GTK_MOZ_EMBED_STATUS_FAILED_CONNECT,
|
||||
"GTK_MOZ_EMBED_STATUS_FAILED_CONNECT", "failed-connect" },
|
||||
{ GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT,
|
||||
"GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT", "failed-timeout" },
|
||||
{ GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED,
|
||||
"GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED", "failed-usercanceled" },
|
||||
{ 0,
|
||||
NULL, NULL }
|
||||
};
|
||||
|
||||
static GtkFlagValue gtk_moz_embed_reload_flags_values[] = {
|
||||
{ GTK_MOZ_EMBED_FLAG_RELOADNORMAL,
|
||||
"GTK_MOZ_EMBED_FLAG_RELOADNORMAL", "reloadnormal" },
|
||||
{ GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE,
|
||||
"GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE", "reloadbypasscache" },
|
||||
{ GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY,
|
||||
"GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY", "reloadbypassproxy" },
|
||||
{ GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE,
|
||||
"GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE",
|
||||
"reloadbypassproxyandcache" },
|
||||
{ GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE,
|
||||
"GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE", "reloadcharset" },
|
||||
{ 0,
|
||||
NULL, NULL }
|
||||
};
|
||||
|
||||
static GtkFlagValue gtk_moz_embed_chrome_flags_values[] = {
|
||||
{ GTK_MOZ_EMBED_FLAG_DEFAULTCHROME,
|
||||
"GTK_MOZ_EMBED_FLAG_DEFAULTCHROME", "defaultchrome" },
|
||||
{ GTK_MOZ_EMBED_FLAG_WINDOWBORDERSON,
|
||||
"GTK_MOZ_EMBED_FLAG_WINDOWBORDERSON", "windowborderson" },
|
||||
{ GTK_MOZ_EMBED_FLAG_WINDOWCLOSEON,
|
||||
"GTK_MOZ_EMBED_FLAG_WINDOWCLOSEON", "windowcloseon" },
|
||||
{ GTK_MOZ_EMBED_FLAG_WINDOWRESIZEON,
|
||||
"GTK_MOZ_EMBED_FLAG_WINDOWRESIZEON", "windowresizeon" },
|
||||
{ GTK_MOZ_EMBED_FLAG_MENUBARON,
|
||||
"GTK_MOZ_EMBED_FLAG_MENUBARON", "menubaron" },
|
||||
{ GTK_MOZ_EMBED_FLAG_TOOLBARON,
|
||||
"GTK_MOZ_EMBED_FLAG_TOOLBARON", "toolbaron" },
|
||||
{ GTK_MOZ_EMBED_FLAG_LOCATIONBARON,
|
||||
"GTK_MOZ_EMBED_FLAG_LOCATIONBARON", "locationbaron" },
|
||||
{ GTK_MOZ_EMBED_FLAG_STATUSBARON,
|
||||
"GTK_MOZ_EMBED_FLAG_STATUSBARON", "statusbaron" },
|
||||
{ GTK_MOZ_EMBED_FLAG_PERSONALTOOLBARON,
|
||||
"GTK_MOZ_EMBED_FLAG_PERSONALTOOLBARON", "personaltoolbaron" },
|
||||
{ GTK_MOZ_EMBED_FLAG_SCROLLBARSON,
|
||||
"GTK_MOZ_EMBED_FLAG_SCROLLBARSON", "scrollbarson" },
|
||||
{ GTK_MOZ_EMBED_FLAG_TITLEBARON,
|
||||
"GTK_MOZ_EMBED_FLAG_TITLEBARON", "titlebaron" },
|
||||
{ GTK_MOZ_EMBED_FLAG_EXTRACHROMEON,
|
||||
"GTK_MOZ_EMBED_FLAG_EXTRACHROMEON", "extrachromeon" },
|
||||
{ GTK_MOZ_EMBED_FLAG_ALLCHROME,
|
||||
"GTK_MOZ_EMBED_FLAG_ALLCHROME", "allchrome" },
|
||||
{ GTK_MOZ_EMBED_FLAG_WINDOWRAISED,
|
||||
"GTK_MOZ_EMBED_FLAG_WINDOWRAISED", "windowraised" },
|
||||
{ GTK_MOZ_EMBED_FLAG_WINDOWLOWERED,
|
||||
"GTK_MOZ_EMBED_FLAG_WINDOWLOWERED", "windowlowered" },
|
||||
{ GTK_MOZ_EMBED_FLAG_CENTERSCREEN,
|
||||
"GTK_MOZ_EMBED_FLAG_CENTERSCREEN", "centerscreen" },
|
||||
{ GTK_MOZ_EMBED_FLAG_DEPENDENT,
|
||||
"GTK_MOZ_EMBED_FLAG_DEPENDENT", "dependent" },
|
||||
{ GTK_MOZ_EMBED_FLAG_MODAL,
|
||||
"GTK_MOZ_EMBED_FLAG_MODAL", "modal" },
|
||||
{ GTK_MOZ_EMBED_FLAG_OPENASDIALOG,
|
||||
"GTK_MOZ_EMBED_FLAG_OPENASDIALOG", "openasdialog" },
|
||||
{ GTK_MOZ_EMBED_FLAG_OPENASCHROME,
|
||||
"GTK_MOZ_EMBED_FLAG_OPENASCHROME", "openaschrome" },
|
||||
{ 0,
|
||||
NULL, NULL }
|
||||
};
|
||||
#endif /* MOZ_WIDGET_GTK */
|
||||
|
||||
class nsIDirectoryServiceProvider;
|
||||
@ -803,6 +704,12 @@ gtk_moz_embed_pop_startup(void)
|
||||
EmbedPrivate::PopStartup();
|
||||
}
|
||||
|
||||
void
|
||||
gtk_moz_embed_set_path(const char *aPath)
|
||||
{
|
||||
EmbedPrivate::SetPath(aPath);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_moz_embed_set_comp_path(const char *aPath)
|
||||
{
|
||||
@ -1109,58 +1016,6 @@ gtk_moz_embed_get_chrome_mask(GtkMozEmbed *embed)
|
||||
return embedPrivate->mChromeMask;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
|
||||
GtkType
|
||||
gtk_moz_embed_progress_flags_get_type(void)
|
||||
{
|
||||
static GtkType progress_flags_type = 0;
|
||||
|
||||
if (!progress_flags_type)
|
||||
progress_flags_type =
|
||||
gtk_type_register_flags("GtkMozEmbedReloadFlags",
|
||||
gtk_moz_embed_progress_flags_values);
|
||||
return progress_flags_type;
|
||||
}
|
||||
|
||||
GtkType
|
||||
gtk_moz_embed_status_enums_get_type(void)
|
||||
{
|
||||
static GtkType status_enum_type = 0;
|
||||
|
||||
if (!status_enum_type)
|
||||
status_enum_type =
|
||||
gtk_type_register_enum("GtkMozEmbedStatusFlags",
|
||||
gtk_moz_embed_status_enums_values);
|
||||
return status_enum_type;
|
||||
}
|
||||
|
||||
GtkType
|
||||
gtk_moz_embed_reload_flags_get_type(void)
|
||||
{
|
||||
static GtkType reload_flags_type = 0;
|
||||
|
||||
if (!reload_flags_type)
|
||||
reload_flags_type =
|
||||
gtk_type_register_flags("GtkMozEmbedReloadFlags",
|
||||
gtk_moz_embed_reload_flags_values);
|
||||
return reload_flags_type;
|
||||
}
|
||||
|
||||
GtkType
|
||||
gtk_moz_embed_chrome_flags_get_type(void)
|
||||
{
|
||||
static GtkType chrome_flags_type = 0;
|
||||
|
||||
if (!chrome_flags_type)
|
||||
chrome_flags_type =
|
||||
gtk_type_register_flags("GtkMozEmbedChromeFlags",
|
||||
gtk_moz_embed_chrome_flags_values);
|
||||
return chrome_flags_type;
|
||||
}
|
||||
|
||||
#endif /* MOZ_WIDGET_GTK */
|
||||
|
||||
void
|
||||
gtk_moz_embed_get_nsIWebBrowser (GtkMozEmbed *embed, nsIWebBrowser **retval)
|
||||
{
|
||||
|
96
embedding/browser/gtk/src/gtkmozembed_glue.cpp
Normal file
96
embedding/browser/gtk/src/gtkmozembed_glue.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla embedding.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// This file is an implementation file, meant to be #included in a
|
||||
// single C++ file of an embedding application. It is called after
|
||||
// XPCOMGlueStartup to glue the gtkmozembed functions.
|
||||
|
||||
#include "gtkmozembed.h"
|
||||
#include "nsXPCOMGlue.h"
|
||||
|
||||
#ifndef XPCOM_GLUE
|
||||
#error This file only makes sense when XPCOM_GLUE is defined.
|
||||
#endif
|
||||
|
||||
#define GTKMOZEMBED_FUNCTIONS \
|
||||
GTKF(gtk_moz_embed_get_type) \
|
||||
GTKF(gtk_moz_embed_new) \
|
||||
GTKF(gtk_moz_embed_push_startup) \
|
||||
GTKF(gtk_moz_embed_pop_startup) \
|
||||
GTKF(gtk_moz_embed_set_path) \
|
||||
GTKF(gtk_moz_embed_set_comp_path) \
|
||||
GTKF(gtk_moz_embed_set_profile_path) \
|
||||
GTKF(gtk_moz_embed_load_url) \
|
||||
GTKF(gtk_moz_embed_stop_load) \
|
||||
GTKF(gtk_moz_embed_can_go_back) \
|
||||
GTKF(gtk_moz_embed_can_go_forward) \
|
||||
GTKF(gtk_moz_embed_go_back) \
|
||||
GTKF(gtk_moz_embed_go_forward) \
|
||||
GTKF(gtk_moz_embed_render_data) \
|
||||
GTKF(gtk_moz_embed_open_stream) \
|
||||
GTKF(gtk_moz_embed_append_data) \
|
||||
GTKF(gtk_moz_embed_close_stream) \
|
||||
GTKF(gtk_moz_embed_get_link_message) \
|
||||
GTKF(gtk_moz_embed_get_js_status) \
|
||||
GTKF(gtk_moz_embed_get_title) \
|
||||
GTKF(gtk_moz_embed_get_location) \
|
||||
GTKF(gtk_moz_embed_reload) \
|
||||
GTKF(gtk_moz_embed_set_chrome_mask) \
|
||||
GTKF(gtk_moz_embed_get_chrome_mask) \
|
||||
GTKF(gtk_moz_embed_single_get_type) \
|
||||
GTKF(gtk_moz_embed_single_get)
|
||||
|
||||
#define GTKF(fname) fname##Type fname;
|
||||
|
||||
GTKMOZEMBED_FUNCTIONS
|
||||
|
||||
#undef GTKF
|
||||
|
||||
#define GTKF(fname) { #fname, (NSFuncPtr*) &fname },
|
||||
|
||||
static const nsDynamicFunctionLoad GtkSymbols[] = {
|
||||
GTKMOZEMBED_FUNCTIONS
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
||||
#undef GTKF
|
||||
|
||||
static nsresult
|
||||
GTKEmbedGlueStartup()
|
||||
{
|
||||
return XPCOMGlueLoadXULFunctions(GtkSymbols);
|
||||
}
|
@ -47,12 +47,24 @@ struct nsModuleComponentInfo;
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern GTKMOZEMBED_API(void) gtk_moz_embed_get_nsIWebBrowser (GtkMozEmbed *embed, nsIWebBrowser **retval);
|
||||
extern GTKMOZEMBED_API(PRUnichar*) gtk_moz_embed_get_title_unichar (GtkMozEmbed *embed);
|
||||
extern GTKMOZEMBED_API(PRUnichar*) gtk_moz_embed_get_js_status_unichar (GtkMozEmbed *embed);
|
||||
extern GTKMOZEMBED_API(PRUnichar*) gtk_moz_embed_get_link_message_unichar (GtkMozEmbed *embed);
|
||||
extern GTKMOZEMBED_API(void) gtk_moz_embed_set_directory_service_provider (nsIDirectoryServiceProvider *appFileLocProvider);
|
||||
extern GTKMOZEMBED_API(void) gtk_moz_embed_set_app_components (const nsModuleComponentInfo *aComps, int aNumComps);
|
||||
GTKMOZEMBED_API(void,
|
||||
gtk_moz_embed_get_nsIWebBrowser, (GtkMozEmbed *embed,
|
||||
nsIWebBrowser **retval))
|
||||
GTKMOZEMBED_API(PRUnichar*,
|
||||
gtk_moz_embed_get_title_unichar, (GtkMozEmbed *embed))
|
||||
|
||||
GTKMOZEMBED_API(PRUnichar*,
|
||||
gtk_moz_embed_get_js_status_unichar, (GtkMozEmbed *embed))
|
||||
|
||||
GTKMOZEMBED_API(PRUnichar*,
|
||||
gtk_moz_embed_get_link_message_unichar, (GtkMozEmbed *embed))
|
||||
|
||||
GTKMOZEMBED_API(void,
|
||||
gtk_moz_embed_set_directory_service_provider, (nsIDirectoryServiceProvider *appFileLocProvider))
|
||||
|
||||
GTKMOZEMBED_API(void,
|
||||
gtk_moz_embed_set_app_components, (const nsModuleComponentInfo *aComps,
|
||||
int aNumComps))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -48,43 +48,28 @@ REQUIRES = xpcom \
|
||||
dom \
|
||||
$(NULL)
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
REQUIRES += tracemalloc
|
||||
endif
|
||||
|
||||
ifdef MOZ_JPROF
|
||||
REQUIRES += jprof
|
||||
endif
|
||||
|
||||
CPPSRCS = TestGtkEmbed.cpp
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
CPPSRCS += \
|
||||
CPPSRCS = \
|
||||
TestGtkEmbed.cpp \
|
||||
TestGtkEmbedNotebook.cpp \
|
||||
TestGtkEmbedSocket.cpp \
|
||||
TestGtkEmbedChild.cpp
|
||||
endif
|
||||
|
||||
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
|
||||
|
||||
# ENABLE_GNOME=1
|
||||
|
||||
ifdef ENABLE_GNOME
|
||||
ifdef ENABLE_TESTS
|
||||
CPPSRCS += TestGtkEmbedMDI.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
LIBS += \
|
||||
-lgtkembedmoz \
|
||||
-lgtksuperwin \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK2
|
||||
LIBS += \
|
||||
-lgtkembedmoz \
|
||||
$(XLDFLAGS) \
|
||||
$(XLIBS) \
|
||||
$(NULL)
|
||||
@ -92,51 +77,12 @@ endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# Force applications to be built non-statically
|
||||
# when building the mozcomps meta component
|
||||
ifneq (,$(filter mozcomps,$(MOZ_META_COMPONENTS)))
|
||||
BUILD_STATIC_LIBS=
|
||||
endif
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
|
||||
ifndef MOZ_FAT_EMBED
|
||||
FINAL_LINK_COMPS=../src/embed-link-comps
|
||||
endif
|
||||
|
||||
ifdef MINIMO
|
||||
FINAL_LINK_COMPS=$(topsrcdir)/minimo/base/linux/minimo-link-comps
|
||||
FINAL_LINK_COMP_NAMES=$(topsrcdir)/minimo/base/linux/minimo-link-names
|
||||
FINAL_LINK_LIBS=$(topsrcdir)/minimo/base/linux/minimo-link-libs
|
||||
endif
|
||||
|
||||
|
||||
include $(topsrcdir)/config/static-config.mk
|
||||
|
||||
EXTRA_DEPS += $(STATIC_EXTRA_DEPS)
|
||||
EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS)
|
||||
EXTRA_LIBS += -L$(DEPTH)/dist/lib/components
|
||||
EXTRA_LIBS += $(EXTRA_DSO_LIBS) $(STATIC_EXTRA_LIBS)
|
||||
|
||||
endif
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
EXTRA_LIBS += -ltracemalloc
|
||||
endif
|
||||
|
||||
ifdef MOZ_PERF_METRICS
|
||||
EXTRA_LIBS += -lmozutil_s
|
||||
endif
|
||||
|
||||
ifdef MOZ_JPROF
|
||||
EXTRA_LIBS += -ljprof
|
||||
endif
|
||||
|
||||
EXTRA_LIBS += $(MOZ_JS_LIBS)
|
||||
EXTRA_LIBS += $(MOZ_COMPONENT_LIBS)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LIBS += $(XPCOM_STANDALONE_GLUE_LDOPTS)
|
||||
|
||||
DEFINES += -DXPCOM_GLUE
|
||||
|
||||
CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
|
||||
|
||||
ifdef ENABLE_GNOME
|
||||
|
@ -45,15 +45,9 @@
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
#include "prenv.h"
|
||||
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
#include "nsTraceMalloc.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
#include "jprof.h"
|
||||
#endif
|
||||
#include "nsStringAPI.h"
|
||||
#include "gtkmozembed_glue.cpp"
|
||||
|
||||
typedef struct _TestGtkBrowser {
|
||||
GtkWidget *topLevelWindow;
|
||||
@ -190,20 +184,44 @@ static void update_nav_buttons (TestGtkBrowser *browser);
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
argc = NS_TraceMallocStartupArgs(argc, argv);
|
||||
#endif
|
||||
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
setupProfilingStuff();
|
||||
#endif
|
||||
static const GREVersionRange greVersion = {
|
||||
"1.9a", PR_TRUE,
|
||||
"2", PR_TRUE
|
||||
};
|
||||
|
||||
char xpcomPath[PATH_MAX];
|
||||
|
||||
nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0,
|
||||
xpcomPath, sizeof(xpcomPath));
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't find a compatible GRE.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = XPCOMGlueStartup(xpcomPath);
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't start XPCOM.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = GTKEmbedGlueStartup();
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't find GTKMozEmbed symbols.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *lastSlash = strrchr(xpcomPath, '/');
|
||||
if (lastSlash)
|
||||
*lastSlash = '\0';
|
||||
|
||||
gtk_moz_embed_set_path(xpcomPath);
|
||||
|
||||
char *home_path;
|
||||
char *full_path;
|
||||
home_path = PR_GetEnv("HOME");
|
||||
home_path = getenv("HOME");
|
||||
if (!home_path) {
|
||||
fprintf(stderr, "Failed to get HOME\n");
|
||||
exit(1);
|
||||
|
@ -41,6 +41,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nsStringAPI.h"
|
||||
#include "gtkmozembed_glue.cpp"
|
||||
|
||||
int (*old_handler) (Display *, XErrorEvent *);
|
||||
|
||||
int error_handler (Display *d, XErrorEvent *e)
|
||||
@ -87,6 +90,38 @@ main(int argc, char **argv)
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
static const GREVersionRange greVersion = {
|
||||
"1.9a", PR_TRUE,
|
||||
"2", PR_TRUE
|
||||
};
|
||||
|
||||
char xpcomPath[PATH_MAX];
|
||||
|
||||
nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0,
|
||||
xpcomPath, sizeof(xpcomPath));
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't find a compatible GRE.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = XPCOMGlueStartup(xpcomPath);
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't start XPCOM.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = GTKEmbedGlueStartup();
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't find GTKMozEmbed symbols.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *lastSlash = strrchr(xpcomPath, '/');
|
||||
if (lastSlash)
|
||||
*lastSlash = '\0';
|
||||
|
||||
gtk_moz_embed_set_path(xpcomPath);
|
||||
|
||||
old_handler = XSetErrorHandler (error_handler);
|
||||
|
||||
if (argc < 2) {
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtkmozembed.h>
|
||||
#include "nsStringAPI.h"
|
||||
#include "gtkmozembed_glue.cpp"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
@ -10,6 +13,39 @@ int main(int argc, char *argv[])
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
static const GREVersionRange greVersion = {
|
||||
"1.9a", PR_TRUE,
|
||||
"2", PR_TRUE
|
||||
};
|
||||
|
||||
char xpcomPath[PATH_MAX];
|
||||
|
||||
nsresult rv =
|
||||
GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0,
|
||||
xpcomPath, sizeof(xpcomPath));
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't find a compatible GRE.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = XPCOMGlueStartup(xpcomPath);
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't start XPCOM.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = GTKEmbedGlueStartup();
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't find GTKMozEmbed symbols.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *lastSlash = strrchr(xpcomPath, '/');
|
||||
if (lastSlash)
|
||||
*lastSlash = '\0';
|
||||
|
||||
gtk_moz_embed_set_path(xpcomPath);
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
container = gtk_notebook_new();
|
||||
|
@ -73,6 +73,11 @@ STATIC_LIBS = \
|
||||
xulapp_s \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2))
|
||||
STATIC_LIBS += gtkembedmoz
|
||||
endif
|
||||
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(foreach lib,$(STATIC_LIBS),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX)) \
|
||||
$(foreach component,$(COMPONENT_LIBS),$(DIST)/lib/components/$(LIB_PREFIX)$(component).$(LIB_SUFFIX)) \
|
||||
|
Loading…
Reference in New Issue
Block a user