Bug 484708 - Un-annotated dependency of gtkmozembed2.cpp on gtkmozembedmarshal.h, r=ted
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 31 Mar 2009 08:43:30 -0400
changeset 26761 8b4409c3a9f84134bba82dcbeec5b4e1a655323c
parent 26760 c98003848229bfacd11f2eda3353d3f2c046b819
child 26762 a5556353ba2cc53df231b28ae05c6bc6dc6a878c
push idunknown
push userunknown
push dateunknown
reviewersted
bugs484708
milestone1.9.2a1pre
Bug 484708 - Un-annotated dependency of gtkmozembed2.cpp on gtkmozembedmarshal.h, r=ted
embedding/browser/gtk/src/EmbedDownloadMgr.cpp
embedding/browser/gtk/src/EmbedDownloadMgr.h
embedding/browser/gtk/src/EmbedFilePicker.cpp
embedding/browser/gtk/src/EmbedFilePicker.h
embedding/browser/gtk/src/EmbedGlobalHistory.cpp
embedding/browser/gtk/src/EmbedGlobalHistory.h
embedding/browser/gtk/src/Makefile.in
embedding/browser/gtk/src/gtkmozembed_common.cpp
embedding/browser/gtk/src/gtkmozembed_common.h
embedding/browser/gtk/src/gtkmozembed_download.cpp
embedding/browser/gtk/src/gtkmozembed_download.h
deleted file mode 100644
--- a/embedding/browser/gtk/src/EmbedDownloadMgr.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Christopher Blizzard <blizzard@mozilla.org>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-/**
- * Derived from GContentHandler http://landfill.mozilla.org/mxr-test/gnome/source/galeon/mozilla/ContentHandler.cpp
- */
-#include "EmbedDownloadMgr.h"
-#include "EmbedGtkTools.h"
-#ifdef MOZILLA_INTERNAL_API
-#include "nsXPIDLString.h"
-#else
-#include "nsComponentManagerUtils.h"
-#endif
-#include "nsIChannel.h"
-#include "nsIWebProgress.h"
-#include "nsIDOMWindow.h"
-#include "nsIURI.h"
-#include "nsCRT.h"
-#include "nsIPromptService.h"
-#include "nsIWebProgressListener2.h"
-#include "nsCOMPtr.h"
-#include "nsIServiceManager.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "nsIURI.h"
-#include "nsIURL.h"
-#include "nsIFile.h"
-#include "nsIDOMWindow.h"
-#include "nsIExternalHelperAppService.h"
-#include "nsCExternalHandlerService.h"
-#include "nsMemory.h"
-#include "nsNetError.h"
-#include "nsIStreamListener.h"
-#include "nsIFile.h"
-#include "nsILocalFile.h"
-#include "nsNetCID.h"
-#include <unistd.h>
-#include "gtkmozembed_download.h"
-#include "nsIIOService.h"
-
-#define UNKNOWN_FILE_SIZE -1
-
-class EmbedDownloadMgr;
-class ProgressListener : public nsIWebProgressListener2
-{
-public:
-    ProgressListener(EmbedDownload *aDownload):mDownload(aDownload)
-    {
-    }
-
-    ~ProgressListener(void)
-    {
-    }
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIWEBPROGRESSLISTENER
-    NS_DECL_NSIWEBPROGRESSLISTENER2
-
-    EmbedDownload *mDownload;
-};
-
-NS_IMPL_ISUPPORTS2(ProgressListener, nsIWebProgressListener2, nsIWebProgressListener)
-NS_IMPL_ISUPPORTS1(EmbedDownloadMgr, nsIHelperAppLauncherDialog)
-
-EmbedDownloadMgr::EmbedDownloadMgr(void)
-{
-}
-
-EmbedDownloadMgr::~EmbedDownloadMgr(void)
-{
-}
-
-static gchar *
-RemoveSchemeFromFilePath(gchar *path)
-{
-  gchar *new_path = path;
-
-  if (!strncmp(path, "file://", 7)) {
-    /* XXX this should really look for the first non / after file:/ instead of
-     * assuming file://tmp v. file:///tmp
-     */
-    new_path = g_strdup(path+sizeof("file:/"));
-    g_free(path);
-  }
-    
-  return new_path;
-}
-
-NS_IMETHODIMP
-EmbedDownloadMgr::Show(nsIHelperAppLauncher *aLauncher,
-                       nsISupports *aContext,
-                       PRUint32 aForced)
-{
-  nsresult rv;
-
-  /* create a Download object */
-  GtkObject* instance = gtk_moz_embed_download_new();
-  mDownload = (EmbedDownload *) GTK_MOZ_EMBED_DOWNLOAD(instance)->data;
-  mDownload->parent = instance;
-
-  rv = GetDownloadInfo(aLauncher, aContext);
-
-  /* Retrieve GtkMozEmbed object from DOM Window */
-  nsCOMPtr<nsIDOMWindow> parentDOMWindow = do_GetInterface(aContext);
-  mDownload->gtkMozEmbedParentWidget = GetGtkWidgetForDOMWindow(parentDOMWindow);
-
-  gtk_signal_emit(GTK_OBJECT(mDownload->gtkMozEmbedParentWidget),
-                  moz_embed_signals[DOWNLOAD_REQUEST],
-                  mDownload->server,
-                  mDownload->file_name,
-                  mDownload->file_type,
-                  (gulong) mDownload->file_size,
-                   1);
-
-  gtk_signal_emit(GTK_OBJECT(mDownload->parent),
-                  moz_embed_download_signals[DOWNLOAD_STARTED_SIGNAL],
-                  &mDownload->file_name_with_path);
-
-  if (!mDownload->file_name_with_path) {
-    gtk_moz_embed_download_do_command(GTK_MOZ_EMBED_DOWNLOAD(mDownload->parent),
-                                      GTK_MOZ_EMBED_DOWNLOAD_CANCEL);
-    return NS_OK;
-  }
-
-  mDownload->file_name_with_path = RemoveSchemeFromFilePath(mDownload->file_name_with_path);
-
-  return aLauncher->SaveToDisk(nsnull, PR_FALSE);
-}
-
-NS_METHOD
-EmbedDownloadMgr::GetDownloadInfo(nsIHelperAppLauncher *aLauncher,
-                                  nsISupports *aContext)
-{
-  /* File type */
-  nsCOMPtr<nsIMIMEInfo> mimeInfo;
-  nsresult rv = aLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo));
-  if (NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-
-  nsCAutoString mimeType;
-  rv = mimeInfo->GetMIMEType(mimeType);
-  if (NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-
-  /* File name */
-  nsCAutoString tempFileName;
-  nsAutoString suggestedFileName;
-  rv = aLauncher->GetSuggestedFileName(suggestedFileName);
-
-  if (NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-
-  tempFileName = NS_ConvertUTF16toUTF8(suggestedFileName);
-
-  /* Complete source URL */
-  nsCOMPtr<nsIURI> uri;
-  rv = aLauncher->GetSource(getter_AddRefs(uri));
-  if (NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-
-  nsCAutoString spec;
-  rv = uri->Resolve(NS_LITERAL_CSTRING("."), spec);
-  if (NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-
-  /* Sets download object to keep control of each download. */
-  mDownload->launcher = aLauncher;
-  mDownload->downloaded_size = -1;
-  mDownload->file_name = g_strdup((gchar *) tempFileName.get());
-  mDownload->server = g_strconcat(spec.get(), (gchar *) mDownload->file_name, NULL);
-  mDownload->file_type = g_strdup(mimeType.get());
-  mDownload->file_size = UNKNOWN_FILE_SIZE;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP EmbedDownloadMgr::PromptForSaveToFile(nsIHelperAppLauncher *aLauncher,
-                                                    nsISupports *aWindowContext,
-                                                    const PRUnichar *aDefaultFile,
-                                                    const PRUnichar *aSuggestedFileExtension,
-                                                    PRBool aForcePrompt,
-                                                    nsILocalFile **_retval)
-{
-  *_retval = nsnull;
-
-  nsCAutoString filePath;
-  filePath.Assign(mDownload->file_name_with_path);
-
-  nsCOMPtr<nsILocalFile> destFile;
-  NS_NewNativeLocalFile(filePath,
-                        PR_TRUE,
-                        getter_AddRefs(destFile));
-  if (!destFile)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  /* Progress listener to follow the download and connecting it to
-     the launcher which controls the download. */
-  nsCOMPtr<nsIWebProgressListener2> listener = new ProgressListener(mDownload);
-  if (!listener)
-    return NS_ERROR_OUT_OF_MEMORY;
-  
-  nsresult rv = aLauncher->SetWebProgressListener(listener);
-  if (NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-
-  NS_ADDREF(*_retval = destFile);
-  return NS_OK;
-}
-
-/* nsIWebProgressListener Functions
-   all these methods must be here due to nsIWebProgressListener/2 inheritance */
-NS_IMETHODIMP ProgressListener::OnStatusChange(nsIWebProgress *aWebProgress,
-                                               nsIRequest *aRequest,
-                                               nsresult aStatus,
-                                               const PRUnichar *aMessage)
-{
-  if (NS_SUCCEEDED(aStatus))
-    return NS_OK;
-
-  return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP ProgressListener::OnStateChange(nsIWebProgress *aWebProgress,
-                                              nsIRequest *aRequest, PRUint32 aStateFlags,
-                                              nsresult aStatus)
-{
-  if (NS_FAILED(aStatus))
-    return NS_ERROR_FAILURE;
-
-  if (aStateFlags & STATE_STOP)
-    gtk_signal_emit(GTK_OBJECT(mDownload->parent),
-                    moz_embed_download_signals[DOWNLOAD_COMPLETED_SIGNAL]);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP ProgressListener::OnProgressChange(nsIWebProgress *aWebProgress,
-                                                 nsIRequest *aRequest, PRInt32 aCurSelfProgress,
-                                                 PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress,
-                                                 PRInt32 aMaxTotalProgress)
-{
-  return OnProgressChange64(aWebProgress,
-                            aRequest,
-                            aCurSelfProgress,
-                            aMaxSelfProgress,
-                            aCurTotalProgress,
-                            aMaxTotalProgress);
-}
-
-NS_IMETHODIMP ProgressListener::OnLocationChange(nsIWebProgress *aWebProgress,
-                                                 nsIRequest *aRequest, nsIURI *location)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP ProgressListener::OnSecurityChange(nsIWebProgress *aWebProgress,
-                                                 nsIRequest *aRequest, PRUint32 state)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsIWebProgressListener2 method */
-NS_IMETHODIMP ProgressListener::OnProgressChange64(nsIWebProgress *aWebProgress,
-                                                   nsIRequest *aRequest, PRInt64 aCurSelfProgress,
-                                                   PRInt64 aMaxSelfProgress, PRInt64 aCurTotalProgress,
-                                                   PRInt64 aMaxTotalProgress)
-{
-  mDownload->request = aRequest;
-
-  if (aMaxSelfProgress != UNKNOWN_FILE_SIZE) {
-    gtk_signal_emit(GTK_OBJECT(mDownload->parent),
-                    moz_embed_download_signals[DOWNLOAD_PROGRESS_SIGNAL],
-                    (gulong) aCurSelfProgress, (gulong) aMaxSelfProgress, 1);
-  }
-  else {
-    gtk_signal_emit(GTK_OBJECT(mDownload->parent),
-                    moz_embed_download_signals[DOWNLOAD_PROGRESS_SIGNAL],
-                    (gulong) aCurSelfProgress, 0, 1);
-  }
-
-  /* storing current downloaded size. */
-  mDownload->downloaded_size = (gulong) aCurSelfProgress;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP ProgressListener::OnRefreshAttempted(nsIWebProgress *aWebProgress,
-                                                   nsIURI *aUri, PRInt32 aDelay,
-                                                   PRBool aSameUri,
-                                                   PRBool *allowRefresh)
-{
-  *allowRefresh = PR_TRUE;
-  return NS_OK;
-}
deleted file mode 100644
--- a/embedding/browser/gtk/src/EmbedDownloadMgr.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Christopher Blizzard <blizzard@mozilla.org>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-/**
- * Derived from GContentHandler http://landfill.mozilla.org/mxr-test/gnome/source/galeon/mozilla/ContentHandler.h
- */
-#ifndef __EmbedDownloadMgr_h
-#define __EmbedDownloadMgr_h
-
-#include "EmbedPrivate.h"
-#include "nsIHelperAppLauncherDialog.h"
-#include "nsIMIMEInfo.h"
-#include "nsCOMPtr.h"
-#include "nsIExternalHelperAppService.h"
-#include "nsIRequest.h"
-#include "nsILocalFile.h"
-
-#include "nsWeakReference.h"
-#define EMBED_DOWNLOADMGR_DESCRIPTION "MicroB Download Manager"
-#define EMBED_DOWNLOADMGR_CID {0x53df12a2, 0x1f4a, 0x4382, {0x99, 0x4e, 0xed, 0x62, 0xcf, 0x0d, 0x6b, 0x3a}}
-
-class nsIURI;
-class nsIFile;
-class nsIFactory;
-class nsExternalAppHandler;
-
-typedef struct _EmbedDownload EmbedDownload;
-
-struct _EmbedDownload
-{
-  GtkObject*  parent;
-  GtkWidget*  gtkMozEmbedParentWidget;/** Associated gtkmozembed widget */
-
-  char*       file_name;             /** < The file's name */
-  char*       file_name_with_path;   /** < The file's name */
-  const char* server;                /** < The server's name */
-  const char* file_type;             /** < The file's type */
-  const char* handler_app;           /** < The application's name */
-  PRInt64     file_size;             /** < The file's size */
-  PRInt64     downloaded_size;       /** < The download's size */
-  gboolean    is_paused;             /** < If download is paused or not */
-  gboolean    open_with;             /** < If the file can be opened by other application */
-
-  /* Pointer to mozilla interfaces */
-  nsIHelperAppLauncher* launcher;    /** < The mozilla's download dialog */
-  nsIRequest* request;               /** < The download request */
-};
-
-class EmbedDownloadMgr : public nsIHelperAppLauncherDialog
-{
-  public:
-    EmbedDownloadMgr();
-    virtual ~EmbedDownloadMgr();
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIHELPERAPPLAUNCHERDIALOG
-
-  private:
-    /** Gets all informations about a file which is being downloaded.
-    */
-    NS_METHOD GetDownloadInfo(nsIHelperAppLauncher *aLauncher, nsISupports *aContext);
-
-    EmbedDownload *mDownload;
-};
-#endif /* __EmbedDownloadMgr_h */
deleted file mode 100644
--- a/embedding/browser/gtk/src/EmbedFilePicker.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */
-/*
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * timeless <timeless@mozdev.org>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Antonio Gomes <tonikitoo@gmail.com>
- *   Oleg Romashin <romaxa@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "EmbedFilePicker.h"
-#include "EmbedGtkTools.h"
-#include "nsIFileURL.h"
-#include "nsILocalFile.h"
-#include "nsIDOMWindow.h"
-#include "nsStringGlue.h"
-#include "nsNetUtil.h"
-#include "prenv.h"
-
-#ifdef MOZ_LOGGING
-#include <stdlib.h>
-#endif
-
-NS_IMPL_ISUPPORTS1(EmbedFilePicker, nsIFilePicker)
-
-EmbedFilePicker::EmbedFilePicker(): mParent (nsnull),
-                                    mMode(nsIFilePicker::modeOpen)
-{
-}
-
-EmbedFilePicker::~EmbedFilePicker()
-{
-}
-
-/* void init (in nsIDOMWindowInternal parent, in wstring title, in short mode); */
-NS_IMETHODIMP EmbedFilePicker::Init(nsIDOMWindow *parent, const nsAString &title, PRInt16 mode)
-{
-  mParent = parent;
-  mMode = mode;
-  return NS_OK;
-}
-
-/* void appendFilters (in long filterMask); */
-NS_IMETHODIMP EmbedFilePicker::AppendFilters(PRInt32 filterMask)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void appendFilter (in wstring title, in wstring filter); */
-NS_IMETHODIMP EmbedFilePicker::AppendFilter(const nsAString &title, const nsAString &filter)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* attribute wstring defaultString; */
-NS_IMETHODIMP EmbedFilePicker::GetDefaultString(nsAString &aDefaultString)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP EmbedFilePicker::SetDefaultString(const nsAString &aDefaultString)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* attribute wstring defaultExtension; */
-NS_IMETHODIMP EmbedFilePicker::GetDefaultExtension(nsAString &aDefaultExtension)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP EmbedFilePicker::SetDefaultExtension(const nsAString &aDefaultExtension)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* attribute long filterIndex; */
-NS_IMETHODIMP EmbedFilePicker::GetFilterIndex(PRInt32 *aFilterIndex)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP EmbedFilePicker::SetFilterIndex(PRInt32 aFilterIndex)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* attribute nsILocalFile displayDirectory; */
-NS_IMETHODIMP EmbedFilePicker::GetDisplayDirectory(nsILocalFile **aDisplayDirectory)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP EmbedFilePicker::SetDisplayDirectory(nsILocalFile *aDisplayDirectory)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* readonly attribute nsILocalFile file; */
-NS_IMETHODIMP EmbedFilePicker::GetFile(nsILocalFile **aFile)
-{
-
-  NS_ENSURE_ARG_POINTER(aFile);
-  *aFile = nsnull;
-  nsCOMPtr<nsIURI> baseURI;
-  nsresult rv = GetFileURL(getter_AddRefs(baseURI));
-  if (!baseURI)
-    return rv;
-
-  nsCOMPtr<nsIFileURL> fileURL(do_QueryInterface(baseURI, &rv));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIFile> file;
-  rv = fileURL->GetFile(getter_AddRefs(file));
-
-  nsCOMPtr<nsILocalFile> localfile;
-  localfile = do_QueryInterface(file, &rv);
-
-  if (NS_SUCCEEDED(rv)) {
-    NS_ADDREF(*aFile = localfile);
-    return NS_OK;
-  }
-
-  NS_ENSURE_TRUE(mParent, NS_OK);
-  GtkWidget* parentWidget = GetGtkWidgetForDOMWindow(mParent);
-  NS_ENSURE_TRUE(parentWidget, NS_OK);
-  /* XXX this message isn't really sure what it's trying to say */
-  g_signal_emit_by_name(GTK_OBJECT(parentWidget), "alert", "File protocol not supported.", NULL);
-  return NS_OK;
-}
-
-/* readonly attribute nsIFileURL fileURL; */
-NS_IMETHODIMP EmbedFilePicker::GetFileURL(nsIURI **aFileURL)
-{
-  NS_ENSURE_ARG_POINTER(aFileURL);
-  *aFileURL = nsnull;
-  if (mFileURI.IsEmpty())
-  return NS_OK;
-
-  return NS_NewURI(aFileURL, mFileURI);
-}
-
-/* readonly attribute nsISimpleEnumerator files; */
-NS_IMETHODIMP EmbedFilePicker::GetFiles(nsISimpleEnumerator * *aFiles)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* short show (); */
-NS_IMETHODIMP EmbedFilePicker::Show(PRInt16 *_retval)
-{
-  NS_ENSURE_ARG_POINTER(_retval);
-  NS_ENSURE_TRUE(mParent, NS_OK);
-
-  GtkWidget *parentWidget = GetGtkWidgetForDOMWindow(mParent);
-  NS_ENSURE_TRUE(parentWidget, NS_OK);
-
-  gboolean response = 0;
-  char *retname = nsnull;
-  g_signal_emit_by_name(GTK_OBJECT(parentWidget),
-                        "upload_dialog",
-                        PR_GetEnv("HOME"),
-                        "",
-                        &retname,
-                        &response,
-                        NULL);
-
-  *_retval = response ? nsIFilePicker::returnOK : nsIFilePicker::returnCancel;
-
-  mFileURI = retname;
-  if (retname)
-    NS_Free(retname);
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/embedding/browser/gtk/src/EmbedFilePicker.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */
-/*
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * timeless <timeless@mozdev.org>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef __EmbedFilePicker_h
-#define __EmbedFilePicker_h
-
-#include "nsIFilePicker.h"
-#include "nsISupports.h"
-#include "nsNetCID.h"
-
-#include "gtkmozembed.h"
-#include "gtkmozembed_common.h"
-#include "EmbedPrivate.h"
-
-#define EMBED_FILEPICKER_CID           \
-{ /* f097d33b-1c97-48a6-af4c-07022857eb7c */         \
-    0xf097d33b,                                      \
-    0x1c97,                                          \
-    0x48a6,                                          \
-    {0xaf, 0x4c, 0x07, 0x02, 0x28, 0x57, 0xeb, 0x7c} \
-}
-
-#define EMBED_FILEPICKER_CONTRACTID  "@mozilla.org/filepicker;1"
-#define EMBED_FILEPICKER_CLASSNAME  "File Picker Implementation"
-
-class EmbedFilePicker : public nsIFilePicker
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIFILEPICKER
-  EmbedFilePicker();
-
-protected:
-  nsIDOMWindow *mParent;
-  PRInt16 mMode;
-  nsCString mFileURI;
-
-private:
-  ~EmbedFilePicker();
-};
-#endif
deleted file mode 100644
--- a/embedding/browser/gtk/src/EmbedGlobalHistory.cpp
+++ /dev/null
@@ -1,920 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Conrad Carlen <ccarlen@netscape.com>
- *   Oleg Romashin <romaxa@gmail.com>
- *   (from original mozilla/embedding/lite/nsEmbedGlobalHistory.cpp)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-/* XXX This file is probably out of sync with its original.
- *     This is a bad thing
- */
-#include "EmbedGlobalHistory.h"
-#include "nsIObserverService.h"
-#include "nsAutoPtr.h"
-#include "nsIURI.h"
-#include "nsInt64.h"
-#include "nsIIOService.h"
-#include "nsNetUtil.h"
-#include "gtkmozembed_common.h"
-#include "nsISeekableStream.h"
-#ifndef MOZILLA_INTERNAL_API
-#include "nsCRT.h"
-#endif
-#include "nsILineInputStream.h"
-
-// Constants
-#define defaultSeparator 1
-// Number of changes in history before automatic flush
-static const PRInt32 kNewEntriesBetweenFlush = 10;
-static const PRInt32 kMaxSafeReadEntriesCount = 2000;
-// Default expiration interval: used if can't get preference service value
-static const PRUint32 kDefaultExpirationIntervalDays = 7;
-// Mozilla and EAL standard are different each other
-static const PRInt64 kMSecsPerDay = LL_INIT(0, 60 * 60 * 24 * 1000);
-static const PRInt64 kOneThousand = LL_INIT(0, 1000);
-// The history list and the entries counter
-static GList *mURLList;                 /** < The history list */
-static PRInt64 mExpirationInterval;     /** < Expiration interval time */
-static EmbedGlobalHistory *sEmbedGlobalHistory = nsnull;
-
-//*****************************************************************************
-// HistoryEntryOld: an entry object and its methods
-//*****************************************************************************
-class HistoryEntry
-{
-public:
-  PRInt64         mLastVisitTime;     // Millisecs
-  PRPackedBool    mWritten;           // TRUE if ever persisted
-  nsCString       mTitle;             // The entry title
-  nsCString       mUrl;               // The url itself
-};
-
-#define CLOSE_FILE_HANDLE(file_handle) \
-  PR_BEGIN_MACRO \
-    if (file_handle) { \
-      close_output_stream(file_handle); \
-      NS_RELEASE(file_handle); \
-    } \
-  PR_END_MACRO
-
-static void close_output_stream(OUTPUT_STREAM *file_handle)
-{
-  file_handle->Close();
-  return;
-}
-
-static bool file_handle_uri_exists(LOCAL_FILE *uri)
-{
-  g_return_val_if_fail(uri, false);
-  PRBool exists = PR_FALSE;
-  uri->Exists(&exists);
-  return exists;
-}
-
-static LOCAL_FILE* file_handle_uri_new(const char *uri)
-{
-  g_return_val_if_fail(uri, nsnull);
-  nsresult rv;
-  LOCAL_FILE *historyFile = nsnull;
-  rv = NS_NewNativeLocalFile(nsDependentCString(uri), 1, &historyFile);
-  return historyFile;
-}
-
-static void file_handle_uri_release(LOCAL_FILE *uri)
-{
-  g_return_if_fail(uri);
-  NS_RELEASE(uri);
-}
-
-
-static bool file_handle_create_uri(OUTPUT_STREAM **file_handle, LOCAL_FILE *uri)
-{
-  g_return_val_if_fail(file_handle, false);
-  nsresult rv;
-  rv = NS_NewLocalFileOutputStream(file_handle, uri, PR_RDWR | PR_APPEND | PR_CREATE_FILE, 0660);
-
-  return NS_SUCCEEDED(rv);
-}
-
-static bool file_handle_open_uri(OUTPUT_STREAM **file_handle, LOCAL_FILE *uri)
-{
-  g_return_val_if_fail(file_handle, false);
-  nsresult rv;
-  rv = NS_NewLocalFileOutputStream(file_handle, uri, PR_RDWR, 0660);
-
-  return NS_SUCCEEDED(rv);
-}
-
-static bool file_handle_seek(OUTPUT_STREAM *file_handle, gboolean end)
-{
-  g_return_val_if_fail(file_handle, false);
-  nsresult rv;
-  nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(file_handle, &rv);
-  rv = seekable->Seek(nsISeekableStream::NS_SEEK_SET, end ? -1 : 0);
-  return NS_SUCCEEDED(rv);
-}
-
-static bool file_handle_truncate(OUTPUT_STREAM *file_handle)
-{
-  g_return_val_if_fail(file_handle, false);
-  nsresult rv;
-  nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(file_handle, &rv);
-  rv = seekable->SetEOF();
-  return NS_SUCCEEDED(rv);
-}
-
-static guint64 file_handle_write(OUTPUT_STREAM *file_handle, gpointer line)
-{
-  g_return_val_if_fail(file_handle, 0);
-  PRUint32 amt = 0;
-  nsresult rv;
-  rv = file_handle->Write((char*)line, strlen((char*)line), &amt);
-  /* XXX booleans are not equivalent to guint64 */
-  return NS_SUCCEEDED(rv);
-}
-
-// Static Routine Prototypes
-//GnomeVFSHandle
-static nsresult writeEntry(OUTPUT_STREAM *file_handle, HistoryEntry *entry);
-// when an entry is visited
-nsresult OnVisited(HistoryEntry *entry)
-{
-  NS_ENSURE_ARG(entry);
-  entry->mLastVisitTime = PR_Now();
-  LL_DIV(entry->mLastVisitTime, entry->mLastVisitTime, kOneThousand);
-  return NS_OK;
-}
-
-// Return the last time an entry was visited
-PRInt64 GetLastVisitTime(HistoryEntry *entry)
-{
-  NS_ENSURE_ARG(entry);
-  return entry->mLastVisitTime;
-}
-
-// Change the last time an entry was visited
-nsresult SetLastVisitTime(HistoryEntry *entry, const PRInt64& aTime)
-{
-  NS_ENSURE_ARG(entry);
-  NS_ENSURE_ARG_POINTER(aTime);
-  entry->mLastVisitTime = aTime;
-  return NS_OK;
-}
-
-// Return TRUE if an entry has been written
-PRBool GetIsWritten(HistoryEntry *entry)
-{
-  NS_ENSURE_TRUE(entry, PR_FALSE);
-  return entry->mWritten;
-}
-
-// Set TRUE when an entry is visited
-nsresult SetIsWritten(HistoryEntry *entry)
-{
-  NS_ENSURE_ARG(entry);
-  entry->mWritten = PR_TRUE;
-  return NS_OK;
-}
-
-// Change the entry title
-#define SET_TITLE(entry, aTitle) (entry->mTitle.Assign(aTitle))
-
-// Return the entry title
-#define GET_TITLE(entry) (entry && !entry->mTitle.IsEmpty() ? entry->mTitle.get() : "")
-
-// Change the entry title
-nsresult SET_URL(HistoryEntry *aEntry, const char *aUrl)
-{
-  NS_ENSURE_ARG(aEntry);
-  NS_ENSURE_ARG(aUrl);
-  aEntry->mUrl.Assign(aUrl);
-  return NS_OK;
-}
-
-// Return the entry url
-const char* GET_URL(HistoryEntry *aEntry)
-{
-  return (aEntry && !aEntry->mUrl.IsEmpty()) ? aEntry->mUrl.get() : "";
-}
-
-// Traverse the history list trying to find a frame
-int history_entry_find_exist(gconstpointer a, gconstpointer b)
-{
-  return g_ascii_strcasecmp((char*)GET_URL((HistoryEntry *)a), (char *) b);
-}
-
-// Traverse the history list looking for the correct place to add a new item
-int find_insertion_place(gconstpointer a, gconstpointer b)
-{
-  PRInt64 lastVisitTime = GetLastVisitTime((HistoryEntry *) a);
-  PRInt64 tempTime = GetLastVisitTime((HistoryEntry *) b);
-  return LL_CMP(lastVisitTime, <, tempTime);
-}
-
-// Check whether an entry has expired
-PRBool entryHasExpired(HistoryEntry *entry)
-{
-  // convert "now" from microsecs to millisecs
-  PRInt64 nowInMilliSecs = PR_Now();
-  LL_DIV(nowInMilliSecs, nowInMilliSecs, kOneThousand);
-  // determine when the entry would have expired
-  PRInt64 expirationIntervalAgo;
-  LL_SUB(expirationIntervalAgo, nowInMilliSecs, mExpirationInterval);
-  PRInt64 lastVisitTime = GetLastVisitTime(entry);
-  return LL_CMP(lastVisitTime, <, expirationIntervalAgo);
-}
-
-// Traverse the history list to get all the entry data
-void history_entry_foreach_to_remove(gpointer data, gpointer user_data)
-{
-  HistoryEntry *entry = (HistoryEntry *) data;
-  if (entry) {
-    entry->mLastVisitTime = 0;
-    delete entry;
-  }
-}
-
-//*****************************************************************************
-// EmbedGlobalHistory - Creation/Destruction
-//*****************************************************************************
-NS_IMPL_ISUPPORTS2(EmbedGlobalHistory, nsIGlobalHistory2, nsIObserver)
-/* static */
-EmbedGlobalHistory*
-EmbedGlobalHistory::GetInstance()
-{
-  if (!sEmbedGlobalHistory)
-  {
-    sEmbedGlobalHistory = new EmbedGlobalHistory();
-    if (!sEmbedGlobalHistory)
-      return nsnull;
-    NS_ADDREF(sEmbedGlobalHistory);   // addref the global
-    if (NS_FAILED(sEmbedGlobalHistory->Init()))
-    {
-      NS_RELEASE(sEmbedGlobalHistory);
-      return nsnull;
-    }
-  }
-  else
-    NS_ADDREF(sEmbedGlobalHistory);   // addref the return result
-  return sEmbedGlobalHistory;
-}
-
-/* static */
-void
-EmbedGlobalHistory::DeleteInstance()
-{
-  if (sEmbedGlobalHistory)
-  {
-    delete sEmbedGlobalHistory;
-  }
-}
-
-// The global history component constructor
-EmbedGlobalHistory::EmbedGlobalHistory()
-: mFileHandle(nsnull)
-{
-  if (!mURLList) {
-    mDataIsLoaded = PR_FALSE;
-    mFlushModeFullWriteNeeded = PR_FALSE;
-    mEntriesAddedSinceFlush = 0;
-    mHistoryFile = nsnull;
-    LL_I2L(mExpirationInterval, kDefaultExpirationIntervalDays);
-    LL_MUL(mExpirationInterval, mExpirationInterval, kMSecsPerDay);
-  }
-}
-
-// The global history component destructor
-EmbedGlobalHistory::~EmbedGlobalHistory()
-{
-  LoadData();
-  FlushData(kFlushModeFullWrite);
-  if (mURLList) {
-    g_list_foreach(mURLList, (GFunc) history_entry_foreach_to_remove, NULL);
-    g_list_free(mURLList);
-    mURLList = NULL;
-  }
-  if (mFileHandle) {
-    CLOSE_FILE_HANDLE(mFileHandle);
-  }
-  if (mHistoryFile) {
-    g_free(mHistoryFile);
-    mHistoryFile = nsnull;
-  }
-  if (sEmbedGlobalHistory)
-    sEmbedGlobalHistory = nsnull;
-}
-
-// Initialize the global history component
-NS_IMETHODIMP EmbedGlobalHistory::Init()
-{
-  if (mURLList) return NS_OK;
-  // Get Pref and convert to millisecs
-
-  PRInt32 expireDays;
-  int success = gtk_moz_embed_common_get_pref(G_TYPE_INT, EMBED_HISTORY_PREF_EXPIRE_DAYS, &expireDays);
-  if (success) {
-    LL_I2L(mExpirationInterval, expireDays);
-    LL_MUL(mExpirationInterval, mExpirationInterval, kMSecsPerDay);
-  }
-  // register to observe profile changes
-  nsCOMPtr<nsIObserverService> observerService =
-    do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
-  NS_ASSERTION(observerService, "failed to get observer service");
-  if (observerService) {
-    observerService->AddObserver(this, "quit-application", PR_FALSE);
-    observerService->AddObserver(this, "RemoveEntries", PR_FALSE);
-  }
-  nsresult rv = InitFile();
-  if (NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-  rv = LoadData();
-  NS_ENSURE_SUCCESS(rv, rv);
-  return rv;
-}
-
-#define BROKEN_RV_HANDLING_CODE(rv) PR_BEGIN_MACRO                        \
-  if (NS_FAILED(rv)) {                                                    \
-    /* OOPS the coder (not timeless) didn't handle this case well at all. \
-     * unfortunately the coder will remain anonymous.                     \
-     * XXX please fix me.                                                 \
-     */                                                                   \
-  }                                                                       \
-  PR_END_MACRO
-
-#define BROKEN_STRING_GETTER(out) PR_BEGIN_MACRO                      \
-  /* OOPS the coder (not timeless) decided not to do anything in this \
-   * method, but to return NS_OK anyway. That's not very polite.      \
-   */                                                                 \
-  out.Truncate();                                                     \
-  PR_END_MACRO
-
-#define BROKEN_STRING_BUILDER(var) PR_BEGIN_MACRO \
-  /* This is just wrong */                        \
-  PR_END_MACRO
-
-#define UNACCEPTABLE_CRASHY_GLIB_ALLOCATION(newed) PR_BEGIN_MACRO \
-  /* OOPS this code is using a glib allocation function which     \
-   * will cause the application to crash when it runs out of      \
-   * memory. This is not cool. either g_try methods should be     \
-   * used or malloc, or new (note that gecko /will/ be replacing  \
-   * its operator new such that new will not throw exceptions).   \
-   * XXX please fix me.                                           \
-   */                                                             \
-  if (!newed) {                                                   \
-  }                                                               \
-  PR_END_MACRO
-
-#define ALLOC_NOT_CHECKED(newed) PR_BEGIN_MACRO               \
-  /* This might not crash, but the code probably isn't really \
-   * designed to handle it, perhaps the code should be fixed? \
-   */                                                         \
-  if (!newed) {                                               \
-  }                                                           \
-  PR_END_MACRO
-
-//*****************************************************************************
-// EmbedGlobalHistory::nsIGlobalHistory
-//*****************************************************************************
-// Add a new URI to the history
-NS_IMETHODIMP EmbedGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aToplevel, nsIURI *aReferrer)
-{
-  NS_ENSURE_ARG(aURI);
-  nsCAutoString URISpec;
-  aURI->GetSpec(URISpec);
-  const char *aURL = URISpec.get();
-  if (!aToplevel)
-    return NS_OK;
-  PRBool isHTTP, isHTTPS;
-  nsresult rv = NS_OK;
-  rv |= aURI->SchemeIs("http", &isHTTP);
-  rv |= aURI->SchemeIs("https", &isHTTPS);
-  NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
-  // Only get valid uri schemes
-  if (!isHTTP && !isHTTPS)
-  {
-    /* the following blacklist is silly.
-     * if there's some need to whitelist http(s) + ftp,
-     * that's what we should do.
-     */
-    PRBool isAbout, isImap, isNews, isMailbox, isViewSource, isChrome, isData, isJavascript;
-    rv  = aURI->SchemeIs("about", &isAbout);
-    rv |= aURI->SchemeIs("imap", &isImap);
-    rv |= aURI->SchemeIs("news", &isNews);
-    rv |= aURI->SchemeIs("mailbox", &isMailbox);
-    rv |= aURI->SchemeIs("view-source", &isViewSource);
-    rv |= aURI->SchemeIs("chrome", &isChrome);
-    rv |= aURI->SchemeIs("data", &isData);
-    rv |= aURI->SchemeIs("javascript", &isJavascript);
-    NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
-    if (isAbout ||
-        isImap ||
-        isNews ||
-        isMailbox ||
-        isViewSource ||
-        isChrome ||
-        isData ||
-        isJavascript) {
-      return NS_OK;
-    }
-  }
-#ifdef DEBUG
-  //  NS_WARNING("[HISTORY] Visited URL: %s\n", aURL);
-#endif
-  rv = LoadData();
-  NS_ENSURE_SUCCESS(rv, rv);
-  GList *node = g_list_find_custom(mURLList, aURL, (GCompareFunc) history_entry_find_exist);
-  HistoryEntry *entry = NULL;
-  if (node && node->data)
-    entry = (HistoryEntry *)(node->data);
-  nsCAutoString hostname;
-  aURI->GetHost(hostname);
-
-  // It is not in the history
-  if (!entry) {
-    entry = new HistoryEntry;
-    ALLOC_NOT_CHECKED(entry);
-    rv |= OnVisited(entry);
-    SET_TITLE(entry, hostname);
-    rv |= SET_URL(entry, aURL);
-    BROKEN_RV_HANDLING_CODE(rv);
-    unsigned int listSize = g_list_length(mURLList);
-    if (listSize+1 > kDefaultMaxSize) {
-      GList *last = g_list_last(mURLList);
-      mURLList = g_list_remove(mURLList, last->data);
-    }
-    mURLList = g_list_insert_sorted(mURLList, entry,
-                                    (GCompareFunc) find_insertion_place);
-    // Flush after kNewEntriesBetweenFlush changes
-    BROKEN_RV_HANDLING_CODE(rv);
-    if (++mEntriesAddedSinceFlush >= kNewEntriesBetweenFlush)
-      rv |= FlushData(kFlushModeAppend);
-    // At this point, something understands there's a new global history item
-  } else {
-    // update the last visited time
-    rv |= OnVisited(entry);
-    SET_TITLE(entry, hostname);
-    // Move the element to the start of the list
-    BROKEN_RV_HANDLING_CODE(rv);
-    mURLList = g_list_remove(mURLList, entry);
-    mURLList = g_list_insert_sorted(mURLList, entry, (GCompareFunc) find_insertion_place);
-    // Flush after kNewEntriesBetweenFlush changes
-    BROKEN_RV_HANDLING_CODE(rv);
-    
-    mFlushModeFullWriteNeeded = PR_TRUE;
-    if (++mEntriesAddedSinceFlush >= kNewEntriesBetweenFlush)
-      rv |= FlushData(kFlushModeFullWrite);
-  }
-  return rv;
-}
-
-// Return TRUE if the url is already in history
-NS_IMETHODIMP EmbedGlobalHistory::IsVisited(nsIURI *aURI, PRBool *_retval)
-{
-  NS_ENSURE_ARG(aURI);
-  NS_ENSURE_ARG_POINTER(_retval);
-  nsCAutoString URISpec;
-  aURI->GetSpec(URISpec);
-  const char *aURL = URISpec.get();
-  nsresult rv = LoadData();
-  NS_ENSURE_SUCCESS(rv, rv);
-  GList *node = g_list_find_custom(mURLList, aURL,
-                                   (GCompareFunc) history_entry_find_exist);
-  *_retval = (node && node->data);
-  return rv;
-}
-
-// It is called when Mozilla get real name of a URL
-NS_IMETHODIMP EmbedGlobalHistory::SetPageTitle(nsIURI *aURI,
-                                               const nsAString & aTitle)
-{
-  NS_ENSURE_ARG(aURI);
-  nsresult rv;
-  // skip about: URIs to avoid reading in the db (about:blank, especially)
-  PRBool isAbout;
-  rv = aURI->SchemeIs("about", &isAbout);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (isAbout)
-    return NS_OK;
-  nsCAutoString URISpec;
-  aURI->GetSpec(URISpec);
-  const char *aURL = URISpec.get();
-  rv |= LoadData();
-  BROKEN_RV_HANDLING_CODE(rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  GList *node = g_list_find_custom(mURLList, aURL,
-                                   (GCompareFunc) history_entry_find_exist);
-  HistoryEntry *entry = NULL;
-  if (node)
-    entry = (HistoryEntry *)(node->data);
-  if (entry) {
-    SET_TITLE(entry, NS_ConvertUTF16toUTF8(aTitle).get());
-    BROKEN_RV_HANDLING_CODE(rv);
-    
-    mFlushModeFullWriteNeeded = PR_TRUE;
-    if (++mEntriesAddedSinceFlush >= kNewEntriesBetweenFlush)
-      rv |= FlushData(kFlushModeFullWrite);
-    BROKEN_RV_HANDLING_CODE(rv);
-  }
-  return rv;
-}
-
-nsresult EmbedGlobalHistory::RemoveEntries(const PRUnichar *url, int time)
-{
-  nsresult rv = NS_ERROR_FAILURE;
-  if (!mURLList)
-    return rv;
-
-  if (url) {
-    GList *node = g_list_find_custom(mURLList, NS_ConvertUTF16toUTF8(url).get(), (GCompareFunc) history_entry_find_exist);
-    if (!node) return rv;
-    if (node->data) {
-      HistoryEntry *entry = static_cast<HistoryEntry *>
-                                       (node->data);
-
-      entry->mLastVisitTime = 0;
-      delete entry;
-      mURLList = g_list_remove(mURLList, entry);
-    }
-  } else {
-    g_list_foreach (mURLList, (GFunc) history_entry_foreach_to_remove, NULL);
-    g_list_free(mURLList);
-    mURLList = NULL;
-  }
-
-  mFlushModeFullWriteNeeded = PR_TRUE;
-  mEntriesAddedSinceFlush++;
-  rv = FlushData(kFlushModeFullWrite);
-
-  return rv;
-}
-
-//*****************************************************************************
-// EmbedGlobalHistory::nsIObserver
-//*****************************************************************************
-NS_IMETHODIMP EmbedGlobalHistory::Observe(nsISupports *aSubject,
-                                          const char *aTopic,
-                                          const PRUnichar *aData)
-{
-  nsresult rv = NS_OK;
-  // used when the browser is closed and the EmbedGlobalHistory destructor is not called
-  if (strcmp(aTopic, "quit-application") == 0) {
-    rv = LoadData();
-    // we have to sort the list before flush it
-    rv |= FlushData(kFlushModeFullWrite);
-    if (mURLList) {
-      g_list_foreach(mURLList, (GFunc) history_entry_foreach_to_remove, NULL);
-      g_list_free(mURLList);
-      mURLList = NULL;
-    }
-    if (mFileHandle) {
-      CLOSE_FILE_HANDLE(mFileHandle);
-    }
-  } else if (strcmp(aTopic, "RemoveEntries") == 0) {
-    rv |= RemoveEntries(aData, 0);
-  }
-  return rv;
-}
-
-static nsresult
-GetHistoryFileName(char **aHistoryFile)
-{
-  NS_ENSURE_ARG_POINTER(aHistoryFile);
-  // Get the history file in our profile dir.
-  // Notice we are not just getting NS_APP_HISTORY_50_FILE
-  // because it is used by the "real" global history component.
-  if (EmbedPrivate::sProfileDir) {
-    nsCString path;
-    EmbedPrivate::sProfileDir->GetNativePath(path);
-    *aHistoryFile = g_strdup_printf("%s/history.dat", path.get());
-    BROKEN_STRING_BUILDER(aHistoryFile);
-  } else {
-    *aHistoryFile = g_strdup_printf("%s/history.dat", g_get_tmp_dir());
-    BROKEN_STRING_BUILDER(aHistoryFile);
-  }
-  return NS_OK;
-}
-//*****************************************************************************
-// EmbedGlobalHistory
-//*****************************************************************************
-// Open/Create the history.dat file if it does not exist
-nsresult EmbedGlobalHistory::InitFile()
-{
-  if (!mHistoryFile) {
-    if (NS_FAILED(GetHistoryFileName(&mHistoryFile)))
-      return NS_ERROR_FAILURE;
-  }
-
-  LOCAL_FILE *uri = file_handle_uri_new(mHistoryFile);
-  if (!uri)
-    return NS_ERROR_FAILURE;
-
-  gboolean rs = FALSE;
-  if (!file_handle_uri_exists(uri)) {
-    if (!file_handle_create_uri(&mFileHandle, uri)) {
-      NS_WARNING("Could not create a history file\n");
-      file_handle_uri_release(uri);
-      return NS_ERROR_FAILURE;
-    }
-    CLOSE_FILE_HANDLE(mFileHandle);
-  }
-  rs = file_handle_open_uri(&mFileHandle, uri);
-
-  file_handle_uri_release(uri);
-
-  if (!rs) {
-    NS_WARNING("Could not open a history file\n");
-    return NS_ERROR_FAILURE;
-  }
-  return NS_OK;
-}
-
-// Get the data from history.dat file
-nsresult EmbedGlobalHistory::LoadData()
-{
-  nsresult rv = NS_OK;
-  if (!mDataIsLoaded) {
-    mDataIsLoaded = PR_TRUE;
-    LOCAL_FILE *uri = file_handle_uri_new(mHistoryFile);
-    if (uri) {
-      rv |= ReadEntries(uri);
-      file_handle_uri_release(uri);
-    }
-  }
-  return rv;
-}
-
-// Call a function to write each entry in the history hash table
-nsresult EmbedGlobalHistory::WriteEntryIfWritten(GList *list, OUTPUT_STREAM *file_handle)
-{
-  if (!file_handle)
-    return NS_ERROR_FAILURE;
-
-  unsigned int counter = g_list_length(list);
-  while (counter > 0) {
-    HistoryEntry *entry = static_cast<HistoryEntry*>(g_list_nth_data(list, counter-1));
-    counter--;
-    if (!entry || entryHasExpired(entry)) {
-      continue;
-    }
-    writeEntry(file_handle, entry);
-  }
-  return NS_OK;
-}
-
-// Call a function to write each unwritten entry in the history hash table
-nsresult EmbedGlobalHistory::WriteEntryIfUnwritten(GList *list, OUTPUT_STREAM *file_handle)
-{
-  if (!file_handle)
-    return NS_ERROR_FAILURE;
-  unsigned int counter = g_list_length(list);
-  while (counter > 0) {
-    HistoryEntry *entry = static_cast<HistoryEntry*>(g_list_nth_data(list, counter-1));
-    if (!entry || entryHasExpired(entry)) {
-      counter--;
-      continue;
-    }
-    if (!GetIsWritten(entry))
-      writeEntry(file_handle, entry);
-    counter--;
-  }
-  return NS_OK;
-}
-
-// Write the history in history.dat file
-nsresult EmbedGlobalHistory::FlushData(PRIntn mode)
-{
-  nsresult rv = NS_OK;
-  if (mEntriesAddedSinceFlush == 0)
-    return NS_OK;
-  if (!mHistoryFile)
-  {
-    rv = InitFile();
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = FlushData(kFlushModeFullWrite);
-    return rv;
-  }
-  LOCAL_FILE *uri = file_handle_uri_new(mHistoryFile);
-  if (!uri) return NS_ERROR_FAILURE;
-
-  gboolean rs = file_handle_uri_exists(uri);
-  file_handle_uri_release(uri);
-
-  if (!rs && NS_FAILED(rv))
-    return NS_ERROR_FAILURE;
-
-  if (mode == kFlushModeFullWrite || mFlushModeFullWriteNeeded == PR_TRUE)
-  {
-    if (!file_handle_seek(mFileHandle, FALSE))
-      return NS_ERROR_FAILURE;
-    if (!file_handle_truncate(mFileHandle))
-      return NS_ERROR_FAILURE;
-    WriteEntryIfWritten(mURLList, mFileHandle);
-    mFlushModeFullWriteNeeded = PR_FALSE;
-  }
-  else
-  {
-    if (!file_handle_seek(mFileHandle, TRUE))
-      return NS_ERROR_FAILURE;
-    WriteEntryIfUnwritten(mURLList, mFileHandle);
-  }
-
-  mEntriesAddedSinceFlush = 0;
-  return NS_OK;
-}
-
-// Split an entry in last visit time, title and url.
-// Add a stored entry in the history.dat file in the history hash table
-nsresult EmbedGlobalHistory::GetEntry(const char *entry)
-{
-  char separator = (char) defaultSeparator;
-  int pos = 0;
-  PRInt64 outValue = 0;
-  while (PR_TRUE) {
-    PRInt32 digit;
-    if (entry[pos] == separator) {
-      pos++;
-      break;
-    }
-    if (entry[pos] == '\0' || !isdigit(entry[pos]))
-      return NS_ERROR_FAILURE;
-    digit = entry[pos] - '0';
-    outValue *= 10;
-    outValue += digit;
-    pos++;
-  }
-  char url[1024], title[1024];
-  int urlLength= 0, titleLength= 0, numStrings=1;
-  // get the url and title
-  // FIXME
-  while(PR_TRUE) {
-    if (entry[pos] == separator) {
-      numStrings++;
-      pos++;
-      continue;
-    }
-    if (numStrings > 2)
-      break;
-    if (numStrings==1) {
-      url[urlLength++] = entry[pos];
-    } else {
-      title[titleLength++] = entry[pos];
-  }
-  pos++;
-  }
-  url[urlLength]='\0';
-  title[titleLength]='\0';
-  HistoryEntry *newEntry = new HistoryEntry;
-  if (!newEntry)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  nsresult rv = NS_OK;
-  SET_TITLE(newEntry, title);
-  rv |= SetLastVisitTime(newEntry, outValue);
-  rv |= SetIsWritten(newEntry);
-  rv |= SET_URL(newEntry, url);
-  BROKEN_RV_HANDLING_CODE(rv);
-  // Check wheter the entry has expired
-  if (!entryHasExpired(newEntry)) {
-    mURLList = g_list_prepend(mURLList, newEntry);
-  }
-  return rv;
-}
-
-
-// Get the history entries from history.dat file
-nsresult EmbedGlobalHistory::ReadEntries(LOCAL_FILE *file_uri)
-{
-  if (!file_uri)
-    return NS_ERROR_FAILURE;
-
-  nsresult rv = NS_OK;
-
-  nsCOMPtr<nsIInputStream> fileStream;
-  NS_NewLocalFileInputStream(getter_AddRefs(fileStream), file_uri);
-  if (!fileStream)
-    return NS_ERROR_OUT_OF_MEMORY;
-  nsCOMPtr<nsILineInputStream> lineStream = do_QueryInterface(fileStream, &rv);
-  NS_ASSERTION(lineStream, "File stream is not an nsILineInputStream");
-  // Read the header
-  nsCString utf8Buffer;
-  PRBool moreData = PR_FALSE;
-
-  PRInt32 safe_limit = 0;
-  do {
-    rv = lineStream->ReadLine(utf8Buffer, &moreData);
-    safe_limit++;
-    if (NS_FAILED(rv))
-      return NS_OK;
-
-    if (utf8Buffer.IsEmpty())
-      continue;
-    rv = GetEntry(utf8Buffer.get());
-  } while (moreData && safe_limit < kMaxSafeReadEntriesCount);
-  fileStream->Close();
-
-  return rv;
-}
-
-//*****************************************************************************
-// Static Functions
-//*****************************************************************************
-// Get last visit time from a string
-static nsresult writePRInt64(char time[14], const PRInt64& inValue)
-{
-  nsInt64 value(inValue);
-  if (value == nsInt64(0)) {
-    strcpy(time, "0");
-    return NS_OK;
-  }
-  nsCAutoString tempString;
-  while (value != nsInt64(0)) {
-    PRInt32 ones = PRInt32(value % nsInt64(10));
-    value /= nsInt64(10);
-    tempString.Insert(char('0' + ones), 0);
-  }
-  strcpy(time,(char *) tempString.get());
-  return NS_OK;
-}
-
-// Write an entry in the history.dat file
-nsresult writeEntry(OUTPUT_STREAM *file_handle, HistoryEntry *entry)
-{
-  nsresult rv = NS_OK;
-  char sep = (char) defaultSeparator;
-  char time[14];
-  writePRInt64(time, GetLastVisitTime(entry));
-  char *line = g_strdup_printf("%s%c%s%c%s%c\n", time, sep, GET_URL(entry), sep, GET_TITLE(entry), sep);
-  BROKEN_STRING_BUILDER(line);
-  guint64 size = file_handle_write(file_handle, (gpointer)line);
-  if (size != strlen(line))
-    rv = NS_ERROR_FAILURE;
-  rv |= SetIsWritten(entry);
-  g_free(line);
-  return rv;
-}
-
-nsresult EmbedGlobalHistory::GetContentList(GtkMozHistoryItem **GtkHI, int *count)
-{
-  if (!mURLList) return NS_ERROR_FAILURE;
-
-  unsigned int num_items = 0;
-  *GtkHI = g_new0(GtkMozHistoryItem, g_list_length(mURLList));
-  UNACCEPTABLE_CRASHY_GLIB_ALLOCATION(*GtkHI);
-  GtkMozHistoryItem * item = (GtkMozHistoryItem *)*GtkHI;
-  while (num_items < g_list_length(mURLList)) {
-    HistoryEntry *entry = static_cast<HistoryEntry*>
-                                     (g_list_nth_data(mURLList, num_items));
-    // verify if the entry has expired and discard it
-    if (entryHasExpired(entry)) {
-      break;
-    }
-    glong accessed;
-    PRInt64 temp, outValue;
-    LL_MUL(outValue, GetLastVisitTime(entry), kOneThousand);
-    LL_DIV(temp, outValue, PR_USEC_PER_SEC);
-    LL_L2I(accessed, temp);
-    // Set the External history list
-    item[num_items].title = GET_TITLE(entry);
-    BROKEN_STRING_BUILDER(item[num_items].title);
-    item[num_items].url = GET_URL(entry);
-    item[num_items].accessed = accessed;
-    num_items++;
-  }
-  *count = num_items;
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/embedding/browser/gtk/src/EmbedGlobalHistory.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Conrad Carlen <ccarlen@netscape.com>
- *   Changes: andre.pedralho@indt.org.br (from original:  mozilla/embedding/lite/nsEmbedGlobalHistory.h)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#ifndef __EMBEDGLOBALHISTORY_h
-#define __EMBEDGLOBALHISTORY_h
-#include "nsIGlobalHistory2.h"
-#include "nsIObserver.h"
-#include "EmbedPrivate.h"
-#include <prenv.h>
-#include <gtk/gtk.h>
-#include "nsDocShellCID.h"
-
-#define OUTPUT_STREAM nsIOutputStream
-#define LOCAL_FILE nsILocalFile
-
-//#include "gtkmozembed_common.h"
-/* {2f977d51-5485-11d4-87e2-0010a4e75ef2} */
-#define NS_EMBEDGLOBALHISTORY_CID \
-  { 0x2f977d51, 0x5485, 0x11d4, \
-  { 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 } }
-#define EMBED_HISTORY_PREF_EXPIRE_DAYS      "browser.history_expire_days"
-/** The Mozilla History Class
-  * This class is responsible for handling the history stuff.
-  */
-class EmbedGlobalHistory: public nsIGlobalHistory2,
-                          public nsIObserver
-{
-    public:
-    EmbedGlobalHistory();
-    virtual ~EmbedGlobalHistory();
-    static EmbedGlobalHistory* GetInstance();
-    static void DeleteInstance();
-    NS_IMETHOD        Init();
-    nsresult GetContentList(GtkMozHistoryItem**, int *count);
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIGLOBALHISTORY2
-    NS_DECL_NSIOBSERVER
-    nsresult RemoveEntries(const PRUnichar *url = nsnull, int time = 0);
-
-    protected:
-    enum {
-        kFlushModeAppend,      /** < Add a new entry in the history file */
-        kFlushModeFullWrite    /** < Rewrite all history file */
-    };
-/** Initiates the history file
-  * @return NS_OK on the success.
-  */
-    nsresult          InitFile();
-/** Loads the history file
-  * @return NS_OK on the success.
-  */
-    nsresult          LoadData();
-/** Writes entries in the history file
-  * @param list The internal history list.
-  * @param handle A Gnome VFS handle.
-  * @return NS_OK on the success.
-*/
-    nsresult          WriteEntryIfWritten(GList *list, OUTPUT_STREAM *file_handle);
-/** Writes entries in the history file
- * @param list The internal history list.
- * @param handle A Gnome VFS handle.
- * @return NS_OK on the success.
-*/
-    nsresult          WriteEntryIfUnwritten(GList *list, OUTPUT_STREAM *file_handle);
-/** Writes entries in the history file
-  * @param mode How to write in the history file
-  * @return NS_OK on the success.
-  */
-    nsresult          FlushData(PRIntn mode = kFlushModeFullWrite);
- /** Remove entries from the URL table
-  * @return NS_OK on the success.
-  */
-    nsresult          ResetData();
-/** Reads the history entries using GnomeVFS
-  * @param vfs_handle A Gnome VFS handle.
-  * @return NS_OK on the success.
-  */
-    nsresult          ReadEntries(LOCAL_FILE *file_uri);
-/** Gets a history entry 
-  * @param name The history entry name.
-  * @return NS_OK if the history entry name was gotten.
-  */
-    nsresult          GetEntry(const char *);
-    protected:
-    OUTPUT_STREAM    *mFileHandle;              /** < The History File handle */
-    PRBool            mDataIsLoaded;            /** < If the data is loaded */
-    PRBool            mFlushModeFullWriteNeeded;/** < If needs a full flush */
-    PRInt32           mEntriesAddedSinceFlush;  /** < Number of entries added since flush */
-    gchar*            mHistoryFile;             /** < The history file path */
-};
-// Default maximum history entries
-static const PRUint32 kDefaultMaxSize = 1000;
-#endif
--- a/embedding/browser/gtk/src/Makefile.in
+++ b/embedding/browser/gtk/src/Makefile.in
@@ -121,10 +121,12 @@ MARSHAL_FILE = gtkmozembedmarshal
 MARSHAL_PREFIX = gtkmozembed
 
 $(MARSHAL_FILE).h: $(MARSHAL_FILE).list
 	glib-genmarshal --prefix=$(MARSHAL_PREFIX) $(srcdir)/$(MARSHAL_FILE).list --skip-source --header > $@
 
 $(MARSHAL_FILE).c: $(MARSHAL_FILE).list $(MARSHAL_FILE).h
 	glib-genmarshal --prefix=$(MARSHAL_PREFIX) $(srcdir)/$(MARSHAL_FILE).list --skip-source --body > $@
 
+gtkmozembed2.$(OBJ_SUFFIX): $(MARSHAL_FILE).h
+
 GARBAGE += $(MARSHAL_FILE).h $(MARSHAL_FILE).c
 
deleted file mode 100644
--- a/embedding/browser/gtk/src/gtkmozembed_common.cpp
+++ /dev/null
@@ -1,662 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- *
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Christopher Blizzard <blizzard@mozilla.org>
- *   Ramiro Estrugo <ramiro@eazel.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <stdio.h>
-#include "gtkmozembed.h"
-#include "gtkmozembed_common.h"
-#include "gtkmozembedprivate.h"
-#include "gtkmozembed_internal.h"
-#include "EmbedPrivate.h"
-#include "EmbedWindow.h"
-
-#include "EmbedGlobalHistory.h"
-//#include "EmbedDownloadMgr.h"
-// so we can do our get_nsIWebBrowser later...
-#include "nsIWebBrowser.h"
-#include "nsIComponentManager.h"
-#include "nsIServiceManager.h"
-#include "nsIPref.h"
-#include "nsICookieManager.h"
-#include "nsIPermissionManager.h"
-#include "nsNetCID.h"
-#include "nsICookie.h"
-#include "nsIX509Cert.h"
-// for strings
-#ifdef MOZILLA_INTERNAL_API
-#include "nsXPIDLString.h"
-#include "nsReadableUtils.h"
-#include "nsString.h"
-#else
-#include "nsStringAPI.h"
-#include "nsComponentManagerUtils.h"
-#include "nsServiceManagerUtils.h"
-#endif
-// for plugins
-#include "nsIDOMNavigator.h"
-#include "nsIDOMPluginArray.h"
-#include "nsIDOMPlugin.h"
-#include <plugin/nsIPluginHost.h>
-#include "nsIDOMMimeType.h"
-#include "nsIObserverService.h"
-
-//for security
-#include "nsIWebProgressListener.h"
-
-//for cache
-#include "nsICacheService.h"
-#include "nsICache.h"
-
-#include "gtkmozembedmarshal.h"
-#define NEW_TOOLKIT_STRING(x) g_strdup(NS_ConvertUTF16toUTF8(x).get())
-#define GET_TOOLKIT_STRING(x) NS_ConvertUTF16toUTF8(x).get()
-#define GET_OBJECT_CLASS_TYPE(x) G_OBJECT_CLASS_TYPE(x)
-
-#define UNACCEPTABLE_CRASHY_GLIB_ALLOCATION(newed) PR_BEGIN_MACRO \
-  /* OOPS this code is using a glib allocation function which     \
-   * will cause the application to crash when it runs out of      \
-   * memory. This is not cool. either g_try methods should be     \
-   * used or malloc, or new (note that gecko /will/ be replacing  \
-   * its operator new such that new will not throw exceptions).   \
-   * XXX please fix me.                                           \
-   */                                                             \
-  if (!newed) {                                                   \
-  }                                                               \
-  PR_END_MACRO
-
-#define ALLOC_NOT_CHECKED(newed) PR_BEGIN_MACRO \
-  /* This might not crash, but the code probably isn't really \
-   * designed to handle it, perhaps the code should be fixed? \
-   */                                                         \
-  if (!newed) {                                               \
-  }                                                           \
-  PR_END_MACRO
-
-// CID used to get the plugin manager
-static NS_DEFINE_CID(kPluginManagerCID, NS_PLUGINMANAGER_CID);
-
-// class and instance initialization
-
-static void
-gtk_moz_embed_common_class_init(GtkMozEmbedCommonClass *klass);
-
-static void
-gtk_moz_embed_common_init(GtkMozEmbedCommon *embed);
-
-static GtkObjectClass *common_parent_class = NULL;
-
-// GtkObject methods
-
-static void
-gtk_moz_embed_common_destroy(GtkObject *object);
-
-guint moz_embed_common_signals[COMMON_LAST_SIGNAL] = { 0 };
-
-// GtkObject + class-related functions
-GtkType
-gtk_moz_embed_common_get_type(void)
-{
-  static GtkType moz_embed_common_type = 0;
-  if (!moz_embed_common_type)
-  {
-    static const GtkTypeInfo moz_embed_common_info =
-    {
-      "GtkMozEmbedCommon",
-      sizeof(GtkMozEmbedCommon),
-      sizeof(GtkMozEmbedCommonClass),
-      (GtkClassInitFunc)gtk_moz_embed_common_class_init,
-      (GtkObjectInitFunc)gtk_moz_embed_common_init,
-      0,
-      0,
-      0
-    };
-    moz_embed_common_type = gtk_type_unique(GTK_TYPE_BIN, &moz_embed_common_info);
-  }
-  return moz_embed_common_type;
-}
-
-static void
-gtk_moz_embed_common_class_init(GtkMozEmbedCommonClass *klass)
-{
-  GtkObjectClass     *object_class;
-  object_class    = GTK_OBJECT_CLASS(klass);
-  common_parent_class = (GtkObjectClass *)gtk_type_class(gtk_object_get_type());
-  object_class->destroy = gtk_moz_embed_common_destroy;
-  moz_embed_common_signals[COMMON_CERT_ERROR] =
-    gtk_signal_new("certificate-error",
-                   GTK_RUN_LAST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     certificate_error),
-                   gtkmozembed_BOOL__POINTER_UINT,
-                   G_TYPE_BOOLEAN,
-                   2,
-                   GTK_TYPE_POINTER,
-                   GTK_TYPE_UINT);
-  moz_embed_common_signals[COMMON_SELECT_LOGIN] =
-    gtk_signal_new("select-login",
-                   GTK_RUN_LAST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     select_login),
-                   gtk_marshal_INT__POINTER,
-                   G_TYPE_INT,
-                   1,
-                   G_TYPE_POINTER);
-  moz_embed_common_signals[COMMON_REMEMBER_LOGIN] =
-    gtk_signal_new("remember-login",
-                   GTK_RUN_LAST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     remember_login),
-                   gtkmozembed_INT__VOID,
-                   G_TYPE_INT, 0);
-  // set up our signals
-  moz_embed_common_signals[COMMON_ASK_COOKIE] =
-    gtk_signal_new("ask-cookie",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass, ask_cookie),
-                   gtkmozembed_VOID__POINTER_INT_STRING_STRING_STRING_STRING_STRING_BOOLEAN_INT,
-                   G_TYPE_NONE, 9,
-                   GTK_TYPE_POINTER,
-                   GTK_TYPE_INT,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                   GTK_TYPE_BOOL,
-                   GTK_TYPE_INT);
-/*
-  moz_embed_common_signals[COMMON_CERT_DIALOG] =
-    gtk_signal_new("certificate-dialog",
-                   GTK_RUN_LAST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     certificate_dialog),
-                   gtk_marshal_BOOL__POINTER,
-                   G_TYPE_BOOLEAN, 1, GTK_TYPE_POINTER);
-  moz_embed_common_signals[COMMON_CERT_PASSWD_DIALOG] =
-    gtk_signal_new("certificate-password-dialog",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     certificate_password_dialog),
-                   gtkmozembed_VOID__STRING_STRING_POINTER,
-                   G_TYPE_NONE,
-                   3,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                   GTK_TYPE_POINTER);
-  moz_embed_common_signals[COMMON_CERT_DETAILS_DIALOG] =
-    gtk_signal_new("certificate-details",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     certificate_details),
-                   gtk_marshal_VOID__POINTER,
-                   G_TYPE_NONE,
-                   1,
-                   GTK_TYPE_POINTER);
-  moz_embed_common_signals[COMMON_HISTORY_ADDED] =
-    gtk_signal_new("global-history-item-added",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     history_added),
-                   gtk_marshal_VOID__STRING,
-                   G_TYPE_NONE,
-                   1,
-                   GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
-  moz_embed_common_signals[COMMON_ON_SUBMIT_SIGNAL] =
-    gtk_signal_new("on-submit",
-                   GTK_RUN_LAST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                                     on_submit),
-                   gtkmozembed_INT__VOID,
-                   G_TYPE_INT, 0);
-  moz_embed_common_signals[COMMON_MODAL_DIALOG] =
-    gtk_signal_new("modal_dialog",
-                   GTK_RUN_LAST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedCommonClass,
-                      modal_dialog),
-                   gtkmozembed_INT__STRING_STRING_INT_INT_INT_INT,
-                   G_TYPE_INT,
-                   6,
-                   G_TYPE_STRING, G_TYPE_STRING,
-                   G_TYPE_INT, G_TYPE_INT,
-                   G_TYPE_INT, G_TYPE_INT);
-  */
-}
-
-static void
-gtk_moz_embed_common_init(GtkMozEmbedCommon *common)
-{
-  // this is a placeholder for later in case we need to stash data at
-  // a later data and maintain backwards compatibility.
-  common->data = nsnull;
-  EmbedCommon *priv = EmbedCommon::GetInstance();
-  priv->mCommon = GTK_OBJECT(common);
-  common->data = priv;
-  EmbedGlobalHistory::GetInstance();
-}
-
-static void
-gtk_moz_embed_common_destroy(GtkObject *object)
-{
-  g_return_if_fail(object != NULL);
-  g_return_if_fail(GTK_IS_MOZ_EMBED_COMMON(object));
-  GtkMozEmbedCommon  *embed = nsnull;
-  EmbedCommon *commonPrivate = nsnull;
-  embed = GTK_MOZ_EMBED_COMMON(object);
-  commonPrivate = (EmbedCommon *)embed->data;
-  if (commonPrivate) {
-    delete commonPrivate;
-    embed->data = NULL;
-  }
-}
-
-GtkWidget *
-gtk_moz_embed_common_new(void)
-{
-  GtkWidget *widget = (GtkWidget*) gtk_type_new(gtk_moz_embed_common_get_type());
-  gtk_widget_set_name(widget, "gtkmozembedcommon");
-  return (GtkWidget *) widget;
-}
-
-gboolean
-gtk_moz_embed_common_set_pref(GtkType type, gchar *name, gpointer value)
-{
-  g_return_val_if_fail (name != NULL, FALSE);
-
-  nsCOMPtr<nsIPref> pref = do_GetService(NS_PREF_CONTRACTID);
-
-  if (pref) {
-    nsresult rv = NS_ERROR_FAILURE;
-    switch (type) {
-    case GTK_TYPE_BOOL:
-      {
-        /* I doubt this cast pair is correct */
-        rv = pref->SetBoolPref(name, !!*(int*)value);
-        break;
-      }
-    case GTK_TYPE_INT:
-      {
-        /* I doubt this cast pair is correct */
-        rv = pref->SetIntPref(name, *(int*)value);
-        break;
-      }
-    case GTK_TYPE_STRING:
-      {
-        g_return_val_if_fail (value, FALSE);
-        rv = pref->SetCharPref(name, (gchar*)value);
-        break;
-      }
-    default:
-      break;
-    }
-    return NS_SUCCEEDED(rv);
-  }
-  return FALSE;
-}
-
-gboolean
-gtk_moz_embed_common_get_pref(GtkType type, gchar *name, gpointer value)
-{
-  g_return_val_if_fail (name != NULL, FALSE);
-
-  nsCOMPtr<nsIPref> pref = do_GetService(NS_PREF_CONTRACTID);
-
-  nsresult rv = NS_ERROR_FAILURE;
-  if (pref){
-    switch (type) {
-    case GTK_TYPE_BOOL:
-      {
-        rv = pref->GetBoolPref(name, (gboolean*)value);
-        break;
-      }
-    case GTK_TYPE_INT:
-      {
-        rv = pref->GetIntPref(name, (gint*)value);
-        break;
-      }
-    case GTK_TYPE_STRING:
-      {
-        rv = pref->GetCharPref(name, (gchar**)value);
-        break;
-      }
-    default:
-      break;
-    }
-    return NS_SUCCEEDED(rv);
-  }
-  return FALSE;
-}
-
-gboolean
-gtk_moz_embed_common_save_prefs()
-{
-  nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREF_CONTRACTID);
-  g_return_val_if_fail (prefService != nsnull, FALSE);
-  if (prefService == nsnull)
-    return FALSE;
-  nsresult rv = prefService->SavePrefFile (nsnull);
-  return NS_SUCCEEDED(rv);
-}
-
-gint
-gtk_moz_embed_common_get_history_list(GtkMozHistoryItem **GtkHI)
-{
-  gint count = 0;
-  EmbedGlobalHistory *history = EmbedGlobalHistory::GetInstance();
-  history->GetContentList(GtkHI, &count);
-  return count;
-}
-
-gint
-gtk_moz_embed_common_remove_history(gchar *url, gint time) {
-  nsresult rv;
-  // The global history service
-  nsCOMPtr<nsIGlobalHistory2> globalHistory(do_GetService("@mozilla.org/browser/global-history;2"));
-  if (!globalHistory) return NS_ERROR_NULL_POINTER;
-  // The browser history interface
-  nsCOMPtr<nsIObserver> myHistory = do_QueryInterface(globalHistory, &rv);
-  if (!myHistory) return NS_ERROR_NULL_POINTER ;
-  if (!url)
-    myHistory->Observe(nsnull, "RemoveEntries", nsnull);
-  else {
-    EmbedGlobalHistory *history = EmbedGlobalHistory::GetInstance();
-    PRUnichar *uniurl = ToNewUnicode(NS_ConvertUTF8toUTF16(url));
-    rv = history->RemoveEntries(uniurl, time);
-    NS_Free(uniurl);
-  }
-  return 1;
-}
-
-GSList*
-gtk_moz_embed_common_get_cookie_list(void)
-{
-  GSList *cookies = NULL;
-  nsresult result;
-  nsCOMPtr<nsICookieManager> cookieManager =
-    do_GetService(NS_COOKIEMANAGER_CONTRACTID);
-  nsCOMPtr<nsISimpleEnumerator> cookieEnumerator;
-  result = cookieManager->GetEnumerator(getter_AddRefs(cookieEnumerator));
-  g_return_val_if_fail(NS_SUCCEEDED(result), NULL);
-  PRBool enumResult;
-  for (cookieEnumerator->HasMoreElements(&enumResult);
-       enumResult == PR_TRUE;
-       cookieEnumerator->HasMoreElements(&enumResult))
-  {
-    GtkMozCookieList *c;
-    nsCOMPtr<nsICookie> nsCookie;
-    result = cookieEnumerator->GetNext(getter_AddRefs(nsCookie));
-    g_return_val_if_fail(NS_SUCCEEDED(result), NULL);
-    c = g_new0(GtkMozCookieList, 1);
-    UNACCEPTABLE_CRASHY_GLIB_ALLOCATION(c);
-    nsCAutoString transfer;
-    nsCookie->GetHost(transfer);
-    c->domain = g_strdup(transfer.get());
-    nsCookie->GetName(transfer);
-    c->name = g_strdup(transfer.get());
-    nsCookie->GetValue(transfer);
-    c->value = g_strdup(transfer.get());
-    nsCookie->GetPath(transfer);
-    /* this almost certainly leaks g_strconcat */
-    if (strchr(c->domain,'.'))
-      c->path = g_strdup(g_strconcat("http://*",c->domain,"/",NULL));
-    else
-      c->path = g_strdup(g_strconcat("http://",c->domain,"/",NULL));
-    cookies = g_slist_prepend(cookies, c);
-  }
-  cookies = g_slist_reverse(cookies);
-  return cookies;
-}
-
-gint
-gtk_moz_embed_common_delete_all_cookies(GSList *deletedCookies)
-{
-  nsCOMPtr<nsIPermissionManager> permissionManager =
-    do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
-
-  if (!permissionManager)
-    return 1;
-
-  permissionManager->RemoveAll();
-
-  if (!deletedCookies)
-    return 1;
-
-  nsCOMPtr<nsICookieManager> cookieManager =
-    do_GetService(NS_COOKIEMANAGER_CONTRACTID);
-
-  if (!cookieManager)
-    return 1;
-  cookieManager->RemoveAll();
-
-  g_slist_free(deletedCookies);
-  return 0;//False in GWebStatus means OK, as opposed to gboolean in C
-}
-
-unsigned char *
-gtk_moz_embed_common_nsx509_to_raw(void *nsIX509Ptr, guint *len)
-{
-  if (!nsIX509Ptr)
-    return NULL;
-  unsigned char *data;
-  ((nsIX509Cert*)nsIX509Ptr)->GetRawDER(len, (PRUint8 **)&data);
-  if (!data)
-    return NULL;
-  return data;
-}
-
-gint
-gtk_moz_embed_common_get_plugins_list(GList **pluginArray)
-{
-  nsresult rv;
-  nsCOMPtr<nsIPluginManager> pluginMan =
-    do_GetService(kPluginManagerCID, &rv);
-  if (NS_FAILED(rv)) {
-    g_print("Could not get the plugin manager\n");
-    return -1;
-  }
-  pluginMan->ReloadPlugins(PR_TRUE);  //FIXME XXX MEMLEAK
-
-  nsCOMPtr<nsIPluginHost> pluginHost =
-    do_GetService(kPluginManagerCID, &rv);
-  if (NS_FAILED(rv))
-    return -1;
-
-  PRUint32 aLength;
-  pluginHost->GetPluginCount(&aLength);
-
-  if (!pluginArray)
-    return (gint)aLength;
-
-  nsIDOMPlugin **aItems = nsnull;
-  aItems = new nsIDOMPlugin*[aLength];
-  if (!aItems)
-    return -1; //NO MEMORY
-
-  rv = pluginHost->GetPlugins(aLength, aItems);
-  if (NS_FAILED(rv)) {
-    delete [] aItems;
-    return -1;
-  }
-
-  nsString string;
-  for (int plugin_index = 0; plugin_index < (gint) aLength; plugin_index++)
-  {
-    GtkMozPlugin *list_item = g_new0(GtkMozPlugin, 1);
-    UNACCEPTABLE_CRASHY_GLIB_ALLOCATION(list_item);
-
-    rv = aItems[plugin_index]->GetName(string);
-    if (!NS_FAILED(rv))
-      list_item->title = g_strdup(NS_ConvertUTF16toUTF8(string).get());
-
-    aItems[plugin_index]->GetFilename(string);
-    if (!NS_FAILED(rv))
-      list_item->path = g_strdup(NS_ConvertUTF16toUTF8(string).get());
-
-    nsCOMPtr<nsIDOMMimeType> mimeType;
-    PRUint32 mime_count = 0;
-    rv = aItems[plugin_index]->GetLength(&mime_count);
-    if (NS_FAILED(rv))
-      continue;
-    
-    nsString single_mime;
-    string.SetLength(0);
-    for (int mime_index = 0; mime_index < mime_count; ++mime_index) {
-      rv = aItems[plugin_index]->Item(mime_index, getter_AddRefs(mimeType));
-      if (NS_FAILED(rv))
-        continue;
-      rv = mimeType->GetDescription(single_mime);
-      if (!NS_FAILED(rv)) {
-        string.Append(single_mime);
-        string.AppendLiteral(";");
-      }
-    }
-    
-    list_item->type = g_strdup(NS_ConvertUTF16toUTF8(string).get());
-    if (!NS_FAILED(rv))
-      *pluginArray = g_list_append(*pluginArray, list_item);
-  }
-  delete [] aItems;
-  return (gint)aLength;
-}
-
-void
-gtk_moz_embed_common_reload_plugins()
-{
-  nsresult rv;
-  nsCOMPtr<nsIPluginManager> pluginMan =
-    do_GetService(kPluginManagerCID, &rv);
-  pluginMan->ReloadPlugins(PR_TRUE); //FIXME XXX MEMLEAK
-}
-
-guint
-gtk_moz_embed_common_get_security_mode(guint sec_state)
-{
-  GtkMozEmbedSecurityMode sec_mode;
-
-  const guint wpl_security_bits = nsIWebProgressListener::STATE_IS_SECURE |
-                                  nsIWebProgressListener::STATE_IS_BROKEN |
-                                  nsIWebProgressListener::STATE_IS_INSECURE |
-                                  nsIWebProgressListener::STATE_SECURE_HIGH |
-                                  nsIWebProgressListener::STATE_SECURE_MED |
-                                  nsIWebProgressListener::STATE_SECURE_LOW;
-
-  /* sec_state is defined as a bitmask that may be extended in the future.
-   * We filter out any unknown bits before testing for known values.
-   */
-  switch (sec_state & wpl_security_bits) {
-    case nsIWebProgressListener::STATE_IS_INSECURE:
-      sec_mode = GTK_MOZ_EMBED_NO_SECURITY;
-      //g_print("GTK_MOZ_EMBED_NO_SECURITY\n");
-      break;
-    case nsIWebProgressListener::STATE_IS_BROKEN:
-      sec_mode = GTK_MOZ_EMBED_NO_SECURITY;
-      //g_print("GTK_MOZ_EMBED_NO_SECURITY\n");
-      break;
-    case nsIWebProgressListener::STATE_IS_SECURE|
-      nsIWebProgressListener::STATE_SECURE_HIGH:
-      sec_mode = GTK_MOZ_EMBED_HIGH_SECURITY;
-      //g_print("GTK_MOZ_EMBED_HIGH_SECURITY");
-      break;
-    case nsIWebProgressListener::STATE_IS_SECURE|
-      nsIWebProgressListener::STATE_SECURE_MED:
-      sec_mode = GTK_MOZ_EMBED_MEDIUM_SECURITY;
-      //g_print("GTK_MOZ_EMBED_MEDIUM_SECURITY\n");
-      break;
-    case nsIWebProgressListener::STATE_IS_SECURE|
-      nsIWebProgressListener::STATE_SECURE_LOW:
-      sec_mode = GTK_MOZ_EMBED_LOW_SECURITY;
-      //g_print("GTK_MOZ_EMBED_LOW_SECURITY\n");
-      break;
-    default:
-      sec_mode = GTK_MOZ_EMBED_UNKNOWN_SECURITY;
-      //g_print("GTK_MOZ_EMBED_UNKNOWN_SECURITY\n");
-      break;
-  }
-  return sec_mode;
-}
-
-gint
-gtk_moz_embed_common_clear_cache(void)
-{
-  nsCacheStoragePolicy storagePolicy;
-
-  nsCOMPtr<nsICacheService> cacheService = do_GetService(NS_CACHESERVICE_CONTRACTID);
-
-  if (cacheService)
-  {
-    //clean disk cache and memory cache
-    storagePolicy = nsICache::STORE_ANYWHERE;
-    cacheService->EvictEntries(storagePolicy);
-    return 0;
-  }
-  return 1;
-}
-
-gboolean
-gtk_moz_embed_common_observe(const gchar* service_id,
-                             gpointer object,
-                             const gchar* topic,
-                             gunichar* data)
-{
-  nsresult rv;
-  if (service_id) {
-    nsCOMPtr<nsISupports> service = do_GetService(service_id, &rv);
-    NS_ENSURE_SUCCESS(rv, FALSE);
-    nsCOMPtr<nsIObserver> Observer = do_QueryInterface(service, &rv);
-    NS_ENSURE_SUCCESS(rv, FALSE);
-    rv = Observer->Observe((nsISupports*)object, topic, (PRUnichar*)data);
-  } else {
-    //This is the correct?
-    nsCOMPtr<nsIObserverService> obsService =
-      do_GetService("@mozilla.org/observer-service;1", &rv);
-    if (obsService)
-      rv = obsService->NotifyObservers((nsISupports*)object, topic, (PRUnichar*)data);
-  }
-  return NS_FAILED(rv) ? FALSE : TRUE;
-}
deleted file mode 100644
--- a/embedding/browser/gtk/src/gtkmozembed_common.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Christopher Blizzard <blizzard@mozilla.org>
- *   Ramiro Estrugo <ramiro@eazel.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#ifndef gtkmozembed_common_h
-#define gtkmozembed_common_h
-#include "gtkmozembed.h"
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-#include <stddef.h>
-#include <gtk/gtk.h>
-#ifdef MOZILLA_CLIENT
-#include "nscore.h"
-#else // MOZILLA_CLIENT
-#ifndef nscore_h__
-/* Because this header may be included from files which not part of the mozilla
-   build system, define macros from nscore.h */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
-#define NS_HIDDEN __attribute__((visibility("hidden")))
-#else
-#define NS_HIDDEN
-#endif
-#define NS_FROZENCALL
-#define NS_EXPORT_(type) type
-#define NS_IMPORT_(type) type
-#endif // nscore_h__
-#endif // MOZILLA_CLIENT
-#ifdef XPCOM_GLUE
-#define GTKMOZEMBED_API(type, name, params) \
-  typedef type (NS_FROZENCALL * name##Type) params; \
-  extern name##Type name NS_HIDDEN;
-#else // XPCOM_GLUE
-#ifdef _IMPL_GTKMOZEMBED
-#define GTKMOZEMBED_API(type, name, params) NS_EXPORT_(type) name params;
-#else
-#define GTKMOZEMBED_API(type,name, params) NS_IMPORT_(type) name params;
-#endif
-#endif // XPCOM_GLUE
-#define GTK_TYPE_MOZ_EMBED_COMMON             (gtk_moz_embed_common_get_type())
-#define GTK_MOZ_EMBED_COMMON(obj)             GTK_CHECK_CAST((obj), GTK_TYPE_MOZ_EMBED_COMMON, GtkMozEmbedCommon)
-#define GTK_MOZ_EMBED_COMMON_CLASS(klass)     GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED_COMMON, GtkMozEmbedCommonClass)
-#define GTK_IS_MOZ_EMBED_COMMON(obj)          GTK_CHECK_TYPE((obj), GTK_TYPE_MOZ_EMBED_COMMON)
-#define GTK_IS_MOZ_EMBED_COMMON_CLASS(klass)  GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED_COMMON)
-typedef struct _GtkMozEmbedCommon      GtkMozEmbedCommon;
-typedef struct _GtkMozEmbedCommonClass GtkMozEmbedCommonClass;
-struct _GtkMozEmbedCommon
-{
-  GtkBin object;
-  void   *data;
-};
-struct _GtkMozEmbedCommonClass
-{
-  GtkBinClass parent_class;
-  gboolean (* certificate_error)        (GObject *, GObject*, guint);
-  gint     (* select_login)             (GObject *, GList*);
-  gint     (* remember_login)           (GObject *);
-  void     (* ask_cookie)               (GObject * , gint , const gchar * , const gchar * , const gchar * ,
-                                         const gchar *, const gchar * , gboolean , gint , GObject *);
-//  void (* ask_cookie)                 (GObject * , gpointer , gint , const gchar * , const gchar * , const gchar * ,
-//                                       const gchar *, const gchar * , gboolean , gint , GObject *);
-//  gint (* modal_dialog)               (GObject *, const gchar *, const gchar *, gint, gint, gint, gint);
-//  gboolean (* certificate_dialog)     (GObject * , GObject *);
-//  void (*certificate_password_dialog) (GObject *, const gchar *, const gchar *, gchar **);
-//  void (*certificate_details)         (GObject *, gpointer );
-//  gint (*on_submit)                   (GObject *);
-//  gint (*select_match)                (GObject *, gpointer);
-//  void (*history_added)               (GObject *, const gchar *, GObject*);
-};
-typedef enum
-{
-  GTK_MOZ_EMBED_CERT_VERIFIED_OK           = 0x0000,
-  GTK_MOZ_EMBED_CERT_UNTRUSTED             = 0x0001,
-  GTK_MOZ_EMBED_CERT_NOT_VERIFIED_UNKNOWN  = 0x0002,
-  GTK_MOZ_EMBED_CERT_EXPIRED               = 0x0004,
-  GTK_MOZ_EMBED_CERT_REVOKED               = 0x0008,
-  GTK_MOZ_EMBED_UNKNOWN_CERT               = 0x0010,
-  GTK_MOZ_EMBED_CERT_ISSUER_UNTRUSTED      = 0x0020,
-  GTK_MOZ_EMBED_CERT_ISSUER_UNKNOWN        = 0x0040,
-  GTK_MOZ_EMBED_CERT_INVALID_CA            = 0x0080
-} GtkMozEmbedCertificateType;
-typedef enum
-{
-  GTK_MOZ_EMBED_LOGIN_REMEMBER_FOR_THIS_SITE,
-  GTK_MOZ_EMBED_LOGIN_REMEMBER_FOR_THIS_SERVER,
-  GTK_MOZ_EMBED_LOGIN_NOT_NOW,
-  GTK_MOZ_EMBED_LOGIN_NEVER_FOR_SITE,
-  GTK_MOZ_EMBED_LOGIN_NEVER_FOR_SERVER
-} GtkMozEmbedLoginType;
-/*  GTK_MOZ_EMBED_CERT_USAGE_NOT_ALLOWED,
-  GTK_MOZ_EMBED_CA_CERT,
-  GTK_MOZ_EMBED_USER_CERT,
-  GTK_MOZ_EMBED_EMAIL_CERT,
-  GTK_MOZ_EMBED_SERVER_CERT
-*/
-
-/** GtkMozEmbedSecurityMode.
-  * Enumerates security modes.
-  */
-typedef enum
-{
-  GTK_MOZ_EMBED_NO_SECURITY = 0,
-  GTK_MOZ_EMBED_LOW_SECURITY,
-  GTK_MOZ_EMBED_MEDIUM_SECURITY,
-  GTK_MOZ_EMBED_HIGH_SECURITY,
-  GTK_MOZ_EMBED_UNKNOWN_SECURITY
-} GtkMozEmbedSecurityMode;
-
-typedef struct _GtkMozCookieList GtkMozCookieList;
-struct _GtkMozCookieList
-{
-    gchar *domain; /** < The domain's name */
-    gchar *name;   /** < The cookie's name */
-    gchar *value;  /** < The cookie's value */
-    gchar *path;   /** < The cookie's path */
-};
-typedef struct _GtkMozEmbedCookie GtkMozEmbedCookie;
-struct _GtkMozEmbedCookie
-{
-    gboolean remember_decision;
-    gboolean accept;
-};
-/** @struct GtkMozPlugin.
- * Defines a Mozilla Plugin.
- */
-typedef struct _GtkMozPlugin GtkMozPlugin;
-struct _GtkMozPlugin
-{
-    gchar *title;  /** < Plugin title */
-    gchar *path;   /** < Plugin path */
-    gchar *type;   /** < Plugin type */
-    gboolean isDisabled; /** < is plugin enabled */
-};
-
-typedef struct _GtkMozLogin GtkMozLogin;
-struct _GtkMozLogin
-{
-    const gchar *user; /** < Plugin title */
-    const gchar *pass; /** < Plugin path */
-    const gchar *host; /** < Plugin type */
-    guint index;
-};
-
-GTKMOZEMBED_API(GtkType,    gtk_moz_embed_common_get_type,          (void))
-GTKMOZEMBED_API(GtkWidget*, gtk_moz_embed_common_new,               (void))
-GTKMOZEMBED_API(gboolean,   gtk_moz_embed_common_set_pref,          (GtkType type, gchar*, gpointer))
-GTKMOZEMBED_API(gboolean,   gtk_moz_embed_common_get_pref,          (GtkType type, gchar*, gpointer))
-GTKMOZEMBED_API(gboolean,   gtk_moz_embed_common_save_prefs,        (void))
-GTKMOZEMBED_API(gboolean,   gtk_moz_embed_common_login,             (GtkWidget *embed, const gchar* username))
-GTKMOZEMBED_API(gint,       gtk_moz_embed_common_get_history_list,  (GtkMozHistoryItem **GtkHI))
-GTKMOZEMBED_API(gint,       gtk_moz_embed_common_remove_history,    (gchar *url, gint time))
-GTKMOZEMBED_API(GSList*,    gtk_moz_embed_common_get_cookie_list,   (void))
-GTKMOZEMBED_API(gint,       gtk_moz_embed_common_delete_all_cookies,(GSList *deletedCookies))
-GTKMOZEMBED_API(unsigned char*, gtk_moz_embed_common_nsx509_to_raw, (void *nsIX509Ptr, guint *len))
-GTKMOZEMBED_API(gint,       gtk_moz_embed_common_get_plugins_list,  (GList **pluginArray))
-GTKMOZEMBED_API(void,       gtk_moz_embed_common_reload_plugins,    (void))
-GTKMOZEMBED_API(guint,      gtk_moz_embed_common_get_security_mode, (guint sec_state))
-GTKMOZEMBED_API(gint,       gtk_moz_embed_common_clear_cache,       (void))
-GTKMOZEMBED_API(gboolean,   gtk_moz_embed_common_observe,           (const gchar*, gpointer, const gchar*, gunichar*))
-
-
-/*typedef struct _GtkMozEmbedCertContext GtkMozEmbedCertContext;
-struct _GtkMozEmbedCertContext
-{
-    GObject * cert;
-    guint message;
-    GtkWidget *parent;
-};*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gtkmozembed_common_h */
deleted file mode 100644
--- a/embedding/browser/gtk/src/gtkmozembed_download.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Christopher Blizzard <blizzard@mozilla.org>
- *   Ramiro Estrugo <ramiro@eazel.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <stdio.h>
-#include "gtkmozembed.h"
-#include "gtkmozembed_download.h"
-#include "gtkmozembedprivate.h"
-#include "gtkmozembed_internal.h"
-#include "EmbedPrivate.h"
-#include "EmbedWindow.h"
-#include "EmbedDownloadMgr.h"
-// so we can do our get_nsIWebBrowser later...
-#include "nsIWebBrowser.h"
-
-// for strings
-#ifdef MOZILLA_INTERNAL_API
-#include "nsXPIDLString.h"
-#include "nsReadableUtils.h"
-#else
-#include "nsStringAPI.h"
-#endif
-
-#include "gtkmozembedmarshal.h"
-#define NEW_TOOLKIT_STRING(x) g_strdup(NS_ConvertUTF16toUTF8(x).get())
-#define GET_TOOLKIT_STRING(x) NS_ConvertUTF16toUTF8(x).get()
-#define GET_OBJECT_CLASS_TYPE(x) G_OBJECT_CLASS_TYPE(x)
-
-static void gtk_moz_embed_download_set_latest_object(GtkObject *o);
-static GtkObject *latest_download_object = nsnull;
-
-// class and instance initialization
-guint moz_embed_download_signals[DOWNLOAD_LAST_SIGNAL] = { 0 };
-static void gtk_moz_embed_download_class_init(GtkMozEmbedDownloadClass *klass);
-static void gtk_moz_embed_download_init(GtkMozEmbedDownload *embed);
-static void gtk_moz_embed_download_destroy(GtkObject *object);
-GtkObject * gtk_moz_embed_download_new(void);
-
-// GtkObject + class-related functions
-GtkType
-gtk_moz_embed_download_get_type(void)
-{
-  static GtkType moz_embed_download_type = 0;
-  if (!moz_embed_download_type)
-  {
-    static const GtkTypeInfo moz_embed_download_info =
-    {
-      "GtkMozEmbedDownload",
-      sizeof(GtkMozEmbedDownload),
-      sizeof(GtkMozEmbedDownloadClass),
-      (GtkClassInitFunc)gtk_moz_embed_download_class_init,
-      (GtkObjectInitFunc)gtk_moz_embed_download_init,
-      0,
-      0,
-      0
-    };
-    moz_embed_download_type = gtk_type_unique(GTK_TYPE_OBJECT, &moz_embed_download_info);
-  }
-  return moz_embed_download_type;
-}
-
-static void
-gtk_moz_embed_download_class_init(GtkMozEmbedDownloadClass *klass)
-{
-  GtkObjectClass     *object_class;
-  object_class    = GTK_OBJECT_CLASS(klass);
-  object_class->destroy = gtk_moz_embed_download_destroy;
-
-  // set up our signals
-  moz_embed_download_signals[DOWNLOAD_STARTED_SIGNAL] =
-    gtk_signal_new("started",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedDownloadClass, started),
-                   gtk_marshal_NONE__POINTER,
-                   GTK_TYPE_NONE,
-                   1,
-                   G_TYPE_POINTER);
-
-  moz_embed_download_signals[DOWNLOAD_COMPLETED_SIGNAL] =
-    gtk_signal_new("completed",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedDownloadClass, completed),
-                   gtk_marshal_NONE__NONE,
-                   GTK_TYPE_NONE, 0);
-
-  moz_embed_download_signals[DOWNLOAD_FAILED_SIGNAL] =
-    gtk_signal_new("error",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedDownloadClass, error),
-                   gtk_marshal_NONE__NONE,
-                   GTK_TYPE_NONE, 0);
-
-  moz_embed_download_signals[DOWNLOAD_DESTROYED_SIGNAL] =
-    gtk_signal_new("aborted",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedDownloadClass, aborted),
-                   gtk_marshal_NONE__NONE,
-                   GTK_TYPE_NONE, 0);
-
-  moz_embed_download_signals[DOWNLOAD_PROGRESS_SIGNAL] =
-    gtk_signal_new("progress",
-                   GTK_RUN_FIRST,
-                   GET_OBJECT_CLASS_TYPE(klass),
-                   GTK_SIGNAL_OFFSET(GtkMozEmbedDownloadClass, progress),
-                   gtkmozembed_VOID__ULONG_ULONG_ULONG,
-                   GTK_TYPE_NONE,
-                   3,
-                   G_TYPE_ULONG,
-                   G_TYPE_ULONG,
-                   G_TYPE_ULONG);
-}
-
-static void
-gtk_moz_embed_download_init(GtkMozEmbedDownload *download)
-{
-  // this is a placeholder for later in case we need to stash data at
-  // a later data and maintain backwards compatibility.
-  download->data = nsnull;
-  EmbedDownload *priv = new EmbedDownload();
-  download->data = priv;
-}
-
-static void
-gtk_moz_embed_download_destroy(GtkObject *object)
-{
-  g_return_if_fail(object != NULL);
-  g_return_if_fail(GTK_IS_MOZ_EMBED_DOWNLOAD(object));
-
-  GtkMozEmbedDownload  *embed;
-  EmbedDownload *downloadPrivate;
-
-  embed = GTK_MOZ_EMBED_DOWNLOAD(object);
-  downloadPrivate = (EmbedDownload *)embed->data;
-
-  if (downloadPrivate) {
-    delete downloadPrivate;
-    embed->data = NULL;
-  }
-}
-
-GtkObject *
-gtk_moz_embed_download_new(void)
-{
-  GtkObject *instance = (GtkObject *) gtk_type_new(gtk_moz_embed_download_get_type());
-  gtk_moz_embed_download_set_latest_object(instance);
-
-  return instance;
-}
-
-GtkObject *
-gtk_moz_embed_download_get_latest_object(void)
-{
-  return latest_download_object;
-}
-
-static void
-gtk_moz_embed_download_set_latest_object(GtkObject *obj)
-{
-  latest_download_object = obj;
-  return ;
-}
-
-void
-gtk_moz_embed_download_do_command(GtkMozEmbedDownload *item, guint command)
-{
-  EmbedDownload *download_priv = (EmbedDownload *) item->data;
-
-  if (!download_priv)
-    return;
-
-  if (command == GTK_MOZ_EMBED_DOWNLOAD_CANCEL) {
-    download_priv->launcher->Cancel(GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED);
-    download_priv->launcher->SetWebProgressListener(nsnull);
-
-    return;
-  }
-
-  if (command == GTK_MOZ_EMBED_DOWNLOAD_RESUME) {
-    download_priv->request->Resume();
-    download_priv->is_paused = FALSE;
-
-    return;
-  }
-
-  if (command == GTK_MOZ_EMBED_DOWNLOAD_PAUSE) {
-    if (download_priv->request) {
-      download_priv->request->Suspend();
-      download_priv->is_paused = TRUE;
-    }
-
-    return;
-  }
-
-  if (command == GTK_MOZ_EMBED_DOWNLOAD_RELOAD) {
-    if (download_priv->gtkMozEmbedParentWidget) {}
-  }
-  // FIXME: missing GTK_MOZ_EMBED_DOWNLOAD_STORE and GTK_MOZ_EMBED_DOWNLOAD_RESTORE implementation.
-}
-
-gchar*
-gtk_moz_embed_download_get_file_name(GtkMozEmbedDownload *item)
-{
-  EmbedDownload *download_priv = (EmbedDownload *) item->data;
-
-  if (!download_priv)
-    return nsnull;
-
-  return (gchar *) download_priv->file_name;
-}
-
-gchar*
-gtk_moz_embed_download_get_url(GtkMozEmbedDownload *item)
-{
-  EmbedDownload *download_priv = (EmbedDownload *) item->data;
-
-  if (!download_priv)
-    return nsnull;
-
-  // FIXME : 'server' is storing the wrong value. See EmbedDownloadMgr.cpp l. 189.
-  return (gchar *) download_priv->server;
-}
-
-glong
-gtk_moz_embed_download_get_progress(GtkMozEmbedDownload *item)
-{
-  EmbedDownload *download_priv = (EmbedDownload *) item->data;
-
-  if (!download_priv)
-    return -1;
-
-  return (glong) download_priv->downloaded_size;
-}
-
-glong
-gtk_moz_embed_download_get_file_size(GtkMozEmbedDownload *item)
-{
-  EmbedDownload *download_priv = (EmbedDownload *) item->data;
-
-  if (!download_priv)
-    return -1;
-
-  return (glong) download_priv->file_size;
-}
-
deleted file mode 100644
--- a/embedding/browser/gtk/src/gtkmozembed_download.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Christopher Blizzard <blizzard@mozilla.org>
- *   Ramiro Estrugo <ramiro@eazel.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef gtkmozembed_download_h
-#define gtkmozembed_download_h
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-#include <stddef.h>
-#include <gtk/gtk.h>
-#ifdef MOZILLA_CLIENT
-#include "nscore.h"
-#else // MOZILLA_CLIENT
-#ifndef nscore_h__
-/* Because this header may be included from files which not part of the mozilla
-   build system, define macros from nscore.h */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
-#define NS_HIDDEN __attribute__((visibility("hidden")))
-#else
-#define NS_HIDDEN
-#endif
-#define NS_FROZENCALL
-#define NS_EXPORT_(type) type
-#define NS_IMPORT_(type) type
-#endif // nscore_h__
-#endif // MOZILLA_CLIENT
-#ifdef XPCOM_GLUE
-#define GTKMOZEMBED_API(type, name, params) \
-  typedef type (NS_FROZENCALL * name##Type) params; \
-  extern name##Type name NS_HIDDEN;
-#else // XPCOM_GLUE
-#ifdef _IMPL_GTKMOZEMBED
-#define GTKMOZEMBED_API(type, name, params) NS_EXPORT_(type) name params;
-#else
-#define GTKMOZEMBED_API(type,name, params) NS_IMPORT_(type) name params;
-#endif
-#endif // XPCOM_GLUE
-
-#define GTK_TYPE_MOZ_EMBED_DOWNLOAD             (gtk_moz_embed_download_get_type())
-#define GTK_MOZ_EMBED_DOWNLOAD(obj)             GTK_CHECK_CAST((obj), GTK_TYPE_MOZ_EMBED_DOWNLOAD, GtkMozEmbedDownload)
-#define GTK_MOZ_EMBED_DOWNLOAD_CLASS(klass)     GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED_DOWNLOAD, GtkMozEmbedDownloadClass)
-#define GTK_IS_MOZ_EMBED_DOWNLOAD(obj)          GTK_CHECK_TYPE((obj), GTK_TYPE_MOZ_EMBED_DOWNLOAD)
-#define GTK_IS_MOZ_EMBED_DOWNLOAD_CLASS(klass)  GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED_DOWNLOAD)
-
-typedef struct _GtkMozEmbedDownload      GtkMozEmbedDownload;
-typedef struct _GtkMozEmbedDownloadClass GtkMozEmbedDownloadClass;
-
-struct _GtkMozEmbedDownload
-{
-  GtkObject  object;
-  void *data;
-};
-
-struct _GtkMozEmbedDownloadClass
-{
-  GtkObjectClass parent_class;
-  void (*started) (GtkMozEmbedDownload* item, gchar **file_name_with_path);
-  void (*completed) (GtkMozEmbedDownload* item);
-  void (*error) (GtkMozEmbedDownload* item);
-  void (*aborted) (GtkMozEmbedDownload* item);
-  void (*progress) (GtkMozEmbedDownload* item, gulong downloaded_bytes, gulong total_bytes, gdouble kbps);
-};
-
-typedef enum
-{
-  GTK_MOZ_EMBED_DOWNLOAD_RESUME,
-  GTK_MOZ_EMBED_DOWNLOAD_CANCEL,
-  GTK_MOZ_EMBED_DOWNLOAD_PAUSE,
-  GTK_MOZ_EMBED_DOWNLOAD_RELOAD,
-  GTK_MOZ_EMBED_DOWNLOAD_STORE,
-  GTK_MOZ_EMBED_DOWNLOAD_RESTORE
-} GtkMozEmbedDownloadActions;
-
-GTKMOZEMBED_API(GtkType,      gtk_moz_embed_download_get_type,           (void))
-GTKMOZEMBED_API(GtkObject *,  gtk_moz_embed_download_new,                (void))
-GTKMOZEMBED_API(GtkObject *,  gtk_moz_embed_download_get_latest_object,  (void))
-GTKMOZEMBED_API(void,         gtk_moz_embed_download_do_command,         (GtkMozEmbedDownload *item, guint command))
-GTKMOZEMBED_API(void,         gtk_moz_embed_download_do_command,         (GtkMozEmbedDownload *item, guint command))
-GTKMOZEMBED_API(void,         gtk_moz_embed_download_do_command,         (GtkMozEmbedDownload *item, guint command))
-GTKMOZEMBED_API(void,         gtk_moz_embed_download_do_command,         (GtkMozEmbedDownload *item, guint command))
-GTKMOZEMBED_API(gchar*,       gtk_moz_embed_download_get_file_name,      (GtkMozEmbedDownload *item))
-GTKMOZEMBED_API(gchar*,       gtk_moz_embed_download_get_url,            (GtkMozEmbedDownload *item))
-GTKMOZEMBED_API(glong,        gtk_moz_embed_download_get_progress,       (GtkMozEmbedDownload *item))
-GTKMOZEMBED_API(glong,        gtk_moz_embed_download_get_file_size,      (GtkMozEmbedDownload *item))
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* gtkmozembed_download_h */