aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-02-12 23:57:47 +0800
committerChristian Persch <chpe@src.gnome.org>2004-02-12 23:57:47 +0800
commit7aa2a5fe7359080ede030b353f951942efae9b2d (patch)
treeddbb2f609d17f2c7ba6b536087c783c51e05cd03
parentb19e63aed65b23a62025270f3e696ecb699cf82d (diff)
downloadgsoc2013-epiphany-7aa2a5fe7359080ede030b353f951942efae9b2d.tar
gsoc2013-epiphany-7aa2a5fe7359080ede030b353f951942efae9b2d.tar.gz
gsoc2013-epiphany-7aa2a5fe7359080ede030b353f951942efae9b2d.tar.bz2
gsoc2013-epiphany-7aa2a5fe7359080ede030b353f951942efae9b2d.tar.lz
gsoc2013-epiphany-7aa2a5fe7359080ede030b353f951942efae9b2d.tar.xz
gsoc2013-epiphany-7aa2a5fe7359080ede030b353f951942efae9b2d.tar.zst
gsoc2013-epiphany-7aa2a5fe7359080ede030b353f951942efae9b2d.zip
Adapt to the ever-changing mozilla APIs.
2004-02-12 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/GlobalHistory.cpp: * embed/mozilla/GlobalHistory.h: * embed/mozilla/MozRegisterComponents.cpp: Adapt to the ever-changing mozilla APIs.
-rw-r--r--ChangeLog9
-rw-r--r--embed/mozilla/EphyBrowser.cpp8
-rw-r--r--embed/mozilla/GlobalHistory.cpp79
-rw-r--r--embed/mozilla/GlobalHistory.h49
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp10
5 files changed, 126 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 28b6b9846..0fb128814 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-02-12 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/mozilla/EphyBrowser.cpp:
+ * embed/mozilla/GlobalHistory.cpp:
+ * embed/mozilla/GlobalHistory.h:
+ * embed/mozilla/MozRegisterComponents.cpp:
+
+ Adapt to the ever-changing mozilla APIs.
+
2004-02-12 Marco Pesenti Gritti <marco@gnome.org>
* lib/widgets/ephy-location-entry.c: (keyword_match):
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index 4f8e31246..8cb9c1410 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -463,10 +463,16 @@ nsresult EphyBrowser::SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell)
nsCOMPtr<nsIPresContext> PresContext;
DocShell->GetPresContext (getter_AddRefs(PresContext));
NS_ENSURE_TRUE (PresContext, NS_ERROR_FAILURE);
-
+
+#if MOZILLA_SNAPSHOT > 13
+ nsIDeviceContext *DeviceContext(nsnull);
+ DeviceContext = PresContext->DeviceContext();
+ NS_ENSURE_TRUE (DeviceContext, NS_ERROR_FAILURE);
+#else
nsCOMPtr<nsIDeviceContext> DeviceContext;
PresContext->GetDeviceContext (getter_AddRefs(DeviceContext));
NS_ENSURE_TRUE (DeviceContext, NS_ERROR_FAILURE);
+#endif
return DeviceContext->SetTextZoom (aZoom);
}
diff --git a/embed/mozilla/GlobalHistory.cpp b/embed/mozilla/GlobalHistory.cpp
index 3e87d84ca..17bcbae67 100644
--- a/embed/mozilla/GlobalHistory.cpp
+++ b/embed/mozilla/GlobalHistory.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2001 Philip Langdale
+ * Copyright (C) 2001, 2004 Philip Langdale
+ * Copyright (C) 2004 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
@@ -25,9 +26,17 @@
#include "ephy-embed-shell.h"
#include "GlobalHistory.h"
-#include "nsString.h"
-NS_IMPL_ISUPPORTS2(MozGlobalHistory, nsIGlobalHistory, nsIBrowserHistory)
+#include <nsString.h>
+#include <nsIURI.h>
+
+NS_IMPL_ISUPPORTS2(MozGlobalHistory,
+#if MOZILLA_SNAPSHOT > 13
+ nsIGlobalHistory2,
+#else
+ nsIGlobalHistory,
+#endif
+ nsIBrowserHistory)
MozGlobalHistory::MozGlobalHistory ()
{
@@ -38,6 +47,52 @@ MozGlobalHistory::~MozGlobalHistory ()
{
}
+#if MOZILLA_SNAPSHOT > 13
+
+/* void addURI (in nsIURI aURI, in boolean aRedirect, in boolean aToplevel); */
+NS_IMETHODIMP MozGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aToplevel)
+{
+ nsCAutoString spec;
+ aURI->GetSpec(spec);
+
+ ephy_history_add_page (mGlobalHistory, spec.get());
+
+ return NS_OK;
+}
+
+//* boolean isVisited (in nsIURI aURI); */
+NS_IMETHODIMP MozGlobalHistory::IsVisited(nsIURI *aURI, PRBool *_retval)
+{
+ nsCAutoString spec;
+ aURI->GetSpec(spec);
+
+ *_retval = ephy_history_is_page_visited (mGlobalHistory, spec.get());
+
+ return NS_OK;
+}
+
+/* void setPageTitle (in nsIURI aURI, in AString aTitle); */
+NS_IMETHODIMP MozGlobalHistory::SetPageTitle(nsIURI *aURI, const nsAString & aTitle)
+{
+ const nsACString &title = NS_ConvertUTF16toUTF8(aTitle);
+
+ nsCAutoString spec;
+ aURI->GetSpec(spec);
+
+ ephy_history_set_page_title (mGlobalHistory, spec.get(),
+ PromiseFlatCString(title).get());
+
+ return NS_OK;
+}
+
+/* void hidePage (in nsIURI url); */
+NS_IMETHODIMP MozGlobalHistory::HidePage(nsIURI *url)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+#else
+
/* void addPage (in string aURL); */
NS_IMETHODIMP MozGlobalHistory::AddPage (const char *aURL)
{
@@ -66,6 +121,13 @@ NS_IMETHODIMP MozGlobalHistory::SetPageTitle (const char *aURL,
return NS_OK;
}
+NS_IMETHODIMP MozGlobalHistory::HidePage(const char *url)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+
+}
+#endif /* MOZILLA_SNAPSHOT > 13 */
+
/* void removePage (in string aURL); */
NS_IMETHODIMP MozGlobalHistory::RemovePage(const char *aURL)
{
@@ -74,7 +136,7 @@ NS_IMETHODIMP MozGlobalHistory::RemovePage(const char *aURL)
/* void removePagesFromHost (in string aHost, in boolean aEntireDomain); */
NS_IMETHODIMP MozGlobalHistory::RemovePagesFromHost(const char *aHost,
- PRBool aEntireDomain)
+ PRBool aEntireDomain)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -91,19 +153,13 @@ NS_IMETHODIMP MozGlobalHistory::GetLastPageVisited(char **aLastPageVisited)
return NS_ERROR_NOT_IMPLEMENTED;
}
-#if MOZILLA_SNAPSHOT > 8
+#if MOZILLA_SNAPSHOT <= 13
NS_IMETHODIMP MozGlobalHistory::SetLastPageVisited(const char *aLastPageVisited)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#endif
-NS_IMETHODIMP MozGlobalHistory::HidePage(const char *url)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-
-}
-
/* readonly attribute PRUint32 count; */
NS_IMETHODIMP MozGlobalHistory::GetCount(PRUint32 *aCount)
{
@@ -115,4 +171,3 @@ NS_IMETHODIMP MozGlobalHistory::MarkPageAsTyped(const char *url)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
-
diff --git a/embed/mozilla/GlobalHistory.h b/embed/mozilla/GlobalHistory.h
index 4315509af..35e744b0f 100644
--- a/embed/mozilla/GlobalHistory.h
+++ b/embed/mozilla/GlobalHistory.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2001 Philip Langdale
- *
+ * Copyright (C) 2001, 204 Philip Langdale
+ *
* 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)
@@ -14,39 +14,56 @@
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
-#ifndef __GlobalHistory_h
-#define __GlobalHistory_h
+#ifndef EPHY_GLOBAL_HISTORY_H
+#define EPHY_GLOBAL_HISTORY_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "nsError.h"
-#include "nsIGlobalHistory.h"
#include "nsIBrowserHistory.h"
#include "ephy-history.h"
-#define EPHY_GLOBALHISTORY_CLASSNAME \
- "Epiphany's Global History Implementation"
+#if MOZILLA_SNAPSHOT > 13
+#include <nsIGlobalHistory2.h>
+#else
+#include <nsIGlobalHistory.h>
+#endif
-#define EPHY_GLOBALHISTORY_CID \
- { 0xbe0c42c1, 0x39d4, 0x4271, { 0xb7, 0x9e, 0xf7, 0xaa, 0x49, 0xeb, 0x6a, 0x15}}
+#define EPHY_GLOBALHISTORY_CLASSNAME "Epiphany Global History Implementation"
-/**
- * class GlobalHistory:
- *
- */
-class MozGlobalHistory: public nsIGlobalHistory,
- public nsIBrowserHistory
+#define EPHY_GLOBALHISTORY_CID \
+{ 0xbe0c42c1, \
+ 0x39d4, \
+ 0x4271, \
+ { 0xb7, 0x9e, 0xf7, 0xaa, 0x49, 0xeb, 0x6a, 0x15} \
+}
+
+class MozGlobalHistory:
+#if MOZILLA_SNAPSHOT <= 13
+ public nsIGlobalHistory,
+#endif
+ public nsIBrowserHistory
{
public:
MozGlobalHistory ();
virtual ~MozGlobalHistory();
NS_DECL_ISUPPORTS
+#if MOZILLA_SNAPSHOT > 13
+ NS_DECL_NSIGLOBALHISTORY2
+#else
NS_DECL_NSIGLOBALHISTORY
+#endif
NS_DECL_NSIBROWSERHISTORY
private:
EphyHistory *mGlobalHistory;
};
-#endif
+#endif /* EPHY_GLOBAL_HISTORY_H */
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index 6168c82e5..692fc1710 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -39,11 +39,17 @@
#include "GtkNSSKeyPairDialogs.h"
#endif
+#if MOZILLA_SNAPSHOT > 13
+#include <nsDocShellCID.h>
+#endif
#include <nsIGenericFactory.h>
#include <nsIComponentRegistrar.h>
#include <nsCOMPtr.h>
#include <nsILocalFile.h>
#include <nsNetCID.h>
+#if MOZILLA_SNAPSHOT > 13
+#include <nsDocShellCID.h>
+#endif
#include <glib.h>
@@ -125,7 +131,11 @@ static const nsModuleComponentInfo sAppComps[] = {
{
EPHY_GLOBALHISTORY_CLASSNAME,
EPHY_GLOBALHISTORY_CID,
+#if MOZILLA_SNAPSHOT > 13
+ NS_GLOBALHISTORY2_CONTRACTID,
+#else
NS_GLOBALHISTORY_CONTRACTID,
+#endif
MozGlobalHistoryConstructor
},
{