Search Service:API: Difference between revisions
Jump to navigation
Jump to search
GavinSharp (talk | contribs) No edit summary |
GavinSharp (talk | contribs) No edit summary |
||
| Line 82: | Line 82: | ||
/** | /** | ||
* Adds a new search engine. | * Adds a new search engine. | ||
* @param | |||
*/ | */ | ||
void addEngineWithDetails( | void addEngineWithDetails( | ||
| Line 89: | Line 90: | ||
in AString alias, | in AString alias, | ||
in AString description, | in AString description, | ||
in | in AString method, | ||
in AString template | in AString template); | ||
/** | /** | ||
* Returns an engine with the specified alias. | * Returns an engine with the specified alias. | ||
* @param | * @param alias | ||
* The search engine's alias. | * The search engine's alias. | ||
* @returns A nsISearchEngine object | * @returns A nsISearchEngine object | ||
| Line 115: | Line 112: | ||
/** | /** | ||
* Returns an array of all installed search engines. | * Returns an array of all installed search engines. | ||
* @returns An array of | * @returns An array of nsISearchEngine objects. | ||
*/ | */ | ||
void getEngines(out unsigned long engineCount, | void getEngines(out unsigned long engineCount, | ||
| Line 123: | Line 120: | ||
* Removes the search engine (from disk, too). | * Removes the search engine (from disk, too). | ||
* @param engine | * @param engine | ||
* The engine to remove | * The engine to remove. | ||
*/ | */ | ||
void removeEngine(in nsISearchEngine engine); | void removeEngine(in nsISearchEngine engine); | ||
Revision as of 04:31, 30 January 2006
This is the proposed API for the the new Firefox search service. Please comment on the discussion page or in the bug itself.
interface nsISearchSubmission : nsISupports {
/** * The POST data associated with a search submission, wrapped in a MIME * input stream. */ readonly attribute nsIInputStream postData; /** * The URI to submit a search to. */ readonly attribute nsIURI uri;
};
interface nsISearchEngine : nsISupports {
/** * Gets a Submission object that contains information about what to send to * the search engine including URI and postData. * @param aData * User entered input to substitute into the submission data. * i.e. the search terms. * @returns A nsISearchSubmission object that contains information about what * to send to the search engine. */ nsISearchSubmission getSubmission(in AString aData);
/** * Supported search engine types. */ const unsigned long TYPE_OPENSEARCH = 1; const unsigned long TYPE_SHERLOCK = 2;
/** * The shortcut alias of the engine. The alias is a unique identifier. */ attribute AString alias;
/** * Whether the engine should be hidden from the user. */ attribute boolean hidden;
/** * A nsIURI corresponding to the engine's icon, stored locally. May be null. */ attribute nsIURI iconURI;
/** * A string corresponding to the engine icon's URL. This will return * iconURI.spec, or an empty string if the engine has no iconURI. */ readonly attribute nsIURI iconURL;
/** * The display name of the search engine. This is a unique identifier. */ readonly attribute AString name;
/** * The search engine type. */ readonly attribute long type;
};
interface nsISearchService : nsISupports {
/** * Adds a new search engine from the file at the supplied URI. */ void addEngine(in AString engineURI);
/**
* This is the old nsInternetSearchService.cpp/nsISidebar API... it needs
* to be supported, though the last two params will probably be ignored.
*/
void addSearchEngine(in AString engineURL,
in AString iconURL,
in AString suggestedTitle,
in AString suggestedCategory);
/**
* Adds a new search engine.
* @param
*/
void addEngineWithDetails(
in AString name,
in nsIURI iconURI,
in AString alias,
in AString description,
in AString method,
in AString template);
/** * Returns an engine with the specified alias. * @param alias * The search engine's alias. * @returns A nsISearchEngine object */ nsISearchEngine getEngineByAlias(in AString alias);
/** * Returns an engine with the specified name. * @param aEngineName * The name of the engine. * @returns The corresponding nsISearchEngine object, or null if it doesn't * exist. */ nsISearchEngine getEngineByName(in AString aEngineName);
/**
* Returns an array of all installed search engines.
* @returns An array of nsISearchEngine objects.
*/
void getEngines(out unsigned long engineCount,
[retval, array, size_is(engineCount)] out nsISearchEngine engines);
/** * Removes the search engine (from disk, too). * @param engine * The engine to remove. */ void removeEngine(in nsISearchEngine engine);
/** * Update all the stored search engines. */ void updateEngines();
};