/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: NPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Netscape 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/NPL/ * * 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 * Aaron Kaluszka * * 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 NPL, 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 NPL, 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\\shell\open\command, where * 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(4ce9aa90-0a6a-11d4-8076-00600811a9c3)] interface nsIWindowsHooksSettings : nsISupports { // Internet shortcuts (based on "protocol"). attribute boolean isHandlingHTTP; attribute boolean isHandlingHTTPS; // File handling (based on extension). attribute boolean isHandlingHTML; attribute boolean isHandlingXHTML; // 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 { /** * See nsIWindowsHooksSettings; The Windows Registry is updated when * this attribute is set. */ attribute nsIWindowsHooksSettings settings; /** * 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. * * @param aParent parent window for any dialogs that will appear. * @return true if the windows integration dialog was shown, false if not. */ boolean checkSettings(in nsIDOMWindowInternal aParent); const PRInt32 WALLPAPER_TILE = 0; const PRInt32 WALLPAPER_STRETCH = 1; const PRInt32 WALLPAPER_CENTER = 2; /** * Sets the desktop background image using either the HTML * element supplied or the background image of the element supplied. * * @param aImageElement Either a HTML element or an element with * a background image from which to source the * background image. * @param useBackground Determines whether or not to interpret aImageElement * as a HTML element or as another element whose * background image should be used. * @param position How to place the image on the desktop */ void setImageAsWallpaper(in nsIDOMElement aImageElement, in boolean useBackground, in PRInt32 position); /** * Retrieves the current desktop background color. */ PRUint32 getDesktopColor(); /** * Sets the current desktop background color. * * @param color The color to use, in rgb format. */ void setDesktopColor(in PRUint32 color); /** * Launches one of the Windows default clients. * * @param aClient The client type to open, as specified in the Windows Registry under: * HKEY_LOCAL_MACHINE\Software\Clients\ * Typical values include "Mail", "News", "Contacts" etc. */ void openDefaultClient(in string aClient); /** * Retrieve the number of unread mail messages from the system for the current user. * * @return The number of unread (new) mail messages for the current user. */ readonly attribute unsigned long unreadMailCount; }; /* nsIWindowsRegistry * * This interface describes the service that you can use to * get/set Win32 registry entries. * * Notice: This interface is incomplete and should be used at your own risk! */ [scriptable, uuid(e07e7430-8d11-417c-83ee-c994400c452f)] interface nsIWindowsRegistry : nsISupports { /** * Valid starting keys for the Windows Registry. */ const long HKCR = 0; // HKEY_CLASSES_ROOT const long HKCC = 1; // HKEY_CURRENT_CONFIG const long HKCU = 2; // HKEY_CURRENT_USER const long HKLM = 3; // HKEY_LOCAL_MACHINE const long HKU = 4; // HKEY_USERS /** * Retrieves a Windows Registry entry value. * * @param aHKeyConstant The starting key, using the constants defined above. * @param aSubKeyName The sub key to locate * @param aValueName The value to locate in the sub key. The empty string * returns the default value of the sub key. * @return The value of the specified sub key/value, truncated to 4096 bytes. */ string getRegistryEntry(in long aHKeyConstant, in string aSubKeyName, in string aValueName); }; %{C++ #define NS_IWINDOWSHOOKS_CONTRACTID "@mozilla.org/winhooks;1" #define NS_IWINDOWSHOOKS_CLASSNAME "Mozilla Windows Integration Hooks" // XXXben - get rid of this // The key that is used to write the quick launch appname in the windows registry #define NS_QUICKLAUNCH_RUN_KEY "Mozilla Quick Launch" %}