WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIBrowserSearchService

IID:8307b8f2-08ea-45b8-96bf-b1dc7688fe3b
Inherits From:nsISupports

This interface is implemented by the following components:


Properties

nsISearchEngine currentEngine

The currently active search engine. May be null if there are no visible search engines installed.

readonly nsISearchEngine defaultEngine

The default search engine. May be null if there are no visible search engines installed.


Methods

void addEngine ( AString engineURL , PRInt32 dattype , AString iconURL , PRBool confirm ) void addEngineWithDetails ( AString name , AString iconURL , AString alias , AString description , AString method , AString url ) void getDefaultEngines ( out PRUint32 engineCount , out nsISearchEngine engines ) nsISearchEngine getEngineByAlias ( AString alias ) nsISearchEngine getEngineByName ( AString engineName ) void getEngines ( out PRUint32 engineCount , out nsISearchEngine engines ) void getVisibleEngines ( out PRUint32 engineCount , out nsISearchEngine engines ) void moveEngine ( nsISearchEngine engine , PRInt32 newIndex ) void removeEngine ( nsISearchEngine engine ) void restoreDefaultEngines ( )

void addEngine ( AString engineURL , PRInt32 dattype , AString iconURL , PRBool confirm )

Adds a new search engine from the file at the supplied URI, optionally asking the user for confirmation first. If a confirmation dialog is shown, it will offer the option to begin using the newly added engine right away; if no confirmation dialog is shown, the new engine will be used right away automatically.

Arguments:
engineURL: The URL to the search engine's description file.
dattype: An integer representing the plugin file format. Must be one of the supported search engine data types defined above.
iconURL: A URL string to an icon file to be used as the search engine's icon. This value may be overridden by an icon specified in the engine description file.
confirm: A boolean value indicating whether the user should be asked for confirmation before this engine is added to the list. If this value is false, the engine will be added to the list upon successful load, but it will not be selected as the current engine.

void addEngineWithDetails ( AString name , AString iconURL , AString alias , AString description , AString method , AString url )

Adds a new search engine, without asking the user for confirmation and without starting to use it right away.

Arguments:
name: The search engine's name. Must be unique. Must not be null.
iconURL: Optional: A URL string pointing to the icon to be used to represent the engine.
alias: Optional: A unique shortcut that can be used to retrieve the search engine.
description: Optional: a description of the search engine.
method: The HTTP request method used when submitting a search query. Must be a case insensitive value of either "get" or "post".
url: The URL to which search queries should be sent. Must not be null.

void getDefaultEngines ( out PRUint32 engineCount , out nsISearchEngine engines )

Returns an array of all default search engines. This includes all loaded engines that aren't in the user's profile directory (NS_APP_USER_SEARCH_DIR).

Arguments:
engineCount
engines

nsISearchEngine getEngineByAlias ( AString alias )

Returns an engine with the specified alias.

Arguments:
alias: The search engine's alias.

nsISearchEngine getEngineByName ( AString engineName )

Returns an engine with the specified name.

Arguments:
engineName: The name of the engine.

void getEngines ( out PRUint32 engineCount , out nsISearchEngine engines )

Returns an array of all installed search engines.

Arguments:
engineCount
engines

void getVisibleEngines ( out PRUint32 engineCount , out nsISearchEngine engines )

Returns an array of all installed search engines whose hidden attribute is false.

Arguments:
engineCount
engines

void moveEngine ( nsISearchEngine engine , PRInt32 newIndex )

Moves a visible search engine.

Arguments:
engine: The engine to move.
newIndex: The engine's new index in the set of visible engines.

void removeEngine ( nsISearchEngine engine )

Removes the search engine. If the search engine is installed in a global location, this will just hide the engine. If the engine is in the user's profile directory, it will be removed from disk.

Arguments:
engine: The engine to remove.

void restoreDefaultEngines ( )

Un-hides all engines installed in the directory corresponding to the directory service's NS_APP_SEARCH_DIR key. (i.e. the set of engines returned by getDefaultEngines)

Reference documentation is generated from Mozilla's source.

Copyright © 1999-2006 XULPlanet.com