[kazehakase-svn] [3371] * module/embed/gecko/kz-gecko-embed-module.cpp: Invoke

Back to archive index

svnno****@sourc***** svnno****@sourc*****
Thu Feb 21 09:06:13 JST 2008


Revision: 3371
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3371
Author:   ikezoe
Date:     2008-02-21 09:06:12 +0900 (Thu, 21 Feb 2008)

Log Message:
-----------
	* module/embed/gecko/kz-gecko-embed-module.cpp: Invoke
	xulrunner_init().
	* module/embed/gecko/mozilla.[cpp|h]: Added codes for xulrunner-1.9.

Modified Paths:
--------------
    kazehakase/trunk/ChangeLog
    kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp
    kazehakase/trunk/module/embed/gecko/mozilla.cpp
    kazehakase/trunk/module/embed/gecko/mozilla.h

Modified: kazehakase/trunk/ChangeLog
===================================================================
--- kazehakase/trunk/ChangeLog	2008-02-20 23:21:28 UTC (rev 3370)
+++ kazehakase/trunk/ChangeLog	2008-02-21 00:06:12 UTC (rev 3371)
@@ -2,6 +2,9 @@
 
 	* module/embed/gecko/kz-gecko-single.[cpp|h]: KzGeckoSingle is not a
 	child of GtkMozEmbedSingle.
+	* module/embed/gecko/kz-gecko-embed-module.cpp: Invoke
+	xulrunner_init().
+	* module/embed/gecko/mozilla.[cpp|h]: Added codes for xulrunner-1.9.
 
 2008-02-20  Hiroyuki Ikezoe  <poinc****@ikezo*****>
 

Modified: kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp
===================================================================
--- kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp	2008-02-20 23:21:28 UTC (rev 3370)
+++ kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp	2008-02-21 00:06:12 UTC (rev 3371)
@@ -23,12 +23,16 @@
 #include "kz-gecko-embed.h"
 #include "kz-gecko-single.h"
 #include "mozilla-prefs.h"
+#include "mozilla.h"
 
 static KzGeckoSingle *gecko_single = NULL;
 
 G_MODULE_EXPORT void
 KZ_MODULE_IMPL_INIT (GTypeModule *module)
 {
+#ifdef XPCOM_GLUE
+	xulrunner_init();
+#endif
 	mozilla_prefs_init();
 
 	gtk_moz_embed_set_comp_path(MOZILLA_HOME);

Modified: kazehakase/trunk/module/embed/gecko/mozilla.cpp
===================================================================
--- kazehakase/trunk/module/embed/gecko/mozilla.cpp	2008-02-20 23:21:28 UTC (rev 3370)
+++ kazehakase/trunk/module/embed/gecko/mozilla.cpp	2008-02-21 00:06:12 UTC (rev 3371)
@@ -48,8 +48,11 @@
 #  include "GtkNSSDialogs.h"
 #endif
 #include "GtkPromptService.h"
+#ifdef XPCOM_GLUE
+#include <gtkmozembed_glue.cpp>
+#include <nsGenericFactory.h>
+#endif
 
-
 NS_GENERIC_FACTORY_CONSTRUCTOR(KzFilePicker)
 NS_GENERIC_FACTORY_CONSTRUCTOR(KzContentHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR(KzMozProgressListener)
@@ -153,7 +156,59 @@
 }
 #endif
 
+#ifdef XPCOM_GLUE
 gboolean
+xulrunner_init (void)
+{
+	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))
+		return FALSE;
+
+	rv = XPCOMGlueStartup(xpcomPath);
+	if (NS_FAILED(rv))
+		return FALSE;
+
+	rv = GTKEmbedGlueStartup();
+	if (NS_FAILED(rv))
+		return FALSE;
+
+	char *lastSlash = strrchr(xpcomPath, '/');
+	if (lastSlash)
+		*lastSlash = '\0';
+
+	gtk_moz_embed_set_path(xpcomPath);
+}
+
+static nsresult
+NS_NewGenericFactory(nsIGenericFactory* *result,
+                     const nsModuleComponentInfo *info)
+{
+	nsresult rv;
+	nsCOMPtr<nsIGenericFactory> fact;
+	fact = do_CreateInstance(NS_GENERICFACTORY_CONTRACTID, &rv);
+	if (NS_FAILED(rv))
+		return rv;
+	rv = fact->SetComponentInfo(info);
+	if (NS_FAILED(rv))
+	{
+		NS_RELEASE(fact);
+		return rv;
+	}
+
+	*result = fact;
+	return rv;
+}
+#endif
+
+gboolean
 mozilla_register_components (void)
 {
 	gboolean ret = TRUE;
@@ -164,8 +219,8 @@
 	NS_ENSURE_SUCCESS(rv, rv);
 
 	nsCOMPtr<nsIComponentManager> cm;
-	NS_GetComponentManager (getter_AddRefs (cm));
-	NS_ENSURE_TRUE (cm, FALSE);
+	NS_GetComponentManager(getter_AddRefs(cm));
+	NS_ENSURE_TRUE(cm, FALSE);
 
 	for (int i = 0; i < sNumAppComps; i++)
 	{
@@ -188,7 +243,7 @@
 
 #ifndef HAVE_NSIDOCSHELL_GETSECUREUI
         // Workaround for http://bugzilla.gnome.org/show_bug.cgi?id=164670
-        reregister_secure_browser_ui (cm, cr);
+        reregister_secure_browser_ui(cm, cr);
 #endif
 	return ret;
 }

Modified: kazehakase/trunk/module/embed/gecko/mozilla.h
===================================================================
--- kazehakase/trunk/module/embed/gecko/mozilla.h	2008-02-20 23:21:28 UTC (rev 3370)
+++ kazehakase/trunk/module/embed/gecko/mozilla.h	2008-02-21 00:06:12 UTC (rev 3371)
@@ -27,6 +27,9 @@
 G_BEGIN_DECLS
 
 gboolean   mozilla_register_components (void);
+#ifdef XPCOM_GLUE
+gboolean   xulrunner_init (void);
+#endif
 
 G_END_DECLS
 




More information about the Kazehakase-cvs mailing list
Back to archive index