diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-01-15 05:06:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-01-15 05:06:48 +0800 |
commit | 7ee5680874383d1d111ae3cd3dec10c5b4111385 (patch) | |
tree | 6dfe29c741753a421ba1f8a6153576968d0241df /embed/mozilla/EphyDirectoryProvider.cpp | |
parent | d9c3fe17a3c1595fdf4ae850a03efc093cac8aea (diff) | |
download | gsoc2013-epiphany-7ee5680874383d1d111ae3cd3dec10c5b4111385.tar gsoc2013-epiphany-7ee5680874383d1d111ae3cd3dec10c5b4111385.tar.gz gsoc2013-epiphany-7ee5680874383d1d111ae3cd3dec10c5b4111385.tar.bz2 gsoc2013-epiphany-7ee5680874383d1d111ae3cd3dec10c5b4111385.tar.lz gsoc2013-epiphany-7ee5680874383d1d111ae3cd3dec10c5b4111385.tar.xz gsoc2013-epiphany-7ee5680874383d1d111ae3cd3dec10c5b4111385.tar.zst gsoc2013-epiphany-7ee5680874383d1d111ae3cd3dec10c5b4111385.zip |
Add defines and automake conditional for toolkit flavour.
2006-01-14 Christian Persch <chpe@cvs.gnome.org>
* m4/gecko.m4:
Add defines and automake conditional for toolkit flavour.
* configure.ac:
* data/Makefile.am:
A data/chrome/.cvsignore:
A data/chrome/Makefile.am:
A data/chrome/brand.dtd.in:
A data/chrome/brand.properties.in:
A data/chrome/epiphany.manifest.in:
Provide branding so mozilla dialogues don't show "Deer Park" or
"Firefox" but "Epiphany" instead.
* embed/mozilla/Makefile.am:
A embed/mozilla/EphyDirectoryProvider.cpp:
A embed/mozilla/EphyDirectoryProvider.h:
* embed/mozilla/mozilla-embed-single.cpp:
Add a directory service provider.
Diffstat (limited to 'embed/mozilla/EphyDirectoryProvider.cpp')
-rw-r--r-- | embed/mozilla/EphyDirectoryProvider.cpp | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/embed/mozilla/EphyDirectoryProvider.cpp b/embed/mozilla/EphyDirectoryProvider.cpp new file mode 100644 index 000000000..1c9e30b4d --- /dev/null +++ b/embed/mozilla/EphyDirectoryProvider.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2006 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1, 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 Lesser 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$ + */ + +#include "mozilla-config.h" + +#include "config.h" + +#include "EphyDirectoryProvider.h" + +#include <nsCOMPtr.h> +#include <nsIIOService.h> +#include <nsNetUtil.h> +#include <nsEnumeratorUtils.h> +#include <nsILocalFile.h> +#include <nsAppDirectoryServiceDefs.h> +#include <nsIToolkitChromeRegistry.h> +#include <nsIDirectoryService.h> +#include <nsISupportsArray.h> + +#include <string.h> + +NS_IMPL_ISUPPORTS2 (EphyDirectoryProvider, + nsIDirectoryServiceProvider, + nsIDirectoryServiceProvider2) + + +/* nsIFile getFile (in string prop, out PRBool persistent); */ +NS_IMETHODIMP +EphyDirectoryProvider::GetFile (const char *prop, + PRBool *persistent, + nsIFile **_retval) +{ + return NS_ERROR_FAILURE; +} + +/* nsISimpleEnumerator getFiles (in string prop); */ +NS_IMETHODIMP +EphyDirectoryProvider::GetFiles (const char *prop, + nsISimpleEnumerator **_retval) +{ + nsresult rv = NS_ERROR_FAILURE; + + if (prop && strcmp (prop, NS_CHROME_MANIFESTS_FILE_LIST) == 0) + { + nsCOMPtr<nsILocalFile> manifestDir; + rv = NS_NewNativeLocalFile (nsDependentCString(SHARE_DIR "/chrome"), PR_TRUE, + getter_AddRefs (manifestDir)); + NS_ENSURE_SUCCESS (rv, rv); + + nsCOMPtr<nsISupports> element (do_QueryInterface (manifestDir, &rv)); + NS_ENSURE_SUCCESS (rv, rv); + + /* FIXME: this sucks! + * When we don't implement a directory service provider, + * the chrome registry takes its manifests files from the + * app chrome dir; but it doesn't append this dir when + * we do provide our own (additional) chrome manifest dirs! + * http://lxr.mozilla.org/seamonkey/source/chrome/src/nsChromeRegistry.cpp#1147 + */ + nsCOMPtr<nsIProperties> dirServ (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); + NS_ENSURE_SUCCESS (rv, rv); + + nsCOMPtr<nsIFile> chromeDir; + rv = dirServ->Get (NS_APP_CHROME_DIR, NS_GET_IID (nsIFile), + getter_AddRefs (chromeDir)); + NS_ENSURE_SUCCESS (rv, rv); + + nsCOMPtr<nsISupportsArray> array; + rv = NS_NewISupportsArray (getter_AddRefs (array)); + NS_ENSURE_SUCCESS (rv, rv); + + rv = array->AppendElement (manifestDir); + rv |= array->AppendElement (chromeDir); + NS_ENSURE_SUCCESS (rv, rv); + + rv = NS_NewArrayEnumerator (_retval, array); + NS_ENSURE_SUCCESS (rv, rv); + + rv = NS_SUCCESS_AGGREGATE_RESULT; + } + + return rv; +} |