/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * 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 Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Original Author(s):
 *   Robert John Churchill      <rjc@netscape.com>
 *
 * Contributor(s): 
 */

/*

  The Browser Search service

*/

#include "nsISupports.idl"
#include "nsIRDFDataSource.idl"

interface	nsIUnicodeDecoder;

[scriptable, uuid(1222e6f0-a5e3-11d2-8b7c-00805f8a7db6)]
interface nsILocalSearchService : nsISupports
{
};

[scriptable, uuid(6bd1d803-1c67-11d3-9820-ed1b357eb3c4)]
interface nsIInternetSearchService : nsISupports
{
	string			GetInternetSearchURL(in string searchEngineURI, in wstring searchStr);
	void			RememberLastSearchText(in wstring escapedSearchStr);
	boolean			FindInternetSearchResults(in string url);
	void			Stop();
	void			ClearResults(in boolean flushLastSearchRef);
	void			ClearResultSearchSites();
	nsIRDFDataSource	GetCategoryDataSource();
	void			AddSearchEngine(in string engineURL, in string iconURL,
				                 in wstring suggestedTitle, in wstring suggestedCategory);
};

[noscript, uuid(ac0c0781-ab71-11d3-a652-b09b68feee44)]
interface nsIInternetSearchContext : nsISupports
{
	// context types: WEB_SEARCH_CONTEXT=1, ENGINE_DOWNLOAD_CONTEXT, ICON_DOWNLOAD_CONTEXT };
	const unsigned long WEB_SEARCH_CONTEXT      = 1;
	const unsigned long ENGINE_DOWNLOAD_CONTEXT = 2;
	const unsigned long ICON_DOWNLOAD_CONTEXT   = 3;
	const unsigned long ENGINE_UPDATE_CONTEXT   = 4;
	const unsigned long ICON_UPDATE_CONTEXT     = 5;

	// attributes
	readonly attribute unsigned long ContextType;

	// methods
	nsIUnicodeDecoder	GetUnicodeDecoder();
	nsIRDFResource		GetParent();
	nsIRDFResource		GetEngine();
	void			GetHintConst([shared] out wstring buffer);
	void			AppendBytes(in string buffer, in long numBytes);
	void			AppendUnicodeBytes(in wstring buffer, in long numUniBytes);
	long			GetBufferLength();
	void			GetBufferConst([shared] out wstring buffer);
	void			Truncate();
};

%{C++

#define NS_IINTERNETSEARCHDATASOURCECALLBACK_IID \
{ 0x88774583, 0x1edd, 0x11d3, { 0x98, 0x20, 0xbf, 0x1b, 0xe7, 0x7e, 0x61, 0xc4 } }

#define NS_IINTERNETSEARCHDATAOURCE_IID \
{ 0x6bd1d803, 0x1c67, 0x11d3, { 0x98, 0x20, 0xed, 0x1b, 0x35, 0x7e, 0xb3, 0xc4 } }

#define NS_ILOCALSEARCHDATASOURCE_IID \
{ 0x1222e6f0, 0xa5e3, 0x11d2, { 0x8b, 0x7c, 0x00, 0x80, 0x5f, 0x8a, 0x7d, 0xb6 } }

#define NS_LOCALSEARCH_SERVICE_CONTRACTID \
    "@mozilla.org/browser/localsearch-service;1"
#define NS_LOCALSEARCH_DATASOURCE_CONTRACTID \
    "@mozilla.org/rdf/datasource;1?name=localsearch"

#define NS_INTERNETSEARCH_SERVICE_CONTRACTID \
    "@mozilla.org/browser/internetsearch-service;1"
#define NS_INTERNETSEARCH_DATASOURCE_CONTRACTID \
    "@mozilla.org/rdf/datasource;1?name=internetsearch"

%}
