Back to index

lightning-sunbird  0.9+nobinonly
nsIWindowsHooks.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Bill Law       <law@netscape.com>
00024  *   Aaron Kaluszka <ask@swva.net>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsISupports.idl"
00041 
00042  
00043 /* These interface provides support for integrating Mozilla into Windows.
00044  * This integration consists primarily of setting Mozilla as the "default
00045  * browser."  Or more precisely, setting Mozilla as the executable to
00046  * handle certain file types.
00047  *
00048  * There are two subtly different types of desktop objects that Mozilla
00049  * can be configured to "handle:"
00050  *      o File types (based on file extension)
00051  *      o Internet shortcuts (based on URL protocol).
00052  *
00053  * While these are different types of objects, the mechanism by which
00054  * applications are matched with them is essentially the same.
00055  *
00056  * In the case of files, there is one more level of indirection.  File
00057  * extensions are assigned a "file type" via a Windows registry entry.
00058  * For example, given the file extension ".foo", the file type is
00059  * determined by examing the value stored in the "default" value stored
00060  * at the registry key HKEY_LOCAL_MACHINE\Software\Classes\.foo.
00061  *
00062  * Once you have the "file type" then you use that the same way you use
00063  * Internet Shortcut protocol names to determine which application to
00064  * launch.  The application is specified by the default value stored in
00065  * the registry key
00066  * HKEY_LOCAL_MACHINE\Software\Classes<X>\shell\open\command, where
00067  * <X> is the "file type" or protocol name.
00068  *
00069  * If there are additional keys under "shell" then these appear on the
00070  * context menu for files/shortcuts of this type.  Typically, there are
00071  * entries for "print."  But Mozilla does not currently support a command
00072  * line option to print so we don't offer that.
00073  *
00074  * Previously, Netscape Communicator made itself the handler of standard
00075  * web things by creating a new file type "NetscapeMarkup" and mapping
00076  * extensions to that (.htm, .html, .shtml, .xbm), or, by setting itself
00077  * up as the "handler" for the file types of other web things (.jpg, .gif)
00078  * and Internet Shortcut protocols (ftp, gopher, http, https, mailto, news,
00079  * snews).
00080  *
00081  * In order to better enable Mozilla to co-exist with other browsers
00082  * (including Communicator), it will create yet another new file type,
00083  * "MozillaMarkup," that will be used to make Mozilla the default handler
00084  * for certain file extensions.  This will be done by remapping those
00085  * extensions to this new type.
00086  *
00087  * Mozilla will attempt to remember the original mapping and restore it
00088  * when the user decides to no longer have Mozilla be the default handler
00089  * for that extension.
00090  *
00091  * Mozilla will drop support for some items that are no longer germane:
00092  * the .shtml file extension and the gopher: protocol.  We will also, perhaps
00093  * only temporarily, drop support for protocols that aren't accessible from
00094  * the command line: mailto:, news:, and snews:.
00095  *
00096  * We will be adding support for the chrome: protocol (using the "-chrome"
00097  * command line option) and for .png, .xul and .xml file extensions.
00098  *
00099  * Missing Features:
00100  *
00101  * Currently, there is no way to extend the set of file types or protocols
00102  * that Mozilla can be associated with (save manually tweaking the Windows
00103  * registry).  This is likely to be a problem for branded Mozilla browsers
00104  * that might support specialized file types or protocols (e.g., .aim files).
00105  *
00106  * The plan is to extend this interface so that such file types and protocols
00107  * can be set up using the implementation of the interfaces defined here.
00108  */
00109 
00110 interface nsIDOMWindowInternal;
00111 interface nsIDOMElement;
00112 
00113 /* nsIWindowsHooksSettings
00114  *
00115  * This interface is used to get/set the user preferences relating to
00116  * "windows hooks" (aka "windows integration").  It is basically just
00117  * a conglomeration of a bunch of boolean attributes; it exists mainly
00118  * for historical reasons (it corresponds to the internal Prefs struct
00119  * that was in nsIDefaultBrowser.h in Mozilla Classic).
00120  */
00121 [scriptable, uuid(4ce9aa90-0a6a-11d4-8076-00600811a9c3)]
00122 interface nsIWindowsHooksSettings : nsISupports {
00123 
00124     // Internet shortcuts (based on "protocol").
00125     attribute boolean isHandlingHTTP;
00126     attribute boolean isHandlingHTTPS;
00127     attribute boolean isHandlingFTP;
00128     attribute boolean isHandlingCHROME;
00129     attribute boolean isHandlingGOPHER;
00130 
00131     // File handling (based on extension).
00132     attribute boolean isHandlingHTML;
00133     attribute boolean isHandlingJPEG;
00134     attribute boolean isHandlingGIF;
00135     attribute boolean isHandlingPNG;
00136     attribute boolean isHandlingMNG;
00137     attribute boolean isHandlingXBM;
00138     attribute boolean isHandlingBMP;
00139     attribute boolean isHandlingICO;
00140     attribute boolean isHandlingXML;
00141     attribute boolean isHandlingXHTML;
00142     attribute boolean isHandlingXUL;
00143 
00144     // Nag dialog flag.  Set this so that dialog
00145     // appears on startup if there is a mismatch
00146     // between registry and these settings.
00147     attribute boolean showDialog;
00148 
00149     // Registry mismatch indicator.
00150     // This is true if the Win32 registry is
00151     // currently set to match the preferences
00152     // in this object.
00153     readonly attribute boolean registryMatches;
00154 };
00155 
00156 /* nsIWindowsHooks
00157  *
00158  * This interface describes the service that you can use to
00159  * get/set the various windows integration features specified
00160  * by the nsIWindowsHooksPrefs attributes.
00161  */
00162 [scriptable, uuid(19c9fbb0-06a3-11d4-8076-00600811a9c3)]
00163 interface nsIWindowsHooks : nsISupports {
00164 
00165     // settings
00166     // --------
00167     // Get/set this to query or modify them.  The Windows
00168     // registry is updated when you set this attribute.
00169     attribute nsIWindowsHooksSettings settings;
00170 
00171     // checkSettings
00172     // -------------
00173     // Check that registry matches settings and if not,
00174     // prompt user for whether to reset.  This is
00175     // controlled by the showDialog setting.  This will
00176     // perform the check only the first time the
00177     // service is called.
00178     //   aParent - parent window for any dialogs that
00179     //             will appear
00180     //   Returns true if the windows integration dialog was shown
00181     boolean checkSettings( in nsIDOMWindowInternal aParent );
00182 
00188     boolean isOptionEnabled(in string option);
00189 
00194     void startupAddOption(in string option);
00195 
00201     void startupRemoveOption(in string option);
00202 
00208     void setImageAsWallpaper(in nsIDOMElement aImageElement, in boolean useBackground);
00209 };
00210 
00211 %{C++
00212 #define NS_IWINDOWSHOOKS_CONTRACTID    "@mozilla.org/winhooks;1"
00213 #define NS_IWINDOWSHOOKS_CLASSNAME "Mozilla Windows Integration Hooks"
00214 
00215 // The key that is used to write the quick launch appname in the windows registry
00216 #define NS_QUICKLAUNCH_RUN_KEY "Mozilla Quick Launch"
00217 %}