Bug 364168 Winhooks commandline options won't work in suiterunner. r/sr=Neil
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 04 Sep 2008 17:12:18 +0100
changeset 18800 2e8e583fc354998d0749aa0a9725c5cfa6941afd
parent 18799 d995cee98a929330e306d993fe42d1cda3b07955
child 18802 f3ac957eb4af2accf8c08300f328fe30f848d7fb
push idunknown
push userunknown
push dateunknown
bugs364168
milestone1.9.1b1pre
Bug 364168 Winhooks commandline options won't work in suiterunner. r/sr=Neil
toolkit/toolkit-makefiles.sh
xpfe/components/Makefile.in
xpfe/components/autocomplete/jar.mn
xpfe/components/build/Makefile.in
xpfe/components/build/appcomps.pkg
xpfe/components/build/nsModule.cpp
xpfe/components/jar.mn
xpfe/components/winhooks/Makefile.in
xpfe/components/winhooks/dummyWindow.xul
xpfe/components/winhooks/jar.mn
xpfe/components/winhooks/locale/en-US/nsWindowsHooks.properties
xpfe/components/winhooks/nsIWindowsHooks.idl
xpfe/components/winhooks/nsSetDefaultBrowser.js
xpfe/components/winhooks/nsSetDefaultMail.js
xpfe/components/winhooks/nsUnsetDefaultMail.js
xpfe/components/winhooks/nsWindowsHooks.cpp
xpfe/components/winhooks/nsWindowsHooks.h
xpfe/components/winhooks/nsWindowsHooksUtil.cpp
xpfe/components/winhooks/nsWindowsHooksUtil.h
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -583,17 +583,16 @@ MAKEFILES_xpfe="
   xpfe/components/history/public/Makefile
   xpfe/components/intl/Makefile
   xpfe/components/related/Makefile
   xpfe/components/related/src/Makefile
   xpfe/components/related/public/Makefile
   xpfe/components/autocomplete/Makefile
   xpfe/components/autocomplete/public/Makefile
   xpfe/components/autocomplete/src/Makefile
-  xpfe/components/winhooks/Makefile
   xpfe/components/windowds/Makefile
   xpfe/components/build/Makefile
   xpfe/appshell/Makefile
   xpfe/appshell/src/Makefile
   xpfe/appshell/public/Makefile
   xpfe/bootstrap/appleevents/Makefile
   extensions/spellcheck/Makefile
   extensions/spellcheck/hunspell/Makefile
--- a/xpfe/components/Makefile.in
+++ b/xpfe/components/Makefile.in
@@ -54,23 +54,16 @@ MOZ_HAVE_BROWSER=
 endif
 ifdef MOZ_STANDALONE_COMPOSER
 MOZ_HAVE_BROWSER=
 endif
 ifdef MOZ_SUNBIRD
 MOZ_HAVE_BROWSER=
 endif
 
-ifneq (,$(MOZ_PHOENIX)$(MOZ_XULRUNNER))
-# Firefox and XULRunner use this flag to suppress the distribution of chrome from
-# the jar.mn file that lives parallel to this Makefile. The jar.mn is responsible
-# for the packaging of a large number of chrome files these apps don't need. 
-DEFINES += -DSUPPRESS_CHROME
-endif
-
 DIRS = \
         find \
         $(NULL)
 
 ifdef MOZ_RDF
 DIRS += \
         intl \
         windowds \
@@ -86,20 +79,16 @@ DIRS += related
 
 ifdef SUITE_USING_XPFE_DM
 DIRS += download-manager
 endif
 
 ifndef MOZ_PLACES
 DIRS += history
 endif
-
-ifeq ($(OS_ARCH),WINNT)
-DIRS += winhooks
-endif
 endif # MOZ_SUITE
 
 ifdef MOZ_HAVE_BROWSER
 DIRS += \
         directory \
         $(NULL)
 
 # build should be last
rename from xpfe/components/jar.mn
rename to xpfe/components/autocomplete/jar.mn
--- a/xpfe/components/jar.mn
+++ b/xpfe/components/autocomplete/jar.mn
@@ -1,11 +1,3 @@
-#ifndef SUPPRESS_CHROME
-#ifdef MOZ_SUITE
-
-en-US.jar:
-    locale/en-US/global-platform/win/nsWindowsHooks.properties  (winhooks/locale/en-US/nsWindowsHooks.properties)
-#endif
-
 toolkit.jar:
-    content/global/autocomplete.xml                             (autocomplete/resources/content/autocomplete.xml)
-    content/global/autocomplete.css                             (autocomplete/resources/content/autocomplete.css)
-#endif
+    content/global/autocomplete.xml                             (resources/content/autocomplete.xml)
+    content/global/autocomplete.css                             (resources/content/autocomplete.css)
--- a/xpfe/components/build/Makefile.in
+++ b/xpfe/components/build/Makefile.in
@@ -108,25 +108,16 @@ REQUIRES += history
 SHARED_LIBRARY_LIBS += \
 	../history/src/$(LIB_PREFIX)history_s.$(LIB_SUFFIX) \
 	$(NULL)
 LOCAL_INCLUDES += \
 	-I$(srcdir)/../history/src       \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH),WINNT)
-SHARED_LIBRARY_LIBS += \
-	../winhooks/$(LIB_PREFIX)winhooks_s.$(LIB_SUFFIX) \
-	$(NULL)
-LOCAL_INCLUDES += \
-	-I$(srcdir)/../winhooks \
-	$(NULL)
-endif # WINNT
-
 endif # MOZ_SUITE
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS	+= $(call EXPAND_LIBNAME,ole32 shell32)
 endif
 
 EXTRA_DSO_LDOPTS += \
 	$(MOZ_UNICHARUTIL_LIBS) \
--- a/xpfe/components/build/appcomps.pkg
+++ b/xpfe/components/build/appcomps.pkg
@@ -13,29 +13,21 @@ dist/bin/components/nsResetPref.js
 
 !xpt dist/bin/components/directory.xpt
 !xpt dist/bin/components/related.xpt
 !xpt dist/bin/components/search.xpt
 !xpt dist/bin/components/windowds.xpt
 !xpt dist/bin/components/mozbrwsr.xpt
 
 #if OS_ARCH==WINNT
-dist/bin/components/nsSetDefaultBrowser.js
-!xpt dist/bin/components/winhooks.xpt
 !xpt dist/bin/components/urlwidgt.xpt
 !xpt dist/bin/components/alerts.xpt
 #endif
 
 [xpfe-browser]
 dist/bin/components/nsSidebar.js
 dist/bin/components/nsDownloadProgressListener.js
 !xpt dist/bin/components/bookmarks.xpt
 !xpt dist/bin/components/downloadmanager.xpt
 !xpt dist/bin/components/xpautocomplete.xpt
 !xpt dist/bin/components/history.xpt
 !xpt dist/bin/components/sidebar.xpt
 !xpt dist/bin/components/progressDlg.xpt
-
-[xpfe-mailnews]
-#if OS_ARCH==WINNT
-dist/bin/components/nsSetDefaultMail.js
-dist/bin/components/nsUnSetDefaultMail.js
-#endif
--- a/xpfe/components/build/nsModule.cpp
+++ b/xpfe/components/build/nsModule.cpp
@@ -52,20 +52,16 @@
 #include "nsDownloadManager.h"
 #include "nsDownloadProxy.h"
 #endif
 
 #if !defined(MOZ_PLACES)
 #include "nsGlobalHistory.h"
 #endif
 
-#if defined(XP_WIN)
-#include "nsWindowsHooks.h"
-#endif // Windows
-
 #endif // MOZ_SUITE
 
 #if !defined(MOZ_MACBROWSER)
 #include "nsBrowserStatusFilter.h"
 #include "nsBrowserInstance.h"
 #endif
 #include "nsCURILoader.h"
 #include "nsXPFEComponentsCID.h"
@@ -96,20 +92,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(Rela
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDownloadManager, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy)
 #endif
 
 #if !defined(MOZ_PLACES)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGlobalHistory, Init)
 #endif
 
-#if defined(XP_WIN)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsHooks)
-#endif // Windows
-
 #endif // MOZ_SUITE
 
 #if (!defined(MOZ_XUL_APP)) && !defined(MOZ_MACBROWSER)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserContentHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeStartupHandler)
 #endif
 
 
@@ -171,21 +163,16 @@ static const nsModuleComponentInfo compo
     { "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY2_CONTRACTID,
       nsGlobalHistoryConstructor },
     { "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY_DATASOURCE_CONTRACTID,
       nsGlobalHistoryConstructor },
     { "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY_AUTOCOMPLETE_CONTRACTID,
       nsGlobalHistoryConstructor },
 #endif
 
-#ifdef XP_WIN
-    { NS_IWINDOWSHOOKS_CLASSNAME, NS_IWINDOWSHOOKS_CID,
-      NS_IWINDOWSHOOKS_CONTRACTID, nsWindowsHooksConstructor },
-#endif // XP_WIN
-
 #endif // MOZ_SUITE
 
 #if !defined(MOZ_MACBROWSER)
     { NS_BROWSERSTATUSFILTER_CLASSNAME,
       NS_BROWSERSTATUSFILTER_CID,
       NS_BROWSERSTATUSFILTER_CONTRACTID,
       nsBrowserStatusFilterConstructor
     },
deleted file mode 100644
--- a/xpfe/components/winhooks/Makefile.in
+++ /dev/null
@@ -1,93 +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
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of 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 *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= appcomps
-XPIDL_MODULE	= winhooks
-LIBRARY_NAME	= winhooks_s
-MOZILLA_INTERNAL_API = 1
-
-XPIDLSRCS	= nsIWindowsHooks.idl
-
-CPPSRCS		= nsWindowsHooks.cpp nsWindowsHooksUtil.cpp
-
-REQUIRES	= \
-		  xpcom \
-		  string \
-		  dom \
-		  windowwatcher \
-		  intl \
-		  appshell \
-		  necko \
-		  layout \
-		  content \
-		  widget \
-		  imglib2 \
-		  gfx \
-		  thebes \
-		  locale \
-		  xulapp \
-		  embed_base \
-		  $(NULL)
-
-FORCE_STATIC_LIB = 1
-
-LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
-
-include $(topsrcdir)/config/rules.mk
-
-JS_SET_BROWSER_COMPONENT = nsSetDefaultBrowser.js
-JS_SET_MAIL_COMPONENT = nsSetDefaultMail.js
-JS_UNSET_MAIL_COMPONENT = nsUnsetDefaultMail.js
-
-libs::
-	$(INSTALL) $(srcdir)/$(JS_SET_BROWSER_COMPONENT) $(DIST)/bin/components
-	$(INSTALL) $(srcdir)/$(JS_SET_MAIL_COMPONENT) $(DIST)/bin/components
-	$(INSTALL) $(srcdir)/$(JS_UNSET_MAIL_COMPONENT) $(DIST)/bin/components
-
-clobber::
-	rm -f $(DIST)/lib/$(LIBRARY_NAME).lib
-	rm -f $(DIST)/bin/components/$(JS_SET_BROWSER_COMPONENT)
-	rm -f $(DIST)/bin/components/$(JS_SET_MAIL_COMPONENT)
-	rm -f $(DIST)/bin/components/$(JS_UNSET_MAIL_COMPONENT)
-
deleted file mode 100644
--- a/xpfe/components/winhooks/dummyWindow.xul
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.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 WinXP SP1 Support.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2002
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -   Bill Law  <law@netscape.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 LGPL or the GPL. 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 ***** -->
-
-<!-- This is a dummy window that autocloses.  See nsDefaultBrowser.js. -->
-
-<!DOCTYPE window>
-
-<window id="dummyWindow" onload="window.close()"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-</window>
deleted file mode 100644
--- a/xpfe/components/winhooks/jar.mn
+++ /dev/null
@@ -1,3 +0,0 @@
-
-toolkit.jar:
-    content/global/dummyWindow.xul (dummyWindow.xul)
deleted file mode 100644
--- a/xpfe/components/winhooks/locale/en-US/nsWindowsHooks.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-yesButtonLabel=Yes
-noButtonLabel=No
-cancelButtonLabel=Cancel
-checkBoxLabel=Check at startup next time, too.
-#LOCALIZATION NOTE (promptText): %S is brandShortName
-promptText=%S is not currently set as your default browser. Would you like to make it your default browser?
-prefsLabel=Pr&eferences
-#LOCALIZATION NOTE (wallpaperFile): %S is brandShortName
-wallpaperFile=%S Wallpaper
deleted file mode 100644
--- a/xpfe/components/winhooks/nsIWindowsHooks.idl
+++ /dev/null
@@ -1,216 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** 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):
- *   Bill Law       <law@netscape.com>
- *   Aaron Kaluszka <ask@swva.net>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "nsISupports.idl"
-
- 
-/* These interface provides support for integrating Mozilla into Windows.
- * This integration consists primarily of setting Mozilla as the "default
- * browser."  Or more precisely, setting Mozilla as the executable to
- * handle certain file types.
- *
- * There are two subtly different types of desktop objects that Mozilla
- * can be configured to "handle:"
- *      o File types (based on file extension)
- *      o Internet shortcuts (based on URL protocol).
- *
- * While these are different types of objects, the mechanism by which
- * applications are matched with them is essentially the same.
- *
- * In the case of files, there is one more level of indirection.  File
- * extensions are assigned a "file type" via a Windows registry entry.
- * For example, given the file extension ".foo", the file type is
- * determined by examing the value stored in the "default" value stored
- * at the registry key HKEY_LOCAL_MACHINE\Software\Classes\.foo.
- *
- * Once you have the "file type" then you use that the same way you use
- * Internet Shortcut protocol names to determine which application to
- * launch.  The application is specified by the default value stored in
- * the registry key
- * HKEY_LOCAL_MACHINE\Software\Classes\<X>\shell\open\command, where
- * <X> is the "file type" or protocol name.
- *
- * If there are additional keys under "shell" then these appear on the
- * context menu for files/shortcuts of this type.  Typically, there are
- * entries for "print."  But Mozilla does not currently support a command
- * line option to print so we don't offer that.
- *
- * Previously, Netscape Communicator made itself the handler of standard
- * web things by creating a new file type "NetscapeMarkup" and mapping
- * extensions to that (.htm, .html, .shtml, .xbm), or, by setting itself
- * up as the "handler" for the file types of other web things (.jpg, .gif)
- * and Internet Shortcut protocols (ftp, gopher, http, https, mailto, news,
- * snews).
- *
- * In order to better enable Mozilla to co-exist with other browsers
- * (including Communicator), it will create yet another new file type,
- * "MozillaMarkup," that will be used to make Mozilla the default handler
- * for certain file extensions.  This will be done by remapping those
- * extensions to this new type.
- *
- * Mozilla will attempt to remember the original mapping and restore it
- * when the user decides to no longer have Mozilla be the default handler
- * for that extension.
- *
- * Mozilla will drop support for some items that are no longer germane:
- * the .shtml file extension and the gopher: protocol.  We will also, perhaps
- * only temporarily, drop support for protocols that aren't accessible from
- * the command line: mailto:, news:, and snews:.
- *
- * We will be adding support for the chrome: protocol (using the "-chrome"
- * command line option) and for .png, .xul and .xml file extensions.
- *
- * Missing Features:
- *
- * Currently, there is no way to extend the set of file types or protocols
- * that Mozilla can be associated with (save manually tweaking the Windows
- * registry).  This is likely to be a problem for branded Mozilla browsers
- * that might support specialized file types or protocols (e.g., .aim files).
- *
- * The plan is to extend this interface so that such file types and protocols
- * can be set up using the implementation of the interfaces defined here.
- */
-
-interface nsIDOMWindowInternal;
-interface nsIDOMElement;
-
-/* nsIWindowsHooksSettings
- *
- * This interface is used to get/set the user preferences relating to
- * "windows hooks" (aka "windows integration").  It is basically just
- * a conglomeration of a bunch of boolean attributes; it exists mainly
- * for historical reasons (it corresponds to the internal Prefs struct
- * that was in nsIDefaultBrowser.h in Mozilla Classic).
- */
-[scriptable, uuid(d7a33e08-705e-4506-aba0-843c73dfd304)]
-interface nsIWindowsHooksSettings : nsISupports {
-
-    // Internet shortcuts (based on "protocol").
-    attribute boolean isHandlingHTTP;
-    attribute boolean isHandlingHTTPS;
-    attribute boolean isHandlingFTP;
-    attribute boolean isHandlingCHROME;
-    attribute boolean isHandlingGOPHER;
-
-    // File handling (based on extension).
-    attribute boolean isHandlingHTML;
-    attribute boolean isHandlingJPEG;
-    attribute boolean isHandlingGIF;
-    attribute boolean isHandlingPNG;
-    attribute boolean isHandlingXBM;
-    attribute boolean isHandlingBMP;
-    attribute boolean isHandlingICO;
-    attribute boolean isHandlingXML;
-    attribute boolean isHandlingXHTML;
-    attribute boolean isHandlingXUL;
-
-    // Nag dialog flag.  Set this so that dialog
-    // appears on startup if there is a mismatch
-    // between registry and these settings.
-    attribute boolean showDialog;
-
-    // Registry mismatch indicator.
-    // This is true if the Win32 registry is
-    // currently set to match the preferences
-    // in this object.
-    readonly attribute boolean registryMatches;
-};
-
-/* nsIWindowsHooks
- *
- * This interface describes the service that you can use to
- * get/set the various windows integration features specified
- * by the nsIWindowsHooksPrefs attributes.
- */
-[scriptable, uuid(19c9fbb0-06a3-11d4-8076-00600811a9c3)]
-interface nsIWindowsHooks : nsISupports {
-
-    // settings
-    // --------
-    // Get/set this to query or modify them.  The Windows
-    // registry is updated when you set this attribute.
-    attribute nsIWindowsHooksSettings settings;
-
-    // checkSettings
-    // -------------
-    // Check that registry matches settings and if not,
-    // prompt user for whether to reset.  This is
-    // controlled by the showDialog setting.  This will
-    // perform the check only the first time the
-    // service is called.
-    //   aParent - parent window for any dialogs that
-    //             will appear
-    //   Returns true if the windows integration dialog was shown
-    boolean checkSettings( in nsIDOMWindowInternal aParent );
-
-    /**
-     * Returns true if command is in the "(appname) QuickLaunch" value in the
-     * HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
-     * key.
-     */
-    boolean isOptionEnabled(in string option);
-
-    /**
-     * Adds the option to the "(appname) QuickLaunch" value to the key mentioned above,
-     * with data "(path\to\app.exe) option", if not done already.
-     */
-    void startupAddOption(in string option);
-
-    /**
-     * Removes the commnand from the "(appname) QuickLaunch" value from
-	 * the key mentioned above, if not done already. And deletes the
-	 * "(appname) QuickLaunch" value entirely if there are no options left
-     */
-    void startupRemoveOption(in string option);
-
-    /**
-     * Accepts an element, either an HTML img element or an element with
-     * a background image, serializes the image to a bitmap file
-     * in the windows directory, and sets it to be the desktop wallpaper.
-     */
-    void setImageAsWallpaper(in nsIDOMElement aImageElement, in boolean useBackground);
-};
-
-%{C++
-#define NS_IWINDOWSHOOKS_CONTRACTID    "@mozilla.org/winhooks;1"
-#define NS_IWINDOWSHOOKS_CLASSNAME "Mozilla Windows Integration Hooks"
-
-// The key that is used to write the quick launch appname in the windows registry
-#define NS_QUICKLAUNCH_RUN_KEY "Mozilla Quick Launch"
-%}
deleted file mode 100644
--- a/xpfe/components/winhooks/nsSetDefaultBrowser.js
+++ /dev/null
@@ -1,183 +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 Default Browser.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Bill Law  <law@netscape.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 ***** */
-
-/* This file implements the nsICmdLineHandler interface.  See nsICmdLineHandler.idl
- * at http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/public/nsICmdLineHandler.idl.
- *
- * This component handles the startup command line argument of the form:
- *   -setDefaultBrowser
- * by making the current executable the "default browser."  It accomplishes
- * that via use of the nsIWindowsHooks interface (see implementation below).
- *
- * The module is registered under the contractid
- *   "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultBrowser"
- *
- * The implementation consists of a JavaScript "class" named nsKillAll,
- * comprised of:
- *   - a JS constructor function
- *   - a prototype providing all the interface methods and implementation stuff
- *
- * In addition, this file implements an nsIModule object that registers the
- * nsSetDefaultBrowser component.
- */
-
-/* ctor
- */
-function nsSetDefaultBrowser() {
-}
-
-nsSetDefaultBrowser.prototype = {
-
-    // nsICmdLineHandler interface
-    get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get prefNameForStartup()  { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-
-    get chromeUrlForTask()    {
-      // First, get winhooks service.
-      var winHooks = Components.classes[ "@mozilla.org/winhooks;1" ]
-                        .getService( Components.interfaces.nsIWindowsHooks );
-
-      // Next, extract current settings (these are what the user
-      // had previously checked on the Advanced/System pref panel).
-      var settings = winHooks.settings;
-
-      // Now, turn on all "default browser" settings.
-      settings.isHandlingHTTP  = true;
-      settings.isHandlingHTTPS = true;
-      settings.isHandlingFTP   = true;
-      settings.isHandlingHTML  = true;
-      settings.isHandlingXHTML = true;
-      settings.isHandlingXML   = true;
-
-      // Finally, apply the (new) settings.
-      winHooks.settings = settings;
-
-      // Now, get the cmd line service.
-      var cmdLineService = Components.classes[ "@mozilla.org/app-startup/commandLineService;1" ]
-                              .getService( Components.interfaces.nsICmdLineService );
-
-      // See if "-setDefaultBrowser" was specified.  The value will be "1" if
-      // -setDefaultBrowser is in the service's list of cmd line arguments, and
-      // null otherwise.  -setDefaultBrowser will only be in the service's
-      // arg list if the application was not already running.  That's because
-      // if it was already running, then the service reflects the arguments
-      // that were specified when *that* process was started, *not* the ones
-      // passed via IPC from the second instance.
-      var option = cmdLineService.getCmdLineValue( "-setDefaultBrowser" );
-      if (!option) {
-        // Already running, so we don't have to worry about opening
-        // another window, etc.
-        throw Components.results.NS_ERROR_NOT_AVAILABLE;
-      }
-
-      // Return URL for dummy window that will auto-close.  We do this rather
-      // than throw NS_ERROR_NOT_AVAILABLE, which *should* work, because it
-      // seems that if we don't open a window, we get a crash when trying to
-      // release this (or some other) JS component during XPCOM shutdown.
-      return "chrome://global/content/dummyWindow.xul";
-    },
-
-    get helpText()            { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get handlesArgs()         { return false; },
-    get defaultArgs()         { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get openWindowWithArgs()  { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-
-    // nsISupports interface
-
-    // This "class" supports nsICmdLineHandler and nsISupports.
-    QueryInterface: function (iid) {
-        if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
-            iid.equals(Components.interfaces.nsISupports))
-            return this;
-
-        Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
-        return null;
-    },
-
-    // This Component's module implementation.  All the code below is used to get this
-    // component registered and accessible via XPCOM.
-    module: {
-        // registerSelf: Register this component.
-        registerSelf: function (compMgr, fileSpec, location, type) {
-            var compReg = compMgr.QueryInterface( Components.interfaces.nsIComponentRegistrar );
-            compReg.registerFactoryLocation( this.cid,
-                                             "Default Browser Component",
-                                             this.contractId,
-                                             fileSpec,
-                                             location,
-                                             type );
-        },
-
-        // getClassObject: Return this component's factory object.
-        getClassObject: function (compMgr, cid, iid) {
-            if (!cid.equals(this.cid))
-                throw Components.results.NS_ERROR_NO_INTERFACE;
-
-            if (!iid.equals(Components.interfaces.nsIFactory))
-                throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
-            return this.factory;
-        },
-
-        /* CID for this class */
-        cid: Components.ID("{C66E05DC-509C-4972-A1F2-EE5AC34B9800}"),
-
-        /* Contract ID for this class */
-        contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultBrowser",
-
-        /* factory object */
-        factory: {
-            // createInstance: Return a new nsSetDefaultBrowser object.
-            createInstance: function (outer, iid) {
-                if (outer != null)
-                    throw Components.results.NS_ERROR_NO_AGGREGATION;
-
-                return (new nsSetDefaultBrowser()).QueryInterface(iid);
-            }
-        },
-
-        // canUnload: n/a (returns true)
-        canUnload: function(compMgr) {
-            return true;
-        }
-    }
-}
-
-// NSGetModule: Return the nsIModule object.
-function NSGetModule(compMgr, fileSpec) {
-    return nsSetDefaultBrowser.prototype.module;
-}
deleted file mode 100644
--- a/xpfe/components/winhooks/nsSetDefaultMail.js
+++ /dev/null
@@ -1,184 +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 Set Default Mail.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Bill Law  <law@netscape.com>
- *   Sean Su <ssu@netscape.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 ***** */
-
-/* This file implements the nsICmdLineHandler interface.  See nsICmdLineHandler.idl
- * at http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/public/nsICmdLineHandler.idl.
- *
- * This component handles the startup command line argument of the form:
- *   -setDefaultMail
- * by making the current executable the "default mail client."
- *
- * The module is registered under the contractid
- *   "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultMail"
- *
- * The implementation consists of a JavaScript "class" named nsSetDefaultMail,
- * comprised of:
- *   - a JS constructor function
- *   - a prototype providing all the interface methods and implementation stuff
- *
- * In addition, this file implements an nsIModule object that registers the
- * nsSetDefaultMail component.
- */
-
-/* ctor
- */
-function nsSetDefaultMail() {
-}
-
-nsSetDefaultMail.prototype = {
-
-    // nsICmdLineHandler interface
-    get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get prefNameForStartup()  { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-
-    get chromeUrlForTask()    {
-
-      var mapiRegistry;
-      try {
-          var mapiRegistryProgID = "@mozilla.org/mapiregistry;1"
-          // make sure mail is installed
-          if (mapiRegistryProgID in Components.classes) {
-            mapiRegistry = Components.classes[mapiRegistryProgID].getService(Components.interfaces.nsIMapiRegistry);
-          }
-          else {
-            mapiRegistry = null;
-          }
-      }
-      catch (ex) {
-          mapiRegistry = null;
-      }
-
-      // Set mailnews as the default mail handler here
-      if(mapiRegistry)
-          mapiRegistry.isDefaultMailClient = true;
-
-      // Now, get the cmd line service.
-      var cmdLineService = Components.classes[ "@mozilla.org/app-startup/commandLineService;1" ]
-                              .getService( Components.interfaces.nsICmdLineService );
-
-      // See if "-setDefaultMail" was specified.  The value will be "1" if
-      // -setDefaultMail is in the service's list of cmd line arguments, and
-      // null otherwise.  -setDefaultMail will only be in the service's
-      // arg list if the application was not already running.  That's because
-      // if it was already running, then the service reflects the arguments
-      // that were specified when *that* process was started, *not* the ones
-      // passed via IPC from the second instance.
-      var option = cmdLineService.getCmdLineValue( "-setDefaultMail" );
-      if (!option) {
-        // Already running, so we don't have to worry about opening
-        // another window, etc.
-        throw Components.results.NS_ERROR_NOT_AVAILABLE;
-      }
-
-      // Return URL for dummy window that will auto-close.  We do this rather
-      // than throw NS_ERROR_NOT_AVAILABLE, which *should* work, because it
-      // seems that if we don't open a window, we get a crash when trying to
-      // release this (or some other) JS component during XPCOM shutdown.
-      return "chrome://global/content/dummyWindow.xul";
-    },
-
-    get helpText()            { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get handlesArgs()         { return false; },
-    get defaultArgs()         { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get openWindowWithArgs()  { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-
-    // nsISupports interface
-
-    // This "class" supports nsICmdLineHandler and nsISupports.
-    QueryInterface: function (iid) {
-        if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
-            iid.equals(Components.interfaces.nsISupports))
-            return this;
-
-        Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
-        return null;
-    },
-
-    // This Component's module implementation.  All the code below is used to get this
-    // component registered and accessible via XPCOM.
-    module: {
-        // registerSelf: Register this component.
-        registerSelf: function (compMgr, fileSpec, location, type) {
-            var compReg = compMgr.QueryInterface( Components.interfaces.nsIComponentRegistrar );
-            compReg.registerFactoryLocation( this.cid,
-                                             "Set Mailnews as Default mail handler",
-                                             this.contractId,
-                                             fileSpec,
-                                             location,
-                                             type );
-        },
-
-        // getClassObject: Return this component's factory object.
-        getClassObject: function (compMgr, cid, iid) {
-            if (!cid.equals(this.cid))
-                throw Components.results.NS_ERROR_NO_INTERFACE;
-
-            if (!iid.equals(Components.interfaces.nsIFactory))
-                throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
-            return this.factory;
-        },
-
-        /* CID for this class */
-        cid: Components.ID("{8b26281d-c3b2-4b57-9653-419fc705a02d}"),
-
-        /* Contract ID for this class */
-        contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultMail",
-
-        /* factory object */
-        factory: {
-            // createInstance: Return a new nsSetDefaultMail object.
-            createInstance: function (outer, iid) {
-                if (outer != null)
-                    throw Components.results.NS_ERROR_NO_AGGREGATION;
-
-                return (new nsSetDefaultMail()).QueryInterface(iid);
-            }
-        },
-
-        // canUnload: n/a (returns true)
-        canUnload: function(compMgr) {
-            return true;
-        }
-    }
-}
-
-// NSGetModule: Return the nsIModule object.
-function NSGetModule(compMgr, fileSpec) {
-    return nsSetDefaultMail.prototype.module;
-}
deleted file mode 100644
--- a/xpfe/components/winhooks/nsUnsetDefaultMail.js
+++ /dev/null
@@ -1,184 +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 Unset Default Mail.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Bill Law  <law@netscape.com>
- *   Sean Su <ssu@netscape.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 ***** */
-
-/* This file implements the nsICmdLineHandler interface.  See nsICmdLineHandler.idl
- * at http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/public/nsICmdLineHandler.idl.
- *
- * This component handles the startup command line argument of the form:
- *   -unsetDefaultMail
- * by making the current executable the "default mail client."
- *
- * The module is registered under the contractid
- *   "@mozilla.org/commandlinehandler/general-startup;1?type=unsetDefaultMail"
- *
- * The implementation consists of a JavaScript "class" named nsUnsetDefaultMail,
- * comprised of:
- *   - a JS constructor function
- *   - a prototype providing all the interface methods and implementation stuff
- *
- * In addition, this file implements an nsIModule object that registers the
- * nsUnsetDefaultMail component.
- */
-
-/* ctor
- */
-function nsUnsetDefaultMail() {
-}
-
-nsUnsetDefaultMail.prototype = {
-
-    // nsICmdLineHandler interface
-    get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get prefNameForStartup()  { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-
-    get chromeUrlForTask()    {
-
-      var mapiRegistry;
-      try {
-          var mapiRegistryProgID = "@mozilla.org/mapiregistry;1"
-          // make sure mail is installed
-          if (mapiRegistryProgID in Components.classes) {
-            mapiRegistry = Components.classes[mapiRegistryProgID].getService(Components.interfaces.nsIMapiRegistry);
-          }
-          else {
-            mapiRegistry = null;
-          }
-      }
-      catch (ex) {
-          mapiRegistry = null;
-      }
-
-      // Restore the previous app that was the default mail handler
-      if(mapiRegistry)
-          mapiRegistry.isDefaultMailClient = false;
-
-      // Now, get the cmd line service.
-      var cmdLineService = Components.classes[ "@mozilla.org/app-startup/commandLineService;1" ]
-                              .getService( Components.interfaces.nsICmdLineService );
-
-      // See if "-unsetDefaultMail" was specified.  The value will be "1" if
-      // -unsetDefaultMail is in the service's list of cmd line arguments, and
-      // null otherwise.  -unsetDefaultMail will only be in the service's
-      // arg list if the application was not already running.  That's because
-      // if it was already running, then the service reflects the arguments
-      // that were specified when *that* process was started, *not* the ones
-      // passed via IPC from the second instance.
-      var option = cmdLineService.getCmdLineValue( "-unsetDefaultMail" );
-      if (!option) {
-        // Already running, so we don't have to worry about opening
-        // another window, etc.
-        throw Components.results.NS_ERROR_NOT_AVAILABLE;
-      }
-
-      // Return URL for dummy window that will auto-close.  We do this rather
-      // than throw NS_ERROR_NOT_AVAILABLE, which *should* work, because it
-      // seems that if we don't open a window, we get a crash when trying to
-      // release this (or some other) JS component during XPCOM shutdown.
-      return "chrome://global/content/dummyWindow.xul";
-    },
-
-    get helpText()            { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get handlesArgs()         { return false; },
-    get defaultArgs()         { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-    get openWindowWithArgs()  { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
-
-    // nsISupports interface
-
-    // This "class" supports nsICmdLineHandler and nsISupports.
-    QueryInterface: function (iid) {
-        if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
-            iid.equals(Components.interfaces.nsISupports))
-            return this;
-
-        Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
-        return null;
-    },
-
-    // This Component's module implementation.  All the code below is used to get this
-    // component registered and accessible via XPCOM.
-    module: {
-        // registerSelf: Register this component.
-        registerSelf: function (compMgr, fileSpec, location, type) {
-            var compReg = compMgr.QueryInterface( Components.interfaces.nsIComponentRegistrar );
-            compReg.registerFactoryLocation( this.cid,
-                                             "Unset Mailnews as Default mail handler",
-                                             this.contractId,
-                                             fileSpec,
-                                             location,
-                                             type );
-        },
-
-        // getClassObject: Return this component's factory object.
-        getClassObject: function (compMgr, cid, iid) {
-            if (!cid.equals(this.cid))
-                throw Components.results.NS_ERROR_NO_INTERFACE;
-
-            if (!iid.equals(Components.interfaces.nsIFactory))
-                throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
-            return this.factory;
-        },
-
-        /* CID for this class */
-        cid: Components.ID("{ae9c026a-3bb4-485f-bab8-d7142f336ec1}"),
-
-        /* Contract ID for this class */
-        contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=unsetDefaultMail",
-
-        /* factory object */
-        factory: {
-            // createInstance: Return a new nsUnsetDefaultMail object.
-            createInstance: function (outer, iid) {
-                if (outer != null)
-                    throw Components.results.NS_ERROR_NO_AGGREGATION;
-
-                return (new nsUnsetDefaultMail()).QueryInterface(iid);
-            }
-        },
-
-        // canUnload: n/a (returns true)
-        canUnload: function(compMgr) {
-            return true;
-        }
-    }
-}
-
-// NSGetModule: Return the nsIModule object.
-function NSGetModule(compMgr, fileSpec) {
-    return nsUnsetDefaultMail.prototype.module;
-}
deleted file mode 100644
--- a/xpfe/components/winhooks/nsWindowsHooks.cpp
+++ /dev/null
@@ -1,988 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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):
- *   Bill Law       <law@netscape.com>
- *   Syd Logan      <syd@netscape.com> added turbo mode stuff
- *   Joe Elwell     <jelwell@netscape.com>
- *   Håkan Waara    <hwaara@chello.se>
- *   Aaron Kaluszka <ask@swva.net>
- *   Jeremy Morton  <jez9999@runbox.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 MAX_BUF
-#define MAX_BUF 4096
-#endif
-
-// Implementation utilities.
-#include "nsIDOMWindowInternal.h"
-#include "nsIServiceManager.h"
-#include "nsIPromptService.h"
-#include "nsIStringBundle.h"
-#include "nsIAllocator.h"
-#include "nsXPIDLString.h"
-#include "nsString.h"
-#include "nsMemory.h"
-#include "nsNetUtil.h"
-#include "nsWindowsHooks.h"
-#include <windows.h>
-#include <shlobj.h>
-#include <shlguid.h>
-
-// for set as wallpaper
-#include "nsIDocument.h"
-#include "nsIContent.h"
-#include "nsIDOMElement.h"
-#include "nsIDOMDocument.h"
-#include "nsIFrame.h"
-#include "nsIPresShell.h"
-#include "nsIImageLoadingContent.h"
-#include "imgIRequest.h"
-#include "imgIContainer.h"
-#include "gfxIImageFrame.h"
-#include "nsDirectoryServiceUtils.h"
-#include "nsAppDirectoryServiceDefs.h"
-
-#ifndef MOZ_XUL_APP
-#include "nsICmdLineService.h"
-#endif
-
-#include "nsXPFEComponentsCID.h"
-#include "nsEmbedCID.h"
-
-#define RUNKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
-
-static nsWindowsHooks *gWindowsHooks = nsnull;
-
-// Implementation of the nsIWindowsHooksSettings interface.
-// Use standard implementation of nsISupports stuff.
-NS_IMPL_ISUPPORTS1( nsWindowsHooksSettings, nsIWindowsHooksSettings )
-
-nsWindowsHooksSettings::nsWindowsHooksSettings() {
-}
-
-nsWindowsHooksSettings::~nsWindowsHooksSettings() {
-}
-
-// Generic getter.
-NS_IMETHODIMP
-nsWindowsHooksSettings::Get( PRBool *result, PRBool nsWindowsHooksSettings::*member ) {
-    NS_ENSURE_ARG( result );
-    NS_ENSURE_ARG( member );
-    *result = this->*member;
-    return NS_OK;
-}
-
-// Generic setter.
-NS_IMETHODIMP
-nsWindowsHooksSettings::Set( PRBool value, PRBool nsWindowsHooksSettings::*member ) {
-    NS_ENSURE_ARG( member );
-    this->*member = value;
-    return NS_OK;
-}
-
-// Macros to define specific getter/setter methods.
-#define DEFINE_GETTER_AND_SETTER( attr, member ) \
-NS_IMETHODIMP \
-nsWindowsHooksSettings::Get##attr ( PRBool *result ) { \
-    return this->Get( result, &nsWindowsHooksSettings::member ); \
-} \
-NS_IMETHODIMP \
-nsWindowsHooksSettings::Set##attr ( PRBool value ) { \
-    return this->Set( value, &nsWindowsHooksSettings::member ); \
-}
-
-// Define all the getter/setter methods:
-DEFINE_GETTER_AND_SETTER( IsHandlingHTML,   mHandleHTML   )
-DEFINE_GETTER_AND_SETTER( IsHandlingJPEG,   mHandleJPEG   )
-DEFINE_GETTER_AND_SETTER( IsHandlingGIF,    mHandleGIF    )
-DEFINE_GETTER_AND_SETTER( IsHandlingPNG,    mHandlePNG    )
-DEFINE_GETTER_AND_SETTER( IsHandlingXBM,    mHandleXBM    )
-DEFINE_GETTER_AND_SETTER( IsHandlingBMP,    mHandleBMP    )
-DEFINE_GETTER_AND_SETTER( IsHandlingICO,    mHandleICO    )
-DEFINE_GETTER_AND_SETTER( IsHandlingXML,    mHandleXML    )
-DEFINE_GETTER_AND_SETTER( IsHandlingXHTML,  mHandleXHTML  )
-DEFINE_GETTER_AND_SETTER( IsHandlingXUL,    mHandleXUL    )
-DEFINE_GETTER_AND_SETTER( IsHandlingHTTP,   mHandleHTTP   )
-DEFINE_GETTER_AND_SETTER( IsHandlingHTTPS,  mHandleHTTPS  )
-DEFINE_GETTER_AND_SETTER( IsHandlingFTP,    mHandleFTP    )
-DEFINE_GETTER_AND_SETTER( IsHandlingCHROME, mHandleCHROME )
-DEFINE_GETTER_AND_SETTER( IsHandlingGOPHER, mHandleGOPHER )
-DEFINE_GETTER_AND_SETTER( ShowDialog,       mShowDialog   )
-DEFINE_GETTER_AND_SETTER( HaveBeenSet,      mHaveBeenSet  )
-
-
-// Implementation of the nsIWindowsHooks interface.
-// Use standard implementation of nsISupports stuff.
-NS_IMPL_ISUPPORTS1( nsWindowsHooks, nsIWindowsHooks )
-
-static const char *jpgExts[]  = { ".jpg", ".jpe", ".jpeg", ".jfif", ".pjpeg", ".pjp", 0 };
-static const char *gifExts[]  = { ".gif", 0 };
-static const char *pngExts[]  = { ".png", 0 };
-static const char *xbmExts[]  = { ".xbm", 0 };
-static const char *bmpExts[]  = { ".bmp", ".rle", ".dib", 0 };
-static const char *icoExts[]  = { ".ico", 0 };
-static const char *xmlExts[]  = { ".xml", 0 };
-static const char *xhtmExts[] = { ".xht", ".xhtml", 0 };
-static const char *xulExts[]  = { ".xul", 0 };
-static const char *htmExts[]  = { ".htm", ".html", ".shtml", 0 };
-
-nsWindowsHooks::nsWindowsHooks()
-  : http( "http" ),
-    https( "https" ),
-    ftp( "ftp" ),
-    chrome( "chrome" ),
-    gopher( "gopher" ),
-
-    jpg(   jpgExts,  "MozillaJPEG",  "JPEG Image",           "jpegfile", "jpeg-file.ico"),
-    gif(   gifExts,  "MozillaGIF",   "GIF Image",            "giffile",  "gif-file.ico"),
-    png(   pngExts,  "MozillaPNG",   "PNG Image",            "pngfile",  "image-file.ico"),
-    xbm(   xbmExts,  "MozillaXBM",   "XBM Image",            "xbmfile",  "image-file.ico"),
-    bmp(   bmpExts,  "MozillaBMP",   "BMP Image",            "",         "image-file.ico"),
-    ico(   icoExts,  "MozillaICO",   "Icon",                 "icofile",  "%1"),
-    xml(   xmlExts,  "MozillaXML",   "XML Document",         "xmlfile",  "xml-file.ico"),
-    xhtml( xhtmExts, "MozillaXHTML", "XHTML Document",       "",         "misc-file.ico"),
-    xul(   xulExts,  "MozillaXUL",   "Mozilla XUL Document", "",         "xul-file.ico"),
-
-    mozillaMarkup( htmExts, "MozillaHTML", "HTML Document", "htmlfile",  "html-file.ico")
-{
-    gWindowsHooks = this;
-}
-
-nsWindowsHooks::~nsWindowsHooks() {
-    gWindowsHooks = nsnull;
-}
-
-// Internal GetPreferences.
-NS_IMETHODIMP
-nsWindowsHooks::GetSettings( nsWindowsHooksSettings **result ) {
-    nsresult rv = NS_OK;
-
-    // Validate input arg.
-    NS_ENSURE_ARG( result );
-
-    // Allocate prefs object.
-    nsWindowsHooksSettings *prefs = *result = new nsWindowsHooksSettings;
-    NS_ENSURE_TRUE( prefs, NS_ERROR_OUT_OF_MEMORY );
-
-    // Got it, increment ref count.
-    NS_ADDREF( prefs );
-
-    // Get each registry value and copy to prefs structure.
-    prefs->mHandleHTTP   = BoolRegistryEntry( "isHandlingHTTP"   );
-    prefs->mHandleHTTPS  = BoolRegistryEntry( "isHandlingHTTPS"  );
-    prefs->mHandleFTP    = BoolRegistryEntry( "isHandlingFTP"    );
-    prefs->mHandleCHROME = BoolRegistryEntry( "isHandlingCHROME" );
-    prefs->mHandleGOPHER = BoolRegistryEntry( "isHandlingGOPHER" );
-    prefs->mHandleHTML   = BoolRegistryEntry( "isHandlingHTML"   );
-    prefs->mHandleJPEG   = BoolRegistryEntry( "isHandlingJPEG"   );
-    prefs->mHandleGIF    = BoolRegistryEntry( "isHandlingGIF"    );
-    prefs->mHandlePNG    = BoolRegistryEntry( "isHandlingPNG"    );
-    prefs->mHandleXBM    = BoolRegistryEntry( "isHandlingXBM"    );
-    prefs->mHandleBMP    = BoolRegistryEntry( "isHandlingBMP"    );
-    prefs->mHandleICO    = BoolRegistryEntry( "isHandlingICO"    );
-    prefs->mHandleXML    = BoolRegistryEntry( "isHandlingXML"    );
-    prefs->mHandleXHTML  = BoolRegistryEntry( "isHandlingXHTML"  );
-    prefs->mHandleXUL    = BoolRegistryEntry( "isHandlingXUL"    );
-    prefs->mShowDialog   = BoolRegistryEntry( "showDialog"       );
-    prefs->mHaveBeenSet  = BoolRegistryEntry( "haveBeenSet"      );
-
-#ifdef DEBUG_law
-NS_ASSERTION( NS_SUCCEEDED( rv ), "GetPreferences failed" );
-#endif
-
-    return rv;
-}
-
-// Public interface uses internal plus a QI to get to the proper result.
-NS_IMETHODIMP
-nsWindowsHooks::GetSettings( nsIWindowsHooksSettings **_retval ) {
-    // Allocate prefs object.
-    nsWindowsHooksSettings *prefs;
-    nsresult rv = this->GetSettings( &prefs );
-
-    if ( NS_SUCCEEDED( rv ) ) {
-        // QI to proper interface.
-        rv = prefs->QueryInterface( NS_GET_IID( nsIWindowsHooksSettings ), (void**)_retval );
-        // Release (to undo our Get...).
-        NS_RELEASE( prefs );
-    }
-
-    return rv;
-}
-
-static PRBool misMatch( const PRBool &flag, const ProtocolRegistryEntry &entry ) {
-    PRBool result = PR_FALSE;
-    // Check if we care.
-    if ( flag ) { 
-        // Compare registry entry setting to what it *should* be.
-        if ( entry.currentSetting() != entry.setting ) {
-            result = PR_TRUE;
-        }
-    }
-
-    return result;
-}
-
-// isAccessRestricted - Returns PR_TRUE iff this user only has restricted access
-// to the registry keys we need to modify.
-static PRBool isAccessRestricted() {
-    char   subKey[] = "Software\\Mozilla - Test Key";
-    PRBool result = PR_FALSE;
-    DWORD  dwDisp = 0;
-    HKEY   key;
-    // Try to create/open a subkey under HKLM.
-    DWORD rc = ::RegCreateKeyEx( HKEY_LOCAL_MACHINE,
-                                 subKey,
-                                 0,
-                                 NULL,
-                                 REG_OPTION_NON_VOLATILE,
-                                 KEY_WRITE,
-                                 NULL,
-                                 &key,
-                                 &dwDisp );
-
-    if ( rc == ERROR_SUCCESS ) {
-        // Key was opened; first close it.
-        ::RegCloseKey( key );
-        // Delete it if we just created it.
-        switch( dwDisp ) {
-            case REG_CREATED_NEW_KEY:
-                ::RegDeleteKey( HKEY_LOCAL_MACHINE, subKey );
-                break;
-            case REG_OPENED_EXISTING_KEY:
-                break;
-        }
-    } else {
-        // Can't create/open it; we don't have access.
-        result = PR_TRUE;
-    }
-
-    return result;
-}
-
-
-
-// Implementation of method that checks whether the settings match what's in the
-// Windows registry.
-NS_IMETHODIMP
-nsWindowsHooksSettings::GetRegistryMatches( PRBool *_retval ) {
-    NS_ENSURE_ARG( _retval );
-    *_retval = PR_TRUE;
-    // Test registry for all selected attributes.
-    if ( misMatch( mHandleHTTP,   gWindowsHooks->http )
-         ||
-         misMatch( mHandleHTTPS,  gWindowsHooks->https )
-         ||
-         misMatch( mHandleFTP,    gWindowsHooks->ftp )
-         ||
-         misMatch( mHandleCHROME, gWindowsHooks->chrome )
-         ||
-         misMatch( mHandleGOPHER, gWindowsHooks->gopher )
-         ||
-         misMatch( mHandleHTML,   gWindowsHooks->mozillaMarkup )
-         ||
-         misMatch( mHandleJPEG,   gWindowsHooks->jpg )
-         ||
-         misMatch( mHandleGIF,    gWindowsHooks->gif )
-         ||
-         misMatch( mHandlePNG,    gWindowsHooks->png )
-         ||
-         misMatch( mHandleXBM,    gWindowsHooks->xbm )
-         ||
-         misMatch( mHandleBMP,    gWindowsHooks->bmp )
-         ||
-         misMatch( mHandleICO,    gWindowsHooks->ico )
-         ||
-         misMatch( mHandleXML,    gWindowsHooks->xml )
-         ||
-         misMatch( mHandleXHTML,  gWindowsHooks->xhtml )
-         ||
-         misMatch( mHandleXUL,    gWindowsHooks->xul ) ) {
-        // Registry is out of synch.
-        *_retval = PR_FALSE;
-    }
-    return NS_OK;
-}
-
-// Implementation of method that checks settings versus registry and prompts user
-// if out of synch.
-NS_IMETHODIMP
-nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent, 
-                               PRBool *_retval ) {
-    nsresult rv = NS_OK;
-    *_retval = PR_FALSE;
-
-    // Only do this once!
-    static PRBool alreadyChecked = PR_FALSE;
-    if ( alreadyChecked ) {
-        return NS_OK;
-    } else {
-        alreadyChecked = PR_TRUE;
-        // Don't check further if we don't have sufficient access.
-        if ( isAccessRestricted() ) {
-            return NS_OK;
-        }
-    }
-
-    // Get settings.
-    nsWindowsHooksSettings *settings;
-    rv = this->GetSettings( &settings );
-
-    if ( NS_SUCCEEDED( rv ) && settings ) {
-        // If not set previously, set to defaults so that they are
-        // set properly when/if the user says to.
-        if ( !settings->mHaveBeenSet ) {
-            settings->mHandleHTTP   = PR_TRUE;
-            settings->mHandleHTTPS  = PR_TRUE;
-            settings->mHandleFTP    = PR_TRUE;
-            settings->mHandleCHROME = PR_TRUE;
-            settings->mHandleGOPHER = PR_TRUE;
-            settings->mHandleHTML   = PR_TRUE;
-            settings->mHandleJPEG   = PR_FALSE;
-            settings->mHandleGIF    = PR_FALSE;
-            settings->mHandlePNG    = PR_FALSE;
-            settings->mHandleXBM    = PR_FALSE;
-            settings->mHandleBMP    = PR_FALSE;
-            settings->mHandleICO    = PR_FALSE;
-            settings->mHandleXML    = PR_TRUE;
-            settings->mHandleXHTML  = PR_TRUE;
-            settings->mHandleXUL    = PR_TRUE;
-
-            settings->mShowDialog   = PR_TRUE;
-        }
-
-        // If launched with "-installer" then override mShowDialog.
-        PRBool installing = PR_FALSE;
-#ifndef MOZ_XUL_APP
-        if ( !settings->mShowDialog ) {
-            // Get command line service.
-            nsCOMPtr<nsICmdLineService> cmdLineArgs
-              (do_GetService(NS_COMMANDLINESERVICE_CONTRACTID, &rv));
-            if ( NS_SUCCEEDED( rv ) && cmdLineArgs ) {
-                // See if "-installer" was specified.
-                nsXPIDLCString installer;
-                rv = cmdLineArgs->GetCmdLineValue( "-installer", getter_Copies( installer ) );
-                if ( NS_SUCCEEDED( rv ) && installer ) {
-                    installing = PR_TRUE;
-                }
-            }
-        }
-#endif
-
-        // First, make sure the user cares.
-        if ( settings->mShowDialog || installing ) {
-            // Look at registry setting for all things that are set.
-            PRBool matches = PR_TRUE;
-            settings->GetRegistryMatches( &matches );
-            if ( !matches ) {
-                // Need to prompt user.
-                // First:
-                //   o We need the common dialog service to show the dialog.
-                //   o We need the string bundle service to fetch the appropriate
-                //     dialog text.
-                nsCOMPtr<nsIPromptService> promptService( do_GetService(NS_PROMPTSERVICE_CONTRACTID));
-                nsCOMPtr<nsIStringBundleService> bundleService( do_GetService( NS_STRINGBUNDLE_CONTRACTID, &rv ) );
-
-                if ( promptService && bundleService ) {
-                    // Next, get bundle that provides text for dialog.
-                    nsCOMPtr<nsIStringBundle> bundle;
-                    nsCOMPtr<nsIStringBundle> brandBundle;
-                    rv = bundleService->CreateBundle( "chrome://global-platform/locale/nsWindowsHooks.properties",
-                                                      getter_AddRefs( bundle ) );
-                    rv = bundleService->CreateBundle( "chrome://branding/locale/brand.properties",
-                                                      getter_AddRefs( brandBundle ) );
-                    if ( NS_SUCCEEDED( rv ) && bundle && brandBundle ) {
-                        nsXPIDLString text, label, shortName;
-                        if ( NS_SUCCEEDED( ( rv = brandBundle->GetStringFromName( NS_LITERAL_STRING( "brandShortName" ).get(), 
-                                             getter_Copies( shortName ) ) ) ) ) {
-                            const PRUnichar* formatStrings[] = { shortName.get() };
-                            if ( NS_SUCCEEDED( ( rv = bundle->FormatStringFromName( NS_LITERAL_STRING( "promptText" ).get(), 
-                                                  formatStrings, 1, getter_Copies( text ) ) ) )
-                                  &&
-                                  NS_SUCCEEDED( ( rv = bundle->GetStringFromName( NS_LITERAL_STRING( "checkBoxLabel" ).get(),
-                                                                                  getter_Copies( label ) ) ) ) ) {
-                                // Got the text, now show dialog.
-                                PRBool  showDialog = settings->mShowDialog;
-                                PRInt32 dlgResult  = -1;
-                                // No checkbox for initial display.
-                                const PRUnichar *labelArg = 0;
-                                if ( settings->mHaveBeenSet ) {
-                                    // Subsequent display uses label string.
-                                    labelArg = label;
-                                }
-                                // Note that the buttons need to be passed in this order:
-                                //    o Yes
-                                //    o Cancel
-                                //    o No
-                                rv = promptService->ConfirmEx(aParent, shortName, text,
-                                                              (nsIPromptService::BUTTON_TITLE_YES * nsIPromptService::BUTTON_POS_0) +
-                                                              (nsIPromptService::BUTTON_TITLE_CANCEL * nsIPromptService::BUTTON_POS_1) +
-                                                              (nsIPromptService::BUTTON_TITLE_NO * nsIPromptService::BUTTON_POS_2),
-                                                              nsnull, nsnull, nsnull, labelArg, &showDialog, &dlgResult);
-                                
-                                if ( NS_SUCCEEDED( rv ) ) {
-                                    // Dialog was shown
-                                    *_retval = PR_TRUE; 
-
-                                    // Did they say go ahead?
-                                    switch ( dlgResult ) {
-                                        case 0:
-                                            // User says: make the changes.
-                                            // Remember "show dialog" choice.
-                                            settings->mShowDialog = showDialog;
-                                            // Apply settings; this single line of
-                                            // code will do different things depending
-                                            // on whether this is the first time (i.e.,
-                                            // when "haveBeenSet" is false).  The first
-                                            // time, this will set all prefs to true
-                                            // (because that's how we initialized 'em
-                                            // in GetSettings, above) and will update the
-                                            // registry accordingly.  On subsequent passes,
-                                            // this will only update the registry (because
-                                            // the settings we got from GetSettings will
-                                            // not have changed).
-                                            //
-                                            // BTW, the term "prefs" in this context does not
-                                            // refer to conventional Mozilla "prefs."  Instead,
-                                            // it refers to "Desktop Integration" prefs which
-                                            // are stored in the windows registry.
-                                            rv = SetSettings( settings );
-                                            #ifdef DEBUG_law
-                                                printf( "Yes, SetSettings returned 0x%08X\n", (int)rv );
-                                            #endif
-                                            break;
-
-                                        case 2:
-                                            // User says: Don't mess with Windows.
-                                            // We update only the "showDialog" and
-                                            // "haveBeenSet" keys.  Note that this will
-                                            // have the effect of setting all the prefs
-                                            // *off* if the user says no to the initial
-                                            // prompt.
-                                            BoolRegistryEntry( "haveBeenSet" ).set();
-                                            if ( showDialog ) {
-                                                BoolRegistryEntry( "showDialog" ).set();
-                                            } else {
-                                                BoolRegistryEntry( "showDialog" ).reset();
-                                            }
-                                            #ifdef DEBUG_law
-                                                printf( "No, haveBeenSet=1 and showDialog=%d\n", (int)showDialog );
-                                            #endif
-                                            break;
-
-                                        default:
-                                            // User says: I dunno.  Make no changes (which
-                                            // should produce the same dialog next time).
-                                            #ifdef DEBUG_law
-                                                printf( "Cancel\n" );
-                                            #endif
-                                            break;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            #ifdef DEBUG_law
-            else { printf( "Registry and prefs match\n" ); }
-            #endif
-        }
-        #ifdef DEBUG_law
-        else { printf( "showDialog is false and not installing\n" ); }
-        #endif
-
-        // Release the settings.
-        settings->Release();
-    }
-
-    return rv;
-}
-
-// Utility to set PRBool registry value from getter method.
-nsresult putPRBoolIntoRegistry( const char* valueName,
-                                nsIWindowsHooksSettings *prefs,
-                                nsWindowsHooksSettings::getter memFun ) {
-    // Use getter method to extract attribute from prefs.
-    PRBool boolValue;
-    (void)(prefs->*memFun)( &boolValue );
-    // Convert to DWORD.
-    DWORD  dwordValue = boolValue;
-    // Store into registry.
-    BoolRegistryEntry pref( valueName );
-    nsresult rv = boolValue ? pref.set() : pref.reset();
-
-    return rv;
-}
-
-/* void setPreferences (in nsIWindowsHooksSettings prefs); */
-NS_IMETHODIMP
-nsWindowsHooks::SetSettings(nsIWindowsHooksSettings *prefs) {
-    nsresult rv = NS_ERROR_FAILURE;
-
-    putPRBoolIntoRegistry( "isHandlingHTTP",   prefs, &nsIWindowsHooksSettings::GetIsHandlingHTTP );
-    putPRBoolIntoRegistry( "isHandlingHTTPS",  prefs, &nsIWindowsHooksSettings::GetIsHandlingHTTPS );
-    putPRBoolIntoRegistry( "isHandlingFTP",    prefs, &nsIWindowsHooksSettings::GetIsHandlingFTP );
-    putPRBoolIntoRegistry( "isHandlingCHROME", prefs, &nsIWindowsHooksSettings::GetIsHandlingCHROME );
-    putPRBoolIntoRegistry( "isHandlingGOPHER", prefs, &nsIWindowsHooksSettings::GetIsHandlingGOPHER );
-    putPRBoolIntoRegistry( "isHandlingHTML",   prefs, &nsIWindowsHooksSettings::GetIsHandlingHTML );
-    putPRBoolIntoRegistry( "isHandlingJPEG",   prefs, &nsIWindowsHooksSettings::GetIsHandlingJPEG );
-    putPRBoolIntoRegistry( "isHandlingGIF",    prefs, &nsIWindowsHooksSettings::GetIsHandlingGIF );
-    putPRBoolIntoRegistry( "isHandlingPNG",    prefs, &nsIWindowsHooksSettings::GetIsHandlingPNG );
-    putPRBoolIntoRegistry( "isHandlingXBM",    prefs, &nsIWindowsHooksSettings::GetIsHandlingXBM );
-    putPRBoolIntoRegistry( "isHandlingBMP",    prefs, &nsIWindowsHooksSettings::GetIsHandlingBMP );
-    putPRBoolIntoRegistry( "isHandlingICO",    prefs, &nsIWindowsHooksSettings::GetIsHandlingICO );
-    putPRBoolIntoRegistry( "isHandlingXML",    prefs, &nsIWindowsHooksSettings::GetIsHandlingXML );
-    putPRBoolIntoRegistry( "isHandlingXHTML",  prefs, &nsIWindowsHooksSettings::GetIsHandlingXHTML );
-    putPRBoolIntoRegistry( "isHandlingXUL",    prefs, &nsIWindowsHooksSettings::GetIsHandlingXUL );
-    putPRBoolIntoRegistry( "showDialog",       prefs, &nsIWindowsHooksSettings::GetShowDialog );
-
-    // Indicate that these settings have indeed been set.
-    BoolRegistryEntry( "haveBeenSet" ).set();
-
-    rv = SetRegistry();
-
-    return rv;
-}
-
-// Get preferences and start handling everything selected.
-NS_IMETHODIMP
-nsWindowsHooks::SetRegistry() {
-    nsresult rv = NS_OK;
-
-    // Get raw prefs object.
-    nsWindowsHooksSettings *prefs;
-    rv = this->GetSettings( &prefs );
-
-    NS_ENSURE_TRUE( NS_SUCCEEDED( rv ), rv );
-
-    if ( prefs->mHandleHTML ) {
-        (void) mozillaMarkup.set();
-    } else {
-        (void) mozillaMarkup.reset();
-    }
-    if ( prefs->mHandleJPEG ) {
-        (void) jpg.set();
-    } else {
-        (void) jpg.reset();
-    }
-    if ( prefs->mHandleGIF ) {
-        (void) gif.set();
-    } else {
-        (void) gif.reset();
-    }
-    if ( prefs->mHandlePNG ) {
-        (void) png.set();
-    } else {
-        (void) png.reset();
-    }
-    if ( prefs->mHandleXBM ) {
-        (void) xbm.set();
-    } else {
-        (void) xbm.reset();
-    }
-    if ( prefs->mHandleBMP ) {
-        (void) bmp.set();
-    } else {
-        (void) bmp.reset();
-    }
-    if ( prefs->mHandleICO ) {
-        (void) ico.set();
-    } else {
-        (void) ico.reset();
-    }
-    if ( prefs->mHandleXML ) {
-        (void) xml.set();
-    } else {
-        (void) xml.reset();
-    }
-    if ( prefs->mHandleXHTML ) {
-        (void) xhtml.set();
-    } else {
-        (void) xhtml.reset();
-    }
-    if ( prefs->mHandleXUL ) {
-        (void) xul.set();
-    } else {
-        (void) xul.reset();
-    }
-    if ( prefs->mHandleHTTP ) {
-        (void) http.set();
-    } else {
-        (void) http.reset();
-    }
-    if ( prefs->mHandleHTTPS ) {
-        (void) https.set();
-    } else {
-        (void) https.reset();
-    }
-    if ( prefs->mHandleFTP ) {
-        (void) ftp.set();
-    } else {
-        (void) ftp.reset();
-    }
-    if ( prefs->mHandleCHROME ) {
-        (void) chrome.set();
-    } else {
-        (void) chrome.reset();
-    }
-    if ( prefs->mHandleGOPHER ) {
-        (void) gopher.set();
-    } else {
-        (void) gopher.reset();
-    }
-
-    // Call SHChangeNotify() to notify the windows shell that file
-    // associations changed, and that an update of the icons need to occur.
-    SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
-
-    return NS_OK;
-}
-
-// nsIWindowsHooks.idl for documentation
-
-/*
-  * Name: IsOptionEnabled
-  * Arguments:
-  *     PRUnichar* option - the option line switch we check to see if it is in the registry key
-  *
-  * Return Value:
-  *     PRBool* _retval - PR_TRUE if option is already in the registry key, otherwise PR_FALSE
-  *
-  * Description:
-  *     This function merely checks if the passed in string exists in the (appname) Quick Launch Key or not.
-  *
-  * Author:
-  *     Joseph Elwell 3/1/2002
-*/
-NS_IMETHODIMP nsWindowsHooks::IsOptionEnabled(const char* option, PRBool *_retval) { 
-    NS_ASSERTION(option, "nsWindowsHooks::IsOptionEnabled requires something like \"-turbo\"");
-  	*_retval = PR_FALSE;
-    RegistryEntry startup ( HKEY_CURRENT_USER, RUNKEY, NS_QUICKLAUNCH_RUN_KEY, NULL );
-    nsCString cargs = startup.currentSetting();
-    if (cargs.Find(option, PR_TRUE) != kNotFound)
-        *_retval = PR_TRUE;
-    return NS_OK;
-}
-
-/*
-  * Name: grabArgs
-  * Arguments:
-  *     char* optionline  - the full optionline as read from the (appname) Quick Launch registry key
-  *
-  * Return Value:
-  *     char** args - A pointer to the arguments (string in optionline)
-  *                   passed to the executable in the (appname) Quick Launch registry key
-  *
-  * Description:
-  *     This function separates out the arguments from the optinline string
-  *     Returning a pointer into the first arguments buffer.
-  *     This function is used only locally, and is meant to reduce code size and readability.
-  *
-  * Author:
-  *     Joseph Elwell 3/1/2002
-*/
-void grabArgs(char* optionline, char** args) {
-    nsCRT::strtok(optionline, "\"", &optionline);
-    if (optionline != NULL)
-        *args = nsCRT::strtok(optionline, "\"", &optionline);
-}
-
-/*
-  * Name: StartupAddOption
-  * Arguments:
-  *     PRUnichar* option - the option line switch we want to add to the registry key
-  *
-  * Return Value: none
-  *
-  * Description:
-  *     This function adds the given option line argument to the (appname) Quick Launch registry key
-  *
-  * Author:
-  *     Joseph Elwell 3/1/2002
-*/
-NS_IMETHODIMP nsWindowsHooks::StartupAddOption(const char* option) {
-    NS_ASSERTION(option, "nsWindowsHooks::StartupAddOption requires something like \"-turbo\"");
-    PRBool retval;
-    IsOptionEnabled(option, &retval);
-    if (retval) return NS_OK; //already in there
-    
-    RegistryEntry startup ( HKEY_CURRENT_USER, RUNKEY, NS_QUICKLAUNCH_RUN_KEY, NULL );
-    nsCString cargs = startup.currentSetting();
-    nsCAutoString newsetting;
-    newsetting.Assign('\"');
-    newsetting.Append(thisApplication());
-    newsetting.Append('\"');
-    if (!cargs.IsEmpty())
-    {
-        char* args;
-        // exploiting the fact that nsString's storage is also a char* buffer.
-        // NS_CONST_CAST is safe here because nsCRT::strtok will only modify
-        // the existing buffer
-        grabArgs(cargs.BeginWriting(), &args);
-        if (args != NULL)
-            newsetting.Append(args);
-        else
-        {
-            // check for the old style registry key that doesnot quote its executable
-            IsOptionEnabled("-turbo", &retval);
-            if (retval)
-                newsetting.Append(" -turbo");
-        }
-    }
-    newsetting.Append(' ');
-    newsetting.Append(option);
-    startup.setting = newsetting;
-    startup.set();    
-    return NS_OK;
-}
-
-/*
-  * Name: StartupRemoveOption
-  * Arguments:
-  *     PRUnichar* option - the option line switch we want to remove from the registry key
-  *
-  * Return Value: none.
-  *
-  * Description:
-  *     This function removes the given option from the (appname) Quick Launch Key.
-  *     And deletes the key entirely if no options are left.
-  *
-  * Author:
-  *     Joseph Elwell 3/1/2002
-*/
-NS_IMETHODIMP nsWindowsHooks::StartupRemoveOption(const char* option) {
-    NS_ASSERTION(option, "nsWindowsHooks::StartupRemoveOption requires something like \"-turbo\"");
-    PRBool startupFound;
-    IsOptionEnabled(option, &startupFound );
-    if ( !startupFound )
-        return NS_OK;               // already disabled, no need to do anything
-
-    RegistryEntry startup ( HKEY_CURRENT_USER, RUNKEY, NS_QUICKLAUNCH_RUN_KEY, NULL );
-    nsCString cargs = startup.currentSetting();
-    char* args;
-    // exploiting the fact that nsString's storage is also a char* buffer.
-    // NS_CONST_CAST is safe here because nsCRT::strtok will only modify
-    // the existing buffer
-    grabArgs(cargs.BeginWriting(), &args);
-
-    nsCAutoString launchcommand;
-    if (args)
-    {
-        launchcommand.Assign(args);
-        PRInt32 optionlocation = launchcommand.Find(option, PR_TRUE);
-        // modify by one to get rid of the space we prepended in StartupAddOption
-        if (optionlocation != kNotFound)
-            launchcommand.Cut(optionlocation - 1, strlen(option) + 1);
-    }
-	
-    if (launchcommand.IsEmpty())
-    {
-        startup.set();
-    }
-    else
-    {
-        nsCAutoString ufileName;
-        ufileName.Assign('\"');
-        ufileName.Append(thisApplication());
-        ufileName.Append('\"');
-        ufileName.Append(launchcommand);
-        startup.setting = ufileName;
-        startup.set();
-    }
-    return NS_OK;
-}
-
-nsresult
-WriteBitmap(nsIFile* aFile, gfxIImageFrame* aImage)
-{
-  PRInt32 width, height;
-  aImage->GetWidth(&width);
-  aImage->GetHeight(&height);
-  
-  PRUint8* bits;
-  PRUint32 length;
-  aImage->LockImageData();
-  aImage->GetImageData(&bits, &length);
-  if (!bits) {
-      aImage->UnlockImageData();
-      return NS_ERROR_FAILURE;
-  }
- 
-  PRUint32 bpr;
-  aImage->GetImageBytesPerRow(&bpr);
-  PRInt32 bitCount = bpr/width;
-  
-  // initialize these bitmap structs which we will later
-  // serialize directly to the head of the bitmap file
-  BITMAPINFOHEADER bmi;
-  bmi.biSize = sizeof(BITMAPINFOHEADER);
-  bmi.biWidth = width;
-  bmi.biHeight = height;
-  bmi.biPlanes = 1;
-  bmi.biBitCount = (WORD)bitCount*8;
-  bmi.biCompression = BI_RGB;
-  bmi.biSizeImage = length;
-  bmi.biXPelsPerMeter = 0;
-  bmi.biYPelsPerMeter = 0;
-  bmi.biClrUsed = 0;
-  bmi.biClrImportant = 0;
-  
-  BITMAPFILEHEADER bf;
-  bf.bfType = 0x4D42; // 'BM'
-  bf.bfReserved1 = 0;
-  bf.bfReserved2 = 0;
-  bf.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
-  bf.bfSize = bf.bfOffBits + bmi.biSizeImage;
-
-  // get a file output stream
-  nsresult rv;
-  nsCOMPtr<nsIOutputStream> stream;
-  rv = NS_NewLocalFileOutputStream(getter_AddRefs(stream), aFile);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // write the bitmap headers and rgb pixel data to the file
-  rv = NS_ERROR_FAILURE;
-  if (stream) {
-    PRUint32 written;
-    stream->Write((const char*)&bf, sizeof(BITMAPFILEHEADER), &written);
-    if (written == sizeof(BITMAPFILEHEADER)) {
-      stream->Write((const char*)&bmi, sizeof(BITMAPINFOHEADER), &written);
-      if (written == sizeof(BITMAPINFOHEADER)) {
-        // write out the image data backwards because the desktop won't
-        // show bitmaps with negative heights for top-to-bottom
-        PRUint32 i = length;
-        rv = NS_OK;
-        do {
-          i -= bpr;
-
-          stream->Write(((const char*)bits) + i, bpr, &written);
-          if (written != bpr) {
-            rv = NS_ERROR_FAILURE;
-            break;
-          }
-        } while (i != 0);
-      }
-    }
-  
-    stream->Close();
-  }
-
-  aImage->UnlockImageData(); 
-  return rv;
-}
-
-NS_IMETHODIMP
-nsWindowsHooks::SetImageAsWallpaper(nsIDOMElement* aElement, PRBool aUseBackground)
-{
-  nsresult rv;
-  
-  nsCOMPtr<gfxIImageFrame> gfxFrame;
-  if (aUseBackground) {
-    // XXX write background loading stuff!
-  } else {
-    nsCOMPtr<nsIImageLoadingContent> imageContent = do_QueryInterface(aElement, &rv);
-    if (!imageContent) return rv;
-    
-    // get the image container
-    nsCOMPtr<imgIRequest> request;
-    rv = imageContent->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
-                                  getter_AddRefs(request));
-    if (!request) return rv;
-    nsCOMPtr<imgIContainer> container;
-    rv = request->GetImage(getter_AddRefs(container));
-    if (!container)
-      return NS_ERROR_FAILURE;
-    
-    // get the current frame, which holds the image data
-    container->GetCurrentFrame(getter_AddRefs(gfxFrame));
-  }  
-  
-  if (!gfxFrame)
-    return NS_ERROR_FAILURE;
-
-  // get the profile root directory
-  nsCOMPtr<nsIFile> file;
-  rv = NS_GetSpecialDirectory(NS_APP_APPLICATION_REGISTRY_DIR,
-                              getter_AddRefs(file));
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  // get the product brand name from localized strings
-  nsXPIDLString brandName, fileLeafName;
-  nsCOMPtr<nsIStringBundleService> bundleService =
-           do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
-  NS_ENSURE_TRUE(bundleService, rv);
-
-  // get the product brand name from localized strings
-  nsCOMPtr<nsIStringBundle> bundle;
-  rv = bundleService->CreateBundle("chrome://branding/locale/brand.properties",
-                                   getter_AddRefs(bundle));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
-                                 getter_Copies(brandName));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // get the file leaf name from localized strings (e.g. "%S Wallpaper.bmp")
-  rv = bundleService->CreateBundle("chrome://global-platform/locale/nsWindowsHooks.properties",
-                                   getter_AddRefs(bundle));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  const PRUnichar* stringArray[] = { brandName.get() };
-
-  rv = bundle->FormatStringFromName(NS_LITERAL_STRING("wallpaperFile").get(),
-                                    stringArray, NS_ARRAY_LENGTH(stringArray),
-                                    getter_Copies(fileLeafName));
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  // eventually, the path is %APPDATA%\Mozilla\Mozilla Wallpaper.bmp
-  fileLeafName.AppendLiteral(".bmp");
-  rv = file->Append(fileLeafName);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // write the bitmap to the target file
-  rv = WriteBitmap(file, gfxFrame);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // set it as the system wallpaper
-  nsCAutoString nativePath;
-  rv = file->GetNativePath(nativePath);
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  ::SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) nativePath.get(),
-                         SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
-
-  return rv;
-}
deleted file mode 100644
--- a/xpfe/components/winhooks/nsWindowsHooks.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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):
- *   Aaron Kaluszka <ask@swva.net>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nswindowshooks_h____
-#define nswindowshooks_h____
-
-#include "nscore.h"
-#include "nsIWindowsHooks.h"
-#include "nsWindowsHooksUtil.h"
-
-#ifndef MAX_BUF
-#define MAX_BUF 4096
-#endif
-
-/* c09bc130-0a71-11d4-8076-00600811a9c3 */
-#define NS_IWINDOWSHOOKS_CID \
- { 0xc09bc130, 0x0a71, 0x11d4, {0x80, 0x76, 0x00, 0x60, 0x08, 0x11, 0xa9, 0xc3} }
-
-class nsWindowsHooksSettings : public nsIWindowsHooksSettings {
-public:
-    // ctor/dtor
-    nsWindowsHooksSettings();
-    virtual ~nsWindowsHooksSettings();
-
-    // Declare all interface methods we must implement.
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIWINDOWSHOOKSSETTINGS
-
-    // Typedef for nsIWindowsHooksSettings getter/setter member functions.
-    typedef
-    NS_STDCALL_FUNCPROTO(nsresult,
-                         getter,
-                         nsIWindowsHooksSettings, GetShowDialog, 
-                         (PRBool*));
-
-    typedef
-    NS_STDCALL_FUNCPROTO(nsresult,
-                         setter,
-                         nsIWindowsHooksSettings, SetShowDialog,
-                         (PRBool));
-
-protected:
-    // General purpose getter.
-    NS_IMETHOD Get( PRBool *result, PRBool nsWindowsHooksSettings::*member );
-    // General purpose setter.
-    NS_IMETHOD Set( PRBool value, PRBool nsWindowsHooksSettings::*member );
-
-private:
-    // Internet shortcut protocols.
-        PRBool mHandleHTTP;
-        PRBool mHandleHTTPS;
-        PRBool mHandleFTP;
-        PRBool mHandleCHROME;
-        PRBool mHandleGOPHER;
-    // File types.
-        PRBool mHandleHTML;
-        PRBool mHandleJPEG;
-        PRBool mHandleGIF;
-        PRBool mHandlePNG;
-        PRBool mHandleXBM;
-        PRBool mHandleBMP;
-        PRBool mHandleICO;
-        PRBool mHandleXML;
-        PRBool mHandleXHTML;
-        PRBool mHandleXUL;
-    // Dialog
-        PRBool mShowDialog;
-
-    // Special member to handle initialization.
-    PRBool mHaveBeenSet;
-    NS_IMETHOD GetHaveBeenSet( PRBool * );
-    NS_IMETHOD SetHaveBeenSet( PRBool );
-
-    // Give nsWindowsHooks full access.
-    friend class nsWindowsHooks;
-}; // nsWindowsHooksSettings
-
-class nsWindowsHooks : public nsIWindowsHooks {
-public:
-    // ctor/dtor
-    nsWindowsHooks();
-    virtual ~nsWindowsHooks();
-
-    // Declare all interface methods we must implement.
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIWINDOWSHOOKS
-
-protected:
-    // Internal flavor of GetPreferences.
-    NS_IMETHOD GetSettings( nsWindowsHooksSettings ** );
-
-    // Set registry according to settings.
-    NS_IMETHOD SetRegistry();
-    char mShortcutPath[MAX_BUF];
-    char mShortcutName[MAX_BUF];
-    char mShortcutBase[MAX_BUF];
-    char mShortcutProg[MAX_BUF];
-
-    // Objects that describe the Windows registry entries that we need to tweak.
-    ProtocolRegistryEntry http, https, ftp, chrome, gopher;
-    FileTypeRegistryEntry jpg, gif, png, xbm, bmp, ico, xml, xhtml, xul;
-    EditableFileTypeRegistryEntry mozillaMarkup;
-
-    // Give nsWindowsHooksSettings full access.
-    friend class nsWindowsHooksSettings;
-}; // nsWindowsHooks
-
-#endif // nswindowshooks_h____
deleted file mode 100644
--- a/xpfe/components/winhooks/nsWindowsHooksUtil.cpp
+++ /dev/null
@@ -1,617 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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):
- *   Bill Law     <law@netscape.com>
- *   Dean Tessman <dean_tessman@hotmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 <windows.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "nsString.h"
-#include "nsIStringBundle.h"
-#include "nsDirectoryService.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsNativeCharsetUtils.h"
-#include "nsWindowsHooksUtil.h"
-
-#ifdef MOZ_XUL_APP
-#include "nsNativeAppSupportWin.h"
-#else
-#include "nsINativeAppSupportWin.h"
-#include "nsICmdLineHandler.h"
-#endif
-
-#define MOZ_HWND_BROADCAST_MSG_TIMEOUT 5000
-#define MOZ_CLIENT_BROWSER_KEY "Software\\Clients\\StartMenuInternet"
-
-// Generate the "full" name of this registry entry.
-nsCString RegistryEntry::fullName() const {
-    nsCString result;
-    if ( baseKey == HKEY_CURRENT_USER ) {
-        result = "HKEY_CURRENT_USER\\";
-    } else if ( baseKey == HKEY_LOCAL_MACHINE ) {
-        result = "HKEY_LOCAL_MACHINE\\";
-    } else {
-        result = "\\";
-    }
-    result += keyName;
-    if ( !valueName.IsEmpty() ) {
-        result += "[";
-        result += valueName;
-        result += "]";
-    }
-    return result;
-}
-
-// Tests whether registry entry already has desired setting.
-PRBool RegistryEntry::isAlreadySet() const {
-    PRBool result = FALSE;
-
-    nsCAutoString current( currentSetting() );
-
-    result = ( current == setting );
-
-    return result;
-}
-
-// Gives registry entry the desired setting.
-nsresult RegistryEntry::set() {
-#ifdef DEBUG_law
-if ( isNull && setting.IsEmpty() ) printf( "Deleting %s\n", fullName().get() );
-else printf( "Setting %s=%s\n", fullName().get(), setting.get() );
-#endif
-    nsresult result = NS_ERROR_FAILURE;
-
-    HKEY   key;
-    LONG   rc = ::RegOpenKey( baseKey, keyName.get(), &key );
-
-    // See if key doesn't exist yet...
-    if ( rc == ERROR_FILE_NOT_FOUND ) {
-        rc = ::RegCreateKey( baseKey, keyName.get(), &key );
-    }
-    if ( rc == ERROR_SUCCESS ) {
-        if ( isNull && setting.IsEmpty() ) {
-            // This means we need to actually remove the value, not merely set it to an
-            // empty string.
-            rc = ::RegDeleteValue( key, valueNameArg() );
-            if ( rc == ERROR_SUCCESS ) {
-                result = NS_OK;
-            }
-        } else {
-            NS_ConvertUTF8toUTF16 utf16Setting(setting);
-            // Get current value to see if it is set properly already.
-            PRUnichar buffer[4096] = { 0 };
-            DWORD len = sizeof buffer;
-            NS_ConvertASCIItoUTF16 wValueName(valueNameArg());
-            rc = ::RegQueryValueExW( key, wValueName.get(), NULL,
-                 NULL, (LPBYTE)buffer, &len );
-            if ( rc != ERROR_SUCCESS || !utf16Setting.Equals(buffer) ) {
-                rc = ::RegSetValueExW( key, wValueName.get(), 0, REG_SZ,
-                     (LPBYTE) (utf16Setting.get()),
-                     utf16Setting.Length() * 2);
-                if ( rc == ERROR_SUCCESS ) {
-                   result = NS_OK;
-                }
-            } else {
-                // Already has desired setting.
-                result = NS_OK;
-            }
-        }
-        ::RegCloseKey( key );
-    } else {
-#ifdef DEBUG_law
-NS_ASSERTION( rc == ERROR_SUCCESS, fullName().get() );
-#endif
-    }
-    return result;
-}
-
-// Get current setting, set new one, then save the previous.
-nsresult SavedRegistryEntry::set() {
-    nsresult rv = NS_OK;
-    PRBool   currentlyUndefined = PR_TRUE;
-    nsCAutoString prev( currentSetting( &currentlyUndefined ) );
-    // See if value is changing.
-    // We need an extra check for the case where we have an empty entry
-    // and we need to remove it entirely.
-    if ( setting != prev || ( !currentlyUndefined && isNull ) ) {
-        // Set new.
-        rv = RegistryEntry::set();
-        if ( NS_SUCCEEDED( rv ) ) {
-            // Save old.
-            RegistryEntry tmp( HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop", fullName().get(), prev.get() );
-            tmp.set();
-        }
-    }
-    return rv;
-}
-
-// setWindowsXP
-//
-//  We need to:
-//    a. Make sure this application is registered as a "Start Menu
-//       internet app" under HKLM\Software\Clients\StartMenuInternet.
-//    b. Make this app the default "Start Menu internet app" for this
-//       user.
-static void setWindowsXP() {
-    // We test for the presence of this subkey as a WindowsXP test.
-    // We do it this way so that vagueries of future Windows versions
-    // are handled as best we can.
-    HKEY key;
-    nsCAutoString baseKey( NS_LITERAL_CSTRING( "Software\\Clients\\StartMenuInternet" ) );
-    LONG rc = ::RegOpenKey( HKEY_LOCAL_MACHINE, baseKey.get(), &key );
-    if ( rc == ERROR_SUCCESS ) {
-        // OK, this is WindowsXP (or equivalent).  Add this application to the
-        // set registered as "Start Menu internet apps."  These entries go
-        // under the subkey MOZILLA.EXE (or whatever the name of this executable is),
-        // that subkey name is generated by the utility function shortAppName.
-        ::RegCloseKey(key);
-        // The next 3 go under this subkey.
-        nsCAutoString subkey( baseKey + NS_LITERAL_CSTRING( "\\" ) + shortAppName() );
-        // Pretty name.  This goes into the LocalizedString value.  It is the
-        // name of the executable (preceded by '@'), followed by ",-nnn" where
-        // nnn is the resource identifier of the string in the .exe.  That value
-        // comes from nsINativeAppSupportWin.h.
-        char buffer[ _MAX_PATH + 8 ]; // Path, plus '@', comma, minus, and digits (5)
-        _snprintf( buffer, sizeof buffer, "@%s,-%d", thisApplication().get(), IDS_STARTMENU_APPNAME );
-        RegistryEntry tmp_entry1( HKEY_LOCAL_MACHINE, 
-                       subkey.get(),
-                       "LocalizedString", 
-                       buffer );
-        tmp_entry1.set();
-        // Default icon (from .exe resource).
-        RegistryEntry tmp_entry2( HKEY_LOCAL_MACHINE, 
-                       nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\DefaultIcon" ) ).get(),
-                       "", 
-                       nsCAutoString( thisApplication() + NS_LITERAL_CSTRING( ",0" ) ).get() );
-        tmp_entry2.set();
-        // Command to open.
-        RegistryEntry tmp_entry3( HKEY_LOCAL_MACHINE,
-                       nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\open\\command" ) ).get(),
-                       "", 
-                       thisApplication().get() );
-        tmp_entry3.set();
-        // "Properties" verb.  The default value is the text that will appear in the menu.
-        // The default value under the command subkey is the name of this application, with
-        // arguments to cause the Preferences window to appear.
-        nsCOMPtr<nsIStringBundleService> bundleService( do_GetService( "@mozilla.org/intl/stringbundle;1" ) );
-        nsCOMPtr<nsIStringBundle> bundle;
-        nsXPIDLString label;
-        if ( bundleService &&
-             NS_SUCCEEDED( bundleService->CreateBundle( "chrome://global-platform/locale/nsWindowsHooks.properties",
-                                                   getter_AddRefs( bundle ) ) ) &&
-             NS_SUCCEEDED( bundle->GetStringFromName( NS_LITERAL_STRING( "prefsLabel" ).get(), getter_Copies( label ) ) ) ) {
-            // Set the label that will appear in the start menu context menu.
-            RegistryEntry tmp_entry4( HKEY_LOCAL_MACHINE,
-                           nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\properties" ) ).get(),
-                           "", 
-                           NS_ConvertUTF16toUTF8( label ).get() );
-            tmp_entry4.set();
-        }
-        RegistryEntry tmp_entry5( HKEY_LOCAL_MACHINE,
-                       nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\properties\\command" ) ).get(),
-                       "", nsCAutoString( thisApplication() + 
-                                           NS_LITERAL_CSTRING(" -chrome \"chrome://communicator/content/pref/pref.xul\"") ).get()
-                      );
-        tmp_entry5.set();
-
-        // Now we need to select our application as the default start menu internet application.
-        // This is accomplished by first trying to store our subkey name in 
-        // HKLM\Software\Clients\StartMenuInternet's default value.  See
-        // http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q297878 for detail.
-        SavedRegistryEntry hklmAppEntry( HKEY_LOCAL_MACHINE, baseKey.get(), "", shortAppName().get() );
-        hklmAppEntry.set();
-        // That may or may not have worked (depending on whether we have sufficient access).
-        if ( hklmAppEntry.currentSetting() == hklmAppEntry.setting ) {
-            // We've set the hklm entry, so we can delete the one under hkcu.
-            SavedRegistryEntry tmp_entry6( HKEY_CURRENT_USER, baseKey.get(), "", 0 );
-            tmp_entry6.set();
-        } else {
-            // All we can do is set the default start menu internet app for this user.
-            SavedRegistryEntry tmp_entry7( HKEY_CURRENT_USER, baseKey.get(), "", shortAppName().get() );
-        }
-        // Notify the system of the changes.
-        ::SendMessageTimeout( HWND_BROADCAST,
-                              WM_SETTINGCHANGE,
-                              0,
-                              (LPARAM)MOZ_CLIENT_BROWSER_KEY,
-                              SMTO_NORMAL|SMTO_ABORTIFHUNG,
-                              MOZ_HWND_BROADCAST_MSG_TIMEOUT,
-                              NULL);
-    }
-}
-
-// Set this entry and its corresponding DDE entry.  The DDE entry
-// must be turned off to stop Windows from trying to use DDE.
-nsresult ProtocolRegistryEntry::set() {
-    // If the protocol is http, then we have to do special stuff.
-    // We must take care of this first because setting the "protocol entry"
-    // for http will cause WindowsXP to do stuff automatically for us,
-    // thereby making it impossible for us to propertly reset.
-    if ( protocol.EqualsLiteral( "http" ) ) {
-        setWindowsXP();
-    }
-
-    // Set this entry.
-    nsresult rv = SavedRegistryEntry::set();
-
-    // Save and set corresponding DDE entry(ies).
-    DDERegistryEntry( protocol.get() ).set();
-    // Set icon.
-    ProtocolIconRegistryEntry( protocol.get() ).set();
-
-    return rv;
-}
-
-// Not being a "saved" entry, we can't restore, so just delete it.
-nsresult RegistryEntry::reset() {
-    HKEY key;
-    LONG rc = ::RegOpenKey( baseKey, keyName.get(), &key );
-    if ( rc == ERROR_SUCCESS ) {
-        rc = ::RegDeleteValue( key, valueNameArg() );
-        ::RegCloseKey(key);
-#ifdef DEBUG_law
-if ( rc == ERROR_SUCCESS ) printf( "Deleting key=%s\n", (const char*)fullName().get() );
-#endif
-    }
-    return NS_OK;
-}
-
-// Resets registry entry to the saved value (if there is one).  We first
-// ensure that we still "own" that entry (by comparing its value to what
-// we would set it to).
-nsresult SavedRegistryEntry::reset() {
-    nsresult result = NS_OK;
-
-    // Get current setting for this key/value.
-    nsCAutoString current( currentSetting() );
-
-    // Test if we "own" it.
-    if ( current == setting ) {
-        // Unset it, then.  First get saved value it had previously.
-        PRBool noSavedValue = PR_TRUE;
-        RegistryEntry saved = RegistryEntry( HKEY_LOCAL_MACHINE, mozillaKeyName, fullName().get(), "" );
-        // There are 3 cases:
-        //    - no saved entry
-        //    - empty saved entry
-        //    - a non-empty saved entry
-        // We delete the current entry in the first case, and restore
-        // the saved entry (empty or otherwise) in the other two.
-        setting = saved.currentSetting( &noSavedValue );
-        if ( !setting.IsEmpty() || !noSavedValue ) {
-            // Set to previous value.
-            isNull = PR_FALSE; // Since we're resetting and the saved value may be empty, we
-                               // need to make sure set() doesn't mistakenly delete this entry.
-            result = RegistryEntry::set();
-            // Remove saved entry.
-            saved.reset();
-        } else {
-            // No saved value, just delete this entry.
-            result = RegistryEntry::reset();
-        }
-    }
-
-    return result;
-}
-
-// resetWindowsXP
-//
-// This function undoes "setWindowsXP," more or less.  It only needs to restore the selected
-// default Start Menu internet application.  The registration of this application as one of
-// the start menu internet apps can remain.  There is no check for the presence of anything
-// because the SaveRegistryEntry::reset calls will have no effect if there is no value at that
-// location (or, if that value has been changed by another application).
-static void resetWindowsXP() {
-    NS_NAMED_LITERAL_CSTRING( baseKey, "Software\\Clients\\StartMenuInternet" );
-    // First, try to restore the HKLM setting.  This will fail if either we didn't
-    // set that, or, if we don't have access).
-    SavedRegistryEntry tmp_entry8( HKEY_LOCAL_MACHINE, baseKey.get(), "", shortAppName().get() );
-    tmp_entry8.reset();
-
-    // The HKCU setting is trickier.  We may have set it, but we may also have
-    // removed it (see setWindowsXP(), above).  We first try to reverse the
-    // setting.  If we had removed it, then this will fail.
-    SavedRegistryEntry tmp_entry9( HKEY_CURRENT_USER, baseKey.get(), "", shortAppName().get() );
-    tmp_entry9.reset();
-    // Now, try to reverse the removal of this key.  This will fail if there is a  current
-    // setting, and will only work if this key is unset, and, we have a saved value.
-    SavedRegistryEntry tmp_entry10( HKEY_CURRENT_USER, baseKey.get(), "", 0 );
-    tmp_entry10.reset();
-
-    // Notify the system of the changes.
-    ::SendMessageTimeout( HWND_BROADCAST,
-                          WM_SETTINGCHANGE,
-                          0,
-                          (LPARAM)MOZ_CLIENT_BROWSER_KEY,
-                          SMTO_NORMAL|SMTO_ABORTIFHUNG,
-                          MOZ_HWND_BROADCAST_MSG_TIMEOUT,
-                          NULL);
-}
-
-// Restore this entry and corresponding DDE entry.
-nsresult ProtocolRegistryEntry::reset() {
-    // Restore this entry.
-    nsresult rv = SavedRegistryEntry::reset();
-
-    // Do same for corresponding DDE entry.
-    DDERegistryEntry( protocol.get() ).reset();
-    // Reset icon.
-    ProtocolIconRegistryEntry( protocol.get() ).reset();
-
-    // For http:, on WindowsXP, we need to do some extra cleanup.
-    if ( protocol.EqualsLiteral( "http" ) ) {
-        resetWindowsXP();
-    }
-
-    return rv;
-}
-
-static DWORD deleteKey( HKEY baseKey, const char *keyName ) {
-    // Make sure input subkey isn't null.
-    DWORD rc;
-    if ( keyName && ::strlen(keyName) ) {
-        // Open subkey.
-        HKEY key;
-        rc = ::RegOpenKeyEx( baseKey,
-                             keyName,
-                             0,
-                             KEY_ENUMERATE_SUB_KEYS | DELETE,
-                             &key );
-        // Continue till we get an error or are done.
-        while ( rc == ERROR_SUCCESS ) {
-            char subkeyName[_MAX_PATH];
-            DWORD len = sizeof subkeyName;
-            // Get first subkey name.  Note that we always get the
-            // first one, then delete it.  So we need to get
-            // the first one next time, also.
-            rc = ::RegEnumKeyEx( key,
-                                 0,
-                                 subkeyName,
-                                 &len,
-                                 0,
-                                 0,
-                                 0,
-                                 0 );
-            if ( rc == ERROR_NO_MORE_ITEMS ) {
-                // No more subkeys.  Delete the main one.
-                rc = ::RegDeleteKey( baseKey, keyName );
-                break;
-            } else if ( rc == ERROR_SUCCESS ) {
-                // Another subkey, delete it, recursively.
-                rc = deleteKey( key, subkeyName );
-            }
-        }
-        // Close the key we opened.
-        ::RegCloseKey( key );
-    } else {
-        rc = ERROR_BADKEY;
-    }
-    return rc;
-}
-
-// Set the "dde" entry by deleting the main ddexec subkey
-// under HKLM\Software\Classes\<protocol>\shell\open.
-// We "set" the various subkeys in order to preserve useful
-// information.
-nsresult DDERegistryEntry::set() {
-    nsresult rv = SavedRegistryEntry::set();
-    rv = activate.set();
-    rv = app.set();
-    rv = topic.set();
-    // We've saved what we can.  Now recurse through this key and
-    // subkeys.  This is necessary due to the fact that
-    // ::RegDeleteKey won't work on WinNT (and Win2k?) if there are
-    // subkeys.
-    if ( deleteKey( baseKey, keyName.get() ) != ERROR_SUCCESS ) {
-        rv = NS_ERROR_FAILURE;
-    }
-    return rv;
-}
-
-// Reset the main (ddeexec) value but also the Application and Topic.
-// We reset the app/topic even though we no longer set them.  This
-// handles cases where the user installed a prior version, and then
-// upgraded.
-nsresult DDERegistryEntry::reset() {
-    nsresult rv = SavedRegistryEntry::reset();
-    rv = activate.reset();
-    rv = app.reset();
-    rv = topic.reset();
-    return rv;
-}
-
-// Return current setting for this registry entry.
-// Optionally, the caller can ask that a boolean be set to indicate whether
-// the registry value is undefined.  This flag can be used to distinguish
-// between not defined at all versus simply empty (both of which return an
-// empty string).
-nsCString RegistryEntry::currentSetting( PRBool *currentlyUndefined ) const {
-    nsCString result;
-
-    if ( currentlyUndefined ) {
-        *currentlyUndefined = PR_TRUE;
-    }
-
-    HKEY   key;
-    LONG   rc = ::RegOpenKey( baseKey, keyName.get(), &key );
-    if ( rc == ERROR_SUCCESS ) {
-        PRUnichar buffer[4096] = { 0 };
-        DWORD len = sizeof buffer;
-        rc = ::RegQueryValueExW( key,
-             NS_ConvertASCIItoUTF16(valueNameArg()).get(), NULL, NULL,
-             (LPBYTE)buffer, &len );
-        if ( rc == ERROR_SUCCESS ) {
-            CopyUTF16toUTF8(buffer, result);
-            if ( currentlyUndefined ) {
-                *currentlyUndefined = PR_FALSE; // Indicate entry is present
-            }
-        }
-        ::RegCloseKey( key );
-    }
-
-    return result;
-}
-
-// For each file extension, map it to this entry's file type.
-// Set the file type so this application opens files of that type.
-nsresult FileTypeRegistryEntry::set() {
-    nsresult rv = NS_OK;
-
-    // Set file extensions.
-    for ( int i = 0; NS_SUCCEEDED( rv ) && ext[i]; i++ ) {
-        nsCAutoString thisExt( "Software\\Classes\\" );
-        thisExt += ext[i];
-        rv = SavedRegistryEntry( HKEY_LOCAL_MACHINE, thisExt.get(), "", fileType.get() ).set();
-    }
-
-    // If OK, set file type opener.
-    if ( NS_SUCCEEDED( rv ) ) {
-        rv = ProtocolRegistryEntry::set();
-
-        // If we just created this file type entry, set description and default icon.
-        if ( NS_SUCCEEDED( rv ) ) {
-            nsCAutoString iconFileToUse( "%1" );
-            nsCAutoString descKey( "Software\\Classes\\" );
-            descKey += protocol;
-            RegistryEntry descEntry( HKEY_LOCAL_MACHINE, descKey.get(), NULL, "" );
-            if ( descEntry.currentSetting().IsEmpty() ) {
-                nsCAutoString defaultDescKey( "Software\\Classes\\" );
-                defaultDescKey += defDescKey;
-                RegistryEntry defaultDescEntry( HKEY_LOCAL_MACHINE, defaultDescKey.get(), NULL, "" );
-
-                descEntry.setting = defaultDescEntry.currentSetting();
-                if ( descEntry.setting.IsEmpty() )
-                    descEntry.setting = desc;
-                descEntry.set();
-            }
-            nsCAutoString iconKey( "Software\\Classes\\" );
-            iconKey += protocol;
-            iconKey += "\\DefaultIcon";
-
-            if ( !iconFile.Equals(iconFileToUse) ) {
-            iconFileToUse = thisApplication() + NS_LITERAL_CSTRING( ",0" );
-
-            // Check to see if there's an icon file name associated with this extension.
-            // If there is, then we need to use this icon file.  If not, then we default
-            // to the main app's icon.
-            if ( !iconFile.IsEmpty() ) {
-                nsCOMPtr<nsIFile> iconFileSpec;
-                PRBool            flagExists;
-
-                // Use the directory service to get the path to the chrome folder.  The
-                // icons will be located in [chrome dir]\icons\default.
-                // The abs path to the icon has to be in the short filename
-                // format, else it won't work under win9x systems.
-                rv = NS_GetSpecialDirectory( NS_APP_CHROME_DIR, getter_AddRefs( iconFileSpec ) );
-                if ( NS_SUCCEEDED( rv ) ) {
-                    iconFileSpec->AppendNative( NS_LITERAL_CSTRING( "icons" ) );
-                    iconFileSpec->AppendNative( NS_LITERAL_CSTRING( "default" ) );
-                    iconFileSpec->AppendNative( iconFile );
-
-                    // Check to make sure that the icon file exists on disk.
-                    iconFileSpec->Exists( &flagExists );
-                    if ( flagExists ) {
-                        rv = iconFileSpec->GetNativePath( iconFileToUse );
-                        if ( NS_SUCCEEDED( rv ) ) {
-                            TCHAR buffer[MAX_PATH];
-                            DWORD len;
-
-                            // Get the short path name (8.3) format for iconFileToUse
-                            // else it won't work under win9x.
-                            len = ::GetShortPathName( iconFileToUse.get(), buffer, sizeof buffer );
-                            NS_ASSERTION ( (len > 0) && ( len < sizeof buffer ), "GetShortPathName failed!" );
-                            iconFileToUse.Assign( buffer );
-                            iconFileToUse.Append( NS_LITERAL_CSTRING( ",0" ) );
-                        }
-                        }
-                    }
-                }
-            }
-
-            RegistryEntry iconEntry( HKEY_LOCAL_MACHINE, iconKey.get(), NULL, iconFileToUse.get() );
-            if( !iconEntry.currentSetting().Equals( iconFileToUse ) )
-                iconEntry.set();
-        }
-    }
-
-    return rv;
-}
-
-// Basically, the inverse of set().
-// First, reset the opener for this entry's file type.
-// Then, reset the file type associated with each extension.
-nsresult FileTypeRegistryEntry::reset() {
-    nsresult rv = ProtocolRegistryEntry::reset();
-
-    for ( int i = 0; ext[ i ]; i++ ) {
-        nsCAutoString thisExt( "Software\\Classes\\" );
-        thisExt += ext[i];
-        (void)SavedRegistryEntry( HKEY_LOCAL_MACHINE, thisExt.get(), "", fileType.get() ).reset();
-    }
-
-    return rv;
-}
-
-// Do inherited set() and also set key for edit (with -edit option).
-//
-// Note: We make the rash assumption that we "own" this filetype (aka "protocol").
-// If we ever start commandeering some other file type then this may have to be
-// rethought.  The solution is to override reset() and undo this (and make the
-// "edit" entry a SavedRegistryEntry).
-nsresult EditableFileTypeRegistryEntry::set() {
-    nsresult rv = FileTypeRegistryEntry::set();
-#ifndef MOZ_XUL_APP
-    if ( NS_SUCCEEDED( rv ) ) {
-        // only set this if we support "-edit" on the command-line
-        nsCOMPtr<nsICmdLineHandler> editorService =
-            do_GetService( "@mozilla.org/commandlinehandler/general-startup;1?type=edit", &rv );
-        if ( NS_SUCCEEDED( rv) ) {
-            nsCAutoString editKey( "Software\\Classes\\" );
-            editKey += protocol;
-            editKey += "\\shell\\edit\\command";
-            nsCAutoString editor( thisApplication() );
-            editor += " -edit \"%1\"";
-            rv = RegistryEntry( HKEY_LOCAL_MACHINE, editKey.get(), "", editor.get() ).set();
-        }
-    }
-#endif
-    return rv;
-}
-
-// Convert current registry setting to boolean.
-BoolRegistryEntry::operator PRBool() {
-    return currentSetting().Equals( "1" ) ? PR_TRUE : PR_FALSE;
-}
deleted file mode 100644
--- a/xpfe/components/winhooks/nsWindowsHooksUtil.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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):
- *   Bill Law     <law@netscape.com>
- *   Dean Tessman <dean_tessman@hotmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 <windows.h>
-
-// Where Mozilla stores its own registry values.
-const char * const mozillaKeyName = "Software\\Mozilla\\Desktop";
-
-static const char shortcutSuffix[] = " -url \"%1\"";
-static const char chromeSuffix[] = " -chrome \"%1\"";
-static const char iconSuffix[] = ",0";
-
-// Returns the (fully-qualified) name of this executable.
-static nsCString thisApplication() {
-    static nsCAutoString result;
-
-    if ( result.IsEmpty() ) {
-        char buffer[MAX_PATH] = { 0 };
-    	DWORD len = ::GetModuleFileName( NULL, buffer, sizeof buffer );
-        len = ::GetShortPathName( buffer, buffer, sizeof buffer );
-    
-        result = buffer;
-        ToUpperCase(result);
-    }
-
-    return result;
-}
-
-// Returns the "short" name of this application (in upper case).  This is for
-// use as a StartMenuInternet value.
-static nsCString shortAppName() {
-    static nsCAutoString result;
-    
-    if ( result.IsEmpty() ) { 
-        // Find last backslash in thisApplication().
-        nsCAutoString thisApp( thisApplication() );
-        PRInt32 n = thisApp.RFind( "\\" );
-        if ( n != kNotFound ) {
-            // Use what comes after the last backslash.
-            result = (const char*)thisApp.get() + n + 1;
-        } else {
-            // Use entire string.
-            result = thisApp;
-        }
-    }
-
-    return result;
-}
-
-// RegistryEntry
-//
-// Generic registry entry (no saving of previous values).  Each is comprised of:
-//      o A base HKEY
-//      o A subkey name.
-//      o An optional value name (empty for the "default" value).
-//      o The registry setting we'd like this entry to have when set.
-struct RegistryEntry {
-    HKEY        baseKey;   // e.g., HKEY_CURRENT_USER
-    PRBool      isNull;    // i.e., should use ::RegDeleteValue
-    nsCString   keyName;   // Key name.
-    nsCString   valueName; // Value name (can be empty, which implies NULL).
-    nsCString   setting;   // What we set it to (UTF-8). This had better be 
-                           // nsString to avoid extra string copies, but
-                           // this code is not performance-critical. 
-
-    RegistryEntry( HKEY baseKey, const char* keyName, const char* valueName, const char* setting )
-        : baseKey( baseKey ), isNull( setting == 0 ), keyName( keyName ), valueName( valueName ), setting( setting ? setting : "" ) {
-    }
-
-    PRBool     isAlreadySet() const;
-    nsresult   set();
-    nsresult   reset();
-    nsCString  currentSetting( PRBool *currentUndefined = 0 ) const;
-
-    // Return value name in proper form for passing to ::Reg functions
-    // (i.e., emptry string is converted to a NULL pointer).
-    const char* valueNameArg() const {
-        return valueName.IsEmpty() ? NULL : valueName.get();
-    }
-
-    nsCString  fullName() const;
-};
-
-// BoolRegistryEntry
-// 
-// These are used to store the "windows integration" preferences.
-// You can query the value via operator void* (i.e., if ( boolPref )... ).
-// These are stored under HKEY_LOCAL_MACHINE\Software\Mozilla\Desktop.
-// Set sets the stored value to "1".  Reset deletes it (which implies 0).
-struct BoolRegistryEntry : public RegistryEntry {
-    BoolRegistryEntry( const char *name )
-        : RegistryEntry( HKEY_LOCAL_MACHINE, mozillaKeyName, name, "1" ) {
-    }
-    operator PRBool();
-};
-
-// SavedRegistryEntry
-//
-// Like a plain RegistryEntry, but set/reset save/restore the
-// it had before we set it.
-struct SavedRegistryEntry : public RegistryEntry {
-    SavedRegistryEntry( HKEY baseKey, const char *keyName, const char *valueName, const char *setting )
-        : RegistryEntry( baseKey, keyName, valueName, setting ) {
-    }
-    nsresult set();
-    nsresult reset();
-};
-
-// ProtocolRegistryEntry
-//
-// For setting entries for a given Internet Shortcut protocol.
-// The key name is calculated as
-// HKEY_LOCAL_MACHINE\Software\Classes\protocol\shell\open\command.
-// The setting is this executable (with appropriate suffix).
-// Set/reset are trickier in this case.
-struct ProtocolRegistryEntry : public SavedRegistryEntry {
-    nsCString protocol;
-    ProtocolRegistryEntry( const char* protocol )
-        : SavedRegistryEntry( HKEY_LOCAL_MACHINE, "", "", thisApplication().get() ),
-          protocol( protocol ) {
-        keyName = "Software\\Classes\\";
-        keyName += protocol;
-        keyName += "\\shell\\open\\command";
-
-        // Append appropriate suffix to setting.
-        if ( this->protocol.Equals( "chrome" ) || this->protocol.Equals( "MozillaXUL" ) ) {
-            // Use "-chrome" command line flag.
-            setting += chromeSuffix;
-        } else {
-            // Use standard "-url" command line flag.
-            setting += shortcutSuffix;
-        }
-    }
-    nsresult set();
-    nsresult reset();
-};
-
-// ProtocolIconRegistryEntry
-//
-// For setting icon entries for a given Internet Shortcut protocol.
-// The key name is calculated as
-// HKEY_LOCAL_MACHINE\Software\Classes\protocol\DefaultIcon.
-// The setting is this executable (with appropriate suffix).
-struct ProtocolIconRegistryEntry : public SavedRegistryEntry {
-    nsCString protocol;
-    ProtocolIconRegistryEntry( const char* aprotocol )
-        : SavedRegistryEntry( HKEY_LOCAL_MACHINE, "", "", thisApplication().get() ),
-          protocol( aprotocol ) {
-        keyName = NS_LITERAL_CSTRING("Software\\Classes\\") + protocol + NS_LITERAL_CSTRING("\\DefaultIcon");
-
-        // Append appropriate suffix to setting.
-        setting += iconSuffix;
-    }
-};
-
-// DDERegistryEntry
-//
-// Like a protocol registry entry, but for the shell\open\ddeexec subkey.
-//
-// We need to remove this subkey entirely to ensure we work properly with
-// various programs on various platforms (see Bugzilla bugs 59078, 58770, etc.).
-//
-// We don't try to save everything, though.  We do save the known useful info
-// under the ddeexec subkey:
-//     ddeexec\@
-//     ddeexec\NoActivateHandler
-//     ddeexec\Application\@
-//     ddeexec\Topic\@
-//
-// set/reset save/restore these values and remove/restore the ddeexec subkey
-struct DDERegistryEntry : public SavedRegistryEntry {
-    DDERegistryEntry( const char *protocol )
-        : SavedRegistryEntry( HKEY_LOCAL_MACHINE, "", "", 0 ),
-          activate( HKEY_LOCAL_MACHINE, "", "NoActivateHandler", 0 ),
-          app( HKEY_LOCAL_MACHINE, "", "", 0 ),
-          topic( HKEY_LOCAL_MACHINE, "", "", 0 ) {
-        // Derive keyName from protocol.
-        keyName = "Software\\Classes\\";
-        keyName += protocol;
-        keyName += "\\shell\\open\\ddeexec";
-        // Set subkey names.
-        activate.keyName = keyName;
-        app.keyName = keyName;
-        app.keyName += "\\Application";
-        topic.keyName = keyName;
-        topic.keyName += "\\Topic";
-    }
-    nsresult set();
-    nsresult reset();
-    SavedRegistryEntry activate, app, topic;
-};
-
-// FileTypeRegistryEntry
-//
-// For setting entries relating to a file extension (or extensions).
-// This object itself is for the "file type" associated with the extension.
-// Set/reset manage the mapping from extension to the file type, as well.
-// The description is taken from defDescKey if available. Otherwise desc 
-// is used.
-struct FileTypeRegistryEntry : public ProtocolRegistryEntry {
-    nsCString fileType;
-    const char **ext;
-    nsCString desc;
-    nsCString defDescKey;
-    nsCString iconFile;
-    FileTypeRegistryEntry ( const char **ext, const char *fileType, 
-        const char *desc, const char *defDescKey, const char *iconFile )
-        : ProtocolRegistryEntry( fileType ),
-          fileType( fileType ),
-          ext( ext ),
-          desc( desc ),
-          defDescKey(defDescKey),
-          iconFile(iconFile) {
-    }
-    nsresult set();
-    nsresult reset();
-};
-
-// EditableFileTypeRegistryEntry
-//
-// Extends FileTypeRegistryEntry by setting an additional handler for an "edit" command.
-struct EditableFileTypeRegistryEntry : public FileTypeRegistryEntry {
-    EditableFileTypeRegistryEntry( const char **ext, const char *fileType, 
-        const char *desc, const char *defDescKey, const char *iconFile )
-        : FileTypeRegistryEntry( ext, fileType, desc, defDescKey, iconFile ) {
-    }
-    nsresult set();
-};