From 1d5298f2586e48798d193a75315f71005a4d1c55 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sun, 18 May 2008 21:50:08 +0000 Subject: Implement nsIXULAppInfo so we get the "Gecko/DATE" part in the UA right. Use the 2.22.2 release date as the fixed date/build ID. svn path=/branches/gnome-2-22/; revision=8228 --- embed/mozilla/EphyXULAppInfo.cpp | 130 ++++++++++++++++++++++++++++++++ embed/mozilla/EphyXULAppInfo.h | 48 ++++++++++++ embed/mozilla/Makefile.am | 7 ++ embed/mozilla/MozRegisterComponents.cpp | 17 ++++- 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 embed/mozilla/EphyXULAppInfo.cpp create mode 100644 embed/mozilla/EphyXULAppInfo.h (limited to 'embed/mozilla') diff --git a/embed/mozilla/EphyXULAppInfo.cpp b/embed/mozilla/EphyXULAppInfo.cpp new file mode 100644 index 000000000..1319431ec --- /dev/null +++ b/embed/mozilla/EphyXULAppInfo.cpp @@ -0,0 +1,130 @@ +/* + * Copyright © 2008 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "mozilla-config.h" +#include "config.h" + +#include + +#include "EphyXULAppInfo.h" + +NS_IMPL_ISUPPORTS2 (EphyXULAppInfo, nsIXULRuntime, nsIXULAppInfo) + +EphyXULAppInfo::EphyXULAppInfo () + : mLogConsoleErrors (PR_TRUE) +{ +} + +EphyXULAppInfo::~EphyXULAppInfo () +{ +} + +/* readonly attribute ACString vendor; */ +NS_IMETHODIMP +EphyXULAppInfo::GetVendor(nsACString & aVendor) +{ + aVendor.Assign ("GNOME"); + return NS_OK; +} + +/* readonly attribute ACString name; */ +NS_IMETHODIMP +EphyXULAppInfo::GetName(nsACString & aName) +{ + aName.Assign ("GNOME Web Browser"); + return NS_OK; +} + +/* readonly attribute ACString ID; */ +NS_IMETHODIMP +EphyXULAppInfo::GetID(nsACString & aID) +{ + aID.Assign ("{8cbd4d83-3182-4d7e-9889-a8d77bf1f205}"); + return NS_OK; +} + +/* readonly attribute ACString version; */ +NS_IMETHODIMP +EphyXULAppInfo::GetVersion(nsACString & aVersion) +{ + aVersion.Assign (VERSION); + return NS_OK; +} + +/* readonly attribute ACString appBuildID; */ +NS_IMETHODIMP +EphyXULAppInfo::GetAppBuildID(nsACString & aAppBuildID) +{ + aAppBuildID.Assign (EPHY_BUILD_ID); + return NS_OK; +} + +/* readonly attribute ACString platformVersion; */ +NS_IMETHODIMP +EphyXULAppInfo::GetPlatformVersion(nsACString & aPlatformVersion) +{ + aPlatformVersion.Assign ("1.9"); + return NS_OK; +} + +/* readonly attribute ACString platformBuildID; */ +NS_IMETHODIMP +EphyXULAppInfo::GetPlatformBuildID(nsACString & aPlatformBuildID) +{ + aPlatformBuildID.Assign (EPHY_BUILD_ID); + return NS_OK; +} + +/* readonly attribute boolean inSafeMode; */ +NS_IMETHODIMP +EphyXULAppInfo::GetInSafeMode(PRBool *aInSafeMode) +{ + *aInSafeMode = PR_FALSE; + return NS_OK; +} + +/* attribute boolean logConsoleErrors; */ +NS_IMETHODIMP +EphyXULAppInfo::GetLogConsoleErrors(PRBool *aLogConsoleErrors) +{ + *aLogConsoleErrors = mLogConsoleErrors; + return NS_OK; +} + +NS_IMETHODIMP +EphyXULAppInfo::SetLogConsoleErrors(PRBool aLogConsoleErrors) +{ + mLogConsoleErrors = aLogConsoleErrors; + return NS_OK; +} + +/* readonly attribute AUTF8String OS; */ +NS_IMETHODIMP +EphyXULAppInfo::GetOS(nsACString & aOS) +{ + aOS.Assign (EPHY_HOST_OS); + return NS_OK; +} + +/* readonly attribute AUTF8String XPCOMABI; */ +NS_IMETHODIMP +EphyXULAppInfo::GetXPCOMABI(nsACString & aXPCOMABI) +{ + aXPCOMABI.Assign (EPHY_HOST_CPU "-gcc3"); + return NS_OK; +} diff --git a/embed/mozilla/EphyXULAppInfo.h b/embed/mozilla/EphyXULAppInfo.h new file mode 100644 index 000000000..5f5cf9d59 --- /dev/null +++ b/embed/mozilla/EphyXULAppInfo.h @@ -0,0 +1,48 @@ +/* + * Copyright © 2008 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef EPHY_XUL_APP_INFO_H +#define EPHY_XUL_APP_INFO_H + +#include +#include + +#include +#include + +#define EPHY_XUL_APP_INFO_CLASSNAME "Epiphany XUL App Info" + +/* 3032bcd2-663c-4583-88bf-6f251123f6dd */ +#define EPHY_XUL_APP_INFO_CID { 0x3032bcd2, 0x663c, 0x4583, { 0x88, 0xbf, 0x6f, 0x25, 0x11, 0x23, 0xf6, 0xdd } } + +class EphyXULAppInfo : public nsIXULAppInfo, + public nsIXULRuntime +{ + public: + EphyXULAppInfo (); + virtual ~EphyXULAppInfo(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIXULAPPINFO + NS_DECL_NSIXULRUNTIME + + private: + PRBool mLogConsoleErrors; +}; + +#endif /* EPHY_XUL_APP_INFO_H */ diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index 2788e1350..0491bac8a 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -64,6 +64,13 @@ libephymozillaembed_la_SOURCES = \ mozilla-notifiers.cpp \ mozilla-notifiers.h +if HAVE_GECKO_1_9 +libephymozillaembed_la_SOURCES += \ + EphyXULAppInfo.cpp \ + EphyXULAppInfo.h \ + $(NULL) +endif + if !HAVE_GECKO_1_9 libephymozillaembed_la_SOURCES += \ EphyBadCertRejector.cpp \ diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp index 73e946170..06196242b 100644 --- a/embed/mozilla/MozRegisterComponents.cpp +++ b/embed/mozilla/MozRegisterComponents.cpp @@ -44,6 +44,7 @@ #ifdef HAVE_GECKO_1_9 #include +#include #endif #ifdef HAVE_MOZILLA_PSM @@ -77,6 +78,10 @@ #include "GeckoFormSigningDialog.h" #endif +#ifdef HAVE_GECKO_1_9 +#include "EphyXULAppInfo.h" +#endif + NS_GENERIC_FACTORY_CONSTRUCTOR(EphyAboutModule) NS_GENERIC_FACTORY_CONSTRUCTOR(EphyContentPolicy) NS_GENERIC_FACTORY_CONSTRUCTOR(EphyPromptService) @@ -104,7 +109,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSSecurityWarningDialogs) NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoFormSigningDialog) #endif -#define XPINSTALL_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX "application/x-xpinstall" +#ifdef HAVE_GECKO_1_9 +NS_GENERIC_FACTORY_CONSTRUCTOR(EphyXULAppInfo) +#endif /* class information */ NS_DECL_CLASSINFO(EphySidebar) @@ -112,6 +119,14 @@ NS_DECL_CLASSINFO(EphySidebar) /* FIXME: uninstall XPI handler */ static const nsModuleComponentInfo sAppComps[] = { +#ifdef HAVE_GECKO_1_9 + { + EPHY_XUL_APP_INFO_CLASSNAME, + EPHY_XUL_APP_INFO_CID, + XULAPPINFO_SERVICE_CONTRACTID, + EphyXULAppInfoConstructor + }, +#endif { MOZ_DOWNLOAD_CLASSNAME, MOZ_DOWNLOAD_CID, -- cgit v1.2.3