aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-07-18 00:06:04 +0800
committerChristian Persch <chpe@src.gnome.org>2005-07-18 00:06:04 +0800
commit056e78ca2904f2a8f7eaa200098f36f0029c4425 (patch)
treef470b02bc5cd83049fee08d65b6f5f37e13bd344
parent23c1956430766dd72294ca2ca5f79e199ad7ed3b (diff)
downloadgsoc2013-epiphany-056e78ca2904f2a8f7eaa200098f36f0029c4425.tar
gsoc2013-epiphany-056e78ca2904f2a8f7eaa200098f36f0029c4425.tar.gz
gsoc2013-epiphany-056e78ca2904f2a8f7eaa200098f36f0029c4425.tar.bz2
gsoc2013-epiphany-056e78ca2904f2a8f7eaa200098f36f0029c4425.tar.lz
gsoc2013-epiphany-056e78ca2904f2a8f7eaa200098f36f0029c4425.tar.xz
gsoc2013-epiphany-056e78ca2904f2a8f7eaa200098f36f0029c4425.tar.zst
gsoc2013-epiphany-056e78ca2904f2a8f7eaa200098f36f0029c4425.zip
A embed/mozilla/EphyAboutModule.cpp: A embed/mozilla/EphyAboutModule.h: R
2005-07-17 Christian Persch <chpe@cvs.gnome.org> A embed/mozilla/EphyAboutModule.cpp: A embed/mozilla/EphyAboutModule.h: R embed/mozilla/EphyProtocolHandler.cpp: R embed/mozilla/EphyProtocolHandler.h: * embed/mozilla/Makefile.am: * embed/mozilla/MozRegisterComponents.cpp: * po/POTFILES.in: Yet another mozilla API change. * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_get_smart_bookmark_width): Remove stray g_print, and clamp entry width to sane values.
-rw-r--r--ChangeLog17
-rw-r--r--embed/mozilla/EphyAboutModule.cpp (renamed from embed/mozilla/EphyProtocolHandler.cpp)155
-rw-r--r--embed/mozilla/EphyAboutModule.h (renamed from embed/mozilla/EphyProtocolHandler.h)22
-rw-r--r--embed/mozilla/Makefile.am4
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp20
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/bookmarks/ephy-bookmarks.c3
7 files changed, 78 insertions, 145 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e6243c69..08145ab6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2005-07-17 Christian Persch <chpe@cvs.gnome.org>
+ A embed/mozilla/EphyAboutModule.cpp:
+ A embed/mozilla/EphyAboutModule.h:
+ R embed/mozilla/EphyProtocolHandler.cpp:
+ R embed/mozilla/EphyProtocolHandler.h:
+ * embed/mozilla/Makefile.am:
+ * embed/mozilla/MozRegisterComponents.cpp:
+ * po/POTFILES.in:
+
+ Yet another mozilla API change.
+
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_get_smart_bookmark_width):
+
+ Remove stray g_print, and clamp entry width to sane values.
+
+2005-07-17 Christian Persch <chpe@cvs.gnome.org>
+
* lib/ephy-file-helpers.c:
Remove stray g_print.
diff --git a/embed/mozilla/EphyProtocolHandler.cpp b/embed/mozilla/EphyAboutModule.cpp
index 9c6184849..f6247eec3 100644
--- a/embed/mozilla/EphyProtocolHandler.cpp
+++ b/embed/mozilla/EphyAboutModule.cpp
@@ -42,86 +42,41 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include "EphyProtocolHandler.h"
+#include "EphyAboutModule.h"
#include "EphyUtils.h"
#include "ephy-debug.h"
#include <string.h>
-EphyProtocolHandler::EphyProtocolHandler()
+EphyAboutModule::EphyAboutModule()
{
- LOG ("EphyProtocolHandler ctor [%p]\n", this);
+ LOG ("EphyAboutModule ctor [%p]\n", this);
}
-EphyProtocolHandler::~EphyProtocolHandler()
+EphyAboutModule::~EphyAboutModule()
{
- LOG ("EphyProtocolHandler dtor [%p]\n", this);
+ LOG ("EphyAboutModule dtor [%p]\n", this);
}
-NS_IMPL_ISUPPORTS2 (EphyProtocolHandler, nsIProtocolHandler, nsIAboutModule)
-
-/* readonly attribute string scheme; */
-NS_IMETHODIMP
-EphyProtocolHandler::GetScheme(nsACString &aScheme)
-{
- aScheme.Assign("epiphany");
- return NS_OK;
-}
-
-/* readonly attribute long defaultPort; */
-NS_IMETHODIMP
-EphyProtocolHandler::GetDefaultPort(PRInt32 *aDefaultPort)
-{
- NS_ENSURE_ARG_POINTER (aDefaultPort);
-
- *aDefaultPort = -1;
- return NS_OK;
-}
-
-/* readonly attribute short protocolFlags; */
-NS_IMETHODIMP
-EphyProtocolHandler::GetProtocolFlags(PRUint32 *aProtocolFlags)
-{
- NS_ENSURE_ARG_POINTER (aProtocolFlags);
-
- *aProtocolFlags = nsIProtocolHandler::URI_NORELATIVE | nsIProtocolHandler::URI_NOAUTH;
- return NS_OK;
-}
-
-/* nsIURI newURI (in string aSpec, in nsIURI aBaseURI); */
-NS_IMETHODIMP
-EphyProtocolHandler::NewURI(const nsACString &aSpec,
- const char *aOriginCharset,
- nsIURI *aBaseURI,
- nsIURI **_retval)
-{
- nsresult rv;
- nsCOMPtr<nsIURI> uri (do_CreateInstance("@mozilla.org/network/simple-uri;1", &rv));
- NS_ENSURE_SUCCESS (rv, rv);
-
- rv = uri->SetSpec (aSpec);
- NS_ENSURE_SUCCESS (rv, rv);
-
- NS_ADDREF(*_retval = uri);
- return NS_OK;
-}
+NS_IMPL_ISUPPORTS1 (EphyAboutModule, nsIAboutModule)
/* nsIChannel newChannel (in nsIURI aURI); */
NS_IMETHODIMP
-EphyProtocolHandler::NewChannel(nsIURI *aURI,
- nsIChannel **_retval)
+EphyAboutModule::NewChannel(nsIURI *aURI,
+ nsIChannel **_retval)
{
NS_ENSURE_ARG(aURI);
- PRBool isEpiphany = PR_FALSE;
- if (NS_SUCCEEDED (aURI->SchemeIs ("epiphany", &isEpiphany)) && isEpiphany)
+ nsCAutoString path;
+ aURI->GetPath (path);
+
+ if (strncmp (path.get(), "neterror", strlen ("neterror")) == 0)
{
- return HandleEpiphany (aURI, _retval);
+ return CreateErrorPage (aURI, _retval);
}
- PRBool isAbout = PR_FALSE;
- if (NS_SUCCEEDED (aURI->SchemeIs ("about", &isAbout)) && isAbout)
+ if (strncmp (path.get (), "epiphany", strlen ("epiphany")) == 0)
{
return Redirect (nsDependentCString ("file://" SHARE_DIR "/epiphany.xhtml"), _retval);
}
@@ -129,21 +84,11 @@ EphyProtocolHandler::NewChannel(nsIURI *aURI,
return NS_ERROR_ILLEGAL_VALUE;
}
-/* boolean allowPort (in long port, in string scheme); */
-NS_IMETHODIMP
-EphyProtocolHandler::AllowPort(PRInt32 port,
- const char *scheme,
- PRBool *_retval)
-{
- *_retval = PR_FALSE;
- return NS_OK;
-}
-
/* private functions */
nsresult
-EphyProtocolHandler::Redirect(const nsACString &aURL,
- nsIChannel **_retval)
+EphyAboutModule::Redirect(const nsACString &aURL,
+ nsIChannel **_retval)
{
nsresult rv;
nsCOMPtr<nsIIOService> ioService;
@@ -176,11 +121,11 @@ EphyProtocolHandler::Redirect(const nsACString &aURL,
}
nsresult
-EphyProtocolHandler::ParseErrorURL(const char *aURL,
- nsACString &aError,
- nsACString &aRawOriginURL,
- nsACString &aOriginURL,
- nsACString &aOriginCharset)
+EphyAboutModule::ParseErrorURL(const char *aURL,
+ nsACString &aError,
+ nsACString &aRawOriginURL,
+ nsACString &aOriginURL,
+ nsACString &aOriginCharset)
{
/* The error page URL is of the form "epiphany:error?e=<error>&u=<URL>&c=<charset>&d=<description>" */
const char *query = strstr (aURL, "?");
@@ -223,12 +168,12 @@ EphyProtocolHandler::ParseErrorURL(const char *aURL,
}
nsresult
-EphyProtocolHandler::GetErrorMessage(nsIURI *aURI,
- const char *aError,
- char **aPrimary,
- char **aSecondary,
- char **aTertiary,
- char **aLinkIntro)
+EphyAboutModule::GetErrorMessage(nsIURI *aURI,
+ const char *aError,
+ char **aPrimary,
+ char **aSecondary,
+ char **aTertiary,
+ char **aLinkIntro)
{
if (strcmp (aError, "protocolNotFound") == 0)
{
@@ -391,25 +336,8 @@ EphyProtocolHandler::GetErrorMessage(nsIURI *aURI,
}
nsresult
-EphyProtocolHandler::HandleEpiphany(nsIURI *aErrorURI,
- nsIChannel **_retval)
-{
- NS_ENSURE_ARG (aErrorURI);
-
- nsCAutoString spec;
- aErrorURI->GetSpec (spec);
-
- if (g_str_has_prefix (spec.get(), "epiphany:error?"))
- {
- return CreateErrorPage (aErrorURI, _retval);
- }
-
- return NS_ERROR_ILLEGAL_VALUE;
-}
-
-nsresult
-EphyProtocolHandler::CreateErrorPage(nsIURI *aErrorURI,
- nsIChannel **_retval)
+EphyAboutModule::CreateErrorPage(nsIURI *aErrorURI,
+ nsIChannel **_retval)
{
/* First parse the arguments */
nsresult rv = NS_ERROR_ILLEGAL_VALUE;
@@ -429,13 +357,17 @@ EphyProtocolHandler::CreateErrorPage(nsIURI *aErrorURI,
char *primary = nsnull, *secondary = nsnull, *tertiary = nsnull, *linkintro = nsnull;
rv = GetErrorMessage (uri, error.get(), &primary, &secondary, &tertiary, &linkintro);
- /* we don't know about this error code; forward to mozilla's impl */
+ /* we don't know about this error code.
+ * FIXME: We'd like to forward to mozilla's about:neterror handler,
+ * but I don't know how to. So just redirect to the same page that
+ * mozilla's handler redirects to.
+ */
if (rv == NS_ERROR_ILLEGAL_VALUE)
{
nsCAutoString url(spec);
- /* remove "epiphany:error" part and insert mozilla's error page url */
- url.Cut(0, strlen ("epiphany:error"));
+ /* remove "about:neterror" part and insert mozilla's error page url */
+ url.Cut(0, strlen ("about:neterror"));
url.Insert("chrome://global/content/netError.xhtml", 0);
return Redirect (url, _retval);
@@ -580,20 +512,9 @@ EphyProtocolHandler::CreateErrorPage(nsIURI *aErrorURI,
}
nsresult
-EphyProtocolHandler::Write(nsIOutputStream *aStream,
- const char *aText)
+EphyAboutModule::Write(nsIOutputStream *aStream,
+ const char *aText)
{
PRUint32 bytesWritten;
return aStream->Write (aText, strlen (aText), &bytesWritten);
}
-
-nsresult
-EphyProtocolHandler::WriteHTMLEscape(nsIOutputStream *aStream,
- const char *aText)
-{
- char *text = g_markup_escape_text (aText, strlen (aText));
- nsresult rv = Write (aStream, text);
- g_free (text);
-
- return rv;
-}
diff --git a/embed/mozilla/EphyProtocolHandler.h b/embed/mozilla/EphyAboutModule.h
index 915d704cb..7b9f2f0e9 100644
--- a/embed/mozilla/EphyProtocolHandler.h
+++ b/embed/mozilla/EphyAboutModule.h
@@ -25,40 +25,36 @@
#include <nsError.h>
#include <nsIAboutModule.h>
-#include <nsIProtocolHandler.h>
/* a9aea13e-21de-4be8-a07e-a05f11658c55 */
-#define EPHY_PROTOCOL_HANDLER_CID \
+#define EPHY_ABOUT_MODULE_CID \
{ 0xa9aea13e, 0x21de, 0x4be8, \
{ 0xa0, 0x7e, 0xa0, 0x5f, 0x11, 0x65, 0x8c, 0x55 } }
-#define EPHY_PROTOCOL_HANDLER_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "epiphany"
-#define EPHY_PROTOCOL_HANDLER_CLASSNAME "Epiphany Protocol Handler"
-#define EPHY_ABOUT_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "epiphany"
-#define EPHY_ABOUT_CLASSNAME "Epiphany's about:epiphany"
+#define EPHY_ABOUT_NETERROR_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror"
+#define EPHY_ABOUT_NETERROR_CLASSNAME "Epiphany about:neterror module"
+#define EPHY_ABOUT_EPIPHANY_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "epiphany"
+#define EPHY_ABOUT_EPIPHANY_CLASSNAME "Epiphany about:epiphany module"
class nsIChannel;
class nsIOutputStream;
class nsIURI;
-class EphyProtocolHandler : public nsIProtocolHandler,
- public nsIAboutModule
+class EphyAboutModule : public nsIAboutModule
{
public:
NS_DECL_ISUPPORTS
- NS_DECL_NSIPROTOCOLHANDLER
+ NS_DECL_NSIABOUTMODULE
- EphyProtocolHandler();
- virtual ~EphyProtocolHandler();
+ EphyAboutModule();
+ virtual ~EphyAboutModule();
private:
nsresult Redirect(const nsACString&, nsIChannel**);
nsresult ParseErrorURL(const char*, nsACString&, nsACString&, nsACString&, nsACString&);
nsresult GetErrorMessage(nsIURI*, const char*, char**, char**, char**, char**);
- nsresult HandleEpiphany(nsIURI*, nsIChannel**);
nsresult CreateErrorPage(nsIURI*, nsIChannel**);
nsresult Write(nsIOutputStream*, const char*);
- nsresult WriteHTMLEscape(nsIOutputStream*, const char*);
};
#endif /* EPHY_PROTOCOL_HANDLER_H */
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index 30a05f0fb..385a39b81 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -66,8 +66,8 @@ endif
if HAVE_GECKO_1_8
libephymozillaembed_la_SOURCES += \
- EphyProtocolHandler.cpp \
- EphyProtocolHandler.h
+ EphyAboutModule.cpp \
+ EphyAboutModule.h
endif
mozilla_include_subdirs = \
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index f52226616..bc7ee4709 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -43,7 +43,7 @@
#endif
#ifdef HAVE_GECKO_1_8
-#include "EphyProtocolHandler.h"
+#include "EphyAboutModule.h"
#endif
#include <nsMemory.h>
@@ -76,7 +76,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSSecurityWarningDialogs)
#endif
#ifdef HAVE_GECKO_1_8
-NS_GENERIC_FACTORY_CONSTRUCTOR(EphyProtocolHandler)
+NS_GENERIC_FACTORY_CONSTRUCTOR(EphyAboutModule)
#endif
/* class information */
@@ -207,16 +207,16 @@ static const nsModuleComponentInfo sAppComps[] = {
},
#ifdef HAVE_GECKO_1_8
{
- EPHY_ABOUT_CLASSNAME,
- EPHY_PROTOCOL_HANDLER_CID,
- EPHY_ABOUT_CONTRACTID,
- EphyProtocolHandlerConstructor
+ EPHY_ABOUT_EPIPHANY_CLASSNAME,
+ EPHY_ABOUT_MODULE_CID,
+ EPHY_ABOUT_EPIPHANY_CONTRACTID,
+ EphyAboutModuleConstructor
},
{
- EPHY_PROTOCOL_HANDLER_CLASSNAME,
- EPHY_PROTOCOL_HANDLER_CID,
- EPHY_PROTOCOL_HANDLER_CONTRACTID,
- EphyProtocolHandlerConstructor
+ EPHY_ABOUT_NETERROR_CLASSNAME,
+ EPHY_ABOUT_MODULE_CID,
+ EPHY_ABOUT_NETERROR_CONTRACTID,
+ EphyAboutModuleConstructor
},
#endif
};
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fe6e79c84..72fc1f36c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,8 +14,8 @@ embed/downloader-view.c
embed/ephy-encodings.c
embed/ephy-history.c
embed/mozilla/ContentHandler.cpp
+embed/mozilla/EphyAboutModule.cpp
embed/mozilla/EphyHeaderSniffer.cpp
-embed/mozilla/EphyProtocolHandler.cpp
embed/mozilla/FilePicker.cpp
embed/mozilla/GtkNSSClientAuthDialogs.cpp
embed/mozilla/GtkNSSDialogs.cpp
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 2761ee702..25caad17f 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -1383,10 +1383,9 @@ ephy_bookmarks_get_smart_bookmark_width (EphyNode *bookmark)
if (number == NULL) return 0;
width = atoi (number);
- g_print ("Width %s -> %d\n", number, width);
g_free (number);
- return width;
+ return CLAMP (width, 1, 64);
}
EphyNode *