aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/StartHereProtocolHandler.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-08 04:34:09 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-08 04:34:09 +0800
commit977e13469d48102bc3812140bdf3faf955e9f11a (patch)
tree133d157d8c0399adf9792a32207fcfa41ccbfeab /embed/mozilla/StartHereProtocolHandler.cpp
parentc088c9ab24ffeafeef6b7b092facb6f3f57efc28 (diff)
downloadgsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar
gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.gz
gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.bz2
gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.lz
gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.xz
gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.zst
gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.zip
More work on the start here page.
2003-01-07 Marco Pesenti Gritti <marco@it.gnome.org> * data/starthere/Makefile.am: * data/starthere/index.xml.in: * data/starthere/section.css: * data/starthere/section.xsl: * embed/mozilla/StartHereProtocolHandler.cpp: * embed/mozilla/mozilla-embed-shell.cpp: * lib/ephy-file-helpers.c: (ephy_ensure_dir_exists), (ephy_find_file_recursive), (ephy_file_find): * lib/ephy-file-helpers.h: * lib/ephy-start-here.c: (ephy_start_here_init), (ephy_start_here_finalize), (is_my_lang), (mozilla_bookmarks), (attach_content), (build_content), (ephy_start_here_get_page), (ephy_start_here_get_base_uri): * lib/ephy-start-here.h: More work on the start here page.
Diffstat (limited to 'embed/mozilla/StartHereProtocolHandler.cpp')
-rw-r--r--embed/mozilla/StartHereProtocolHandler.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/embed/mozilla/StartHereProtocolHandler.cpp b/embed/mozilla/StartHereProtocolHandler.cpp
index 4ea95294c..2d2bb3c35 100644
--- a/embed/mozilla/StartHereProtocolHandler.cpp
+++ b/embed/mozilla/StartHereProtocolHandler.cpp
@@ -41,7 +41,6 @@ class GStartHereProtocolHandler : public nsIProtocolHandler
virtual ~GStartHereProtocolHandler();
nsCOMPtr<nsIChannel> mChannel;
- nsCOMPtr<nsIURI> mURI;
};
/* Implementation file */
@@ -115,10 +114,9 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
nsresult rv;
EphyStartHere *sh;
char *buf;
+ const char *aBaseURI;
PRUint32 bytesWritten;
-
- mURI = aURI;
-
+
nsCAutoString path;
rv = aURI->GetPath(path);
if (NS_FAILED(rv)) return rv;
@@ -134,9 +132,16 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
sh = ephy_start_here_new ();
buf = ephy_start_here_get_page (sh, "index");
- rv = stream->Write (buf, strlen (buf), &bytesWritten);
- g_free (buf);
+ aBaseURI = ephy_start_here_get_base_uri (sh);
+ rv = stream->Write (buf, strlen (buf), &bytesWritten);
+ if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> uri;
+ nsCAutoString spec(aBaseURI);
+ rv = NS_NewURI(getter_AddRefs(uri), spec.get());
+ if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
+
nsCOMPtr<nsIInputStream> iStream;
PRUint32 size;
@@ -146,10 +151,13 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI,
rv = sStream->NewInputStream(0, getter_AddRefs(iStream));
if (NS_FAILED(rv)) return rv;
- rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), mURI,
+ rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
iStream, NS_LITERAL_CSTRING("text/xml"),
NS_LITERAL_CSTRING("utf-8"), size);
+ g_free (buf);
+ g_object_unref (sh);
+
NS_IF_ADDREF (*_retval = mChannel);
return rv;