You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Firefox System Integration

Firefox integrates with the Windows Shell in a number of ways - the default browser setting, the ability to set the desktop background etc. Using these settings involves using a windows-only interface called nsIWindowsHooks. These functions (and others) are required on other platforms however, so a generic interface is desirable.

The plan is thus to transition to nsIShellIntegration, an XP interface implemented on each platform by code that uses APIs specific to that platform. Platform-specific functions (e.g. the Windows unread mail count) can be exposed through platform-specific interfaces.

For example:

  browser/components/shell-integration/
                                       public/nsIShellIntegration.idl
                                       public/nsIWindowsShellIntegration.idl
                                       public/nsIMacShellIntegration.idl
                                       public/nsIGNOMEShellIntegration.idl
                                       ...
                                       win/nsShellIntegration.cpp
                                       ...
                                       mac/nsShellIntegration.cpp
                                       ...
                                       gnome/nsShellIntegration.cpp

The current code in nsWindowsHooks and friends can be relocated, (and hopefully simplified a bit). nsIWindowsHooksSettings can probably die, since it really has no bearing on the FE.

This is what nsIShellIntegration might look like:

[scriptable, uuid(19c9fbb0-06a3-11d4-8076-00600811a9c3)]
interface nsIShellIntegration : nsISupports 
{
  boolean attribute isDefaultBrowser;
  
  const long BACKGROUND_TILE    = 0;
  const long BACKGROUND_STRETCH = 1;
  const long BACKGROUND_CENTER  = 2;

  void setDesktopBackground(in nsIDOMElement aElement
                            in long aPosition);

  const long CLIENT_MAIL        = 0;
  const long CLIENT_NEWS        = 1;
  void openDefaultClient(in long aClient);
};

nsWindowsHooks currently throws up a confirm default browser dialog itself, with this new interface the browser FE can check itself using the attribute isDefaultBrowser (which does all the required file-type-handling and protocol-handling checks in the system registry) and then throw up the UI itself if it deems it necessary. Similarly setting isDefaultBrowser from the FE upon confirmation from the user simplifies code in the windows implementation quite a bit.

The 'use background' parameter should be able to be removed from the setDesktopBackground method as if the element is not a <IMG> element it can be assumed the background is being used.

References to 'wallpaper' are changed to 'background' to be XP and keep up with the times (Microsoft Windows itself no longer refers to wallpaper as 'wallpaper').

This is what nsIWindowsShellIntegration might look like:

[scriptable, uuid(19c9fbb0-06a3-11d4-8076-00600811a9c3)]
interface nsIWindowsShellIntegration : nsIShellIntegration
{
  attribute long desktopColor;

  readonly attribute unsigned long unreadMailCount;
};

This interface inherits from the XP base so that users wanting to access methods/properties on both don't need to QI back and forth. setDesktopColor/ getDesktopColor is flattened into an attribute.

 

-- Ben Goodger (2004/03/06)