Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsInternetSearchService.cpp File Reference
#include "nsInternetSearchService.h"
#include "nsLocalSearchService.h"
#include "nscore.h"
#include "nsIEnumerator.h"
#include "nsIRDFObserver.h"
#include "nsIRDFContainer.h"
#include "nsIRDFContainerUtils.h"
#include "nsIServiceManager.h"
#include "nsVoidArray.h"
#include "nsXPIDLString.h"
#include "nsRDFCID.h"
#include "plhash.h"
#include "plstr.h"
#include "prmem.h"
#include "prprf.h"
#include "prio.h"
#include "prlog.h"
#include "rdf.h"
#include "nsIDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsCOMArray.h"
#include "nsCRT.h"
#include "nsEnumeratorUtils.h"
#include "nsIRDFRemoteDataSource.h"
#include "nsICharsetConverterManager.h"
#include "nsICharsetAlias.h"
#include "nsITextToSubURI.h"
#include "nsEscape.h"
#include "nsNetUtil.h"
#include "nsIChannel.h"
#include "nsIFileChannel.h"
#include "nsIHttpChannel.h"
#include "nsIUploadChannel.h"
#include "nsIInputStream.h"
#include "nsIBookmarksService.h"
#include "nsIStringBundle.h"
#include "nsIObserverService.h"
#include "nsIURL.h"
#include "nsILocalFile.h"
#include "nsUnicharUtils.h"
#include "nsReadableUtils.h"
#include "nsIPrefLocalizedString.h"
#include "nsIGenericFactory.h"

Go to the source code of this file.

Classes

class  InternetSearchContext
struct  encodings

Defines

#define MAX_SEARCH_RESULTS_ALLOWED   100
#define POSTHEADER_PREFIX   "Content-type: application/x-www-form-urlencoded\r\nContent-Length: "
#define POSTHEADER_SUFFIX   "\r\n\r\n"
#define SEARCH_PROPERTIES   "chrome://communicator/locale/search/search-panel.properties"
#define SEARCHCONFIG_PROPERTIES   "chrome://navigator/content/searchconfig.properties"
#define INTL_PROPERTIES   "chrome://navigator/locale/navigator.properties"
#define SEARCH_UPDATE_TIMEOUT   60000

Functions

static NS_DEFINE_CID (kRDFServiceCID, NS_RDFSERVICE_CID)
static NS_DEFINE_CID (kRDFContainerCID, NS_RDFCONTAINER_CID)
static NS_DEFINE_CID (kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID)
static NS_DEFINE_CID (kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID)
static NS_DEFINE_CID (kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID)
static NS_DEFINE_CID (kTextToSubURICID, NS_TEXTTOSUBURI_CID)
static NS_DEFINE_CID (kPrefCID, NS_PREF_CID)
int PR_CALLBACK searchModePrefCallback (const char *pref, void *aClosure)
static PRInt32 nsString_Find (const nsAString &aPattern, const nsAString &aSource, PRBool aIgnoreCase=PR_FALSE, PRInt32 aOffset=0, PRInt32 aCount=-1)
nsresult NS_NewInternetSearchContext (PRUint32 contextType, nsIRDFResource *aParent, nsIRDFResource *aEngine, nsIUnicodeDecoder *aUnicodeDecoder, const PRUnichar *hint, nsIInternetSearchContext **aResult)

Variables

static const char kURINC_SearchEngineRoot [] = "NC:SearchEngineRoot"
static const char kURINC_SearchResultsSitesRoot [] = "NC:SearchResultsSitesRoot"
static const char kURINC_LastSearchRoot [] = "NC:LastSearchRoot"
static const char kURINC_SearchCategoryRoot [] = "NC:SearchCategoryRoot"
static const char kURINC_SearchCategoryPrefix [] = "NC:SearchCategory?category="
static const char kURINC_SearchCategoryEnginePrefix [] = "NC:SearchCategory?engine="
static const char kURINC_SearchCategoryEngineBasenamePrefix [] = "NC:SearchCategory?engine=urn:search:engine:"
static const char kURINC_FilterSearchURLsRoot [] = "NC:FilterSearchURLsRoot"
static const char kURINC_FilterSearchSitesRoot [] = "NC:FilterSearchSitesRoot"
static const char kSearchCommand [] = "http://home.netscape.com/NC-rdf#command?"
static const char kEngineProtocol [] = "engine://"
static const char kSearchProtocol [] = "internetsearch:"
static nsIRDFServicegRDFService = nsnull
static nsIRDFContainerUtilsgRDFC = nsnull
static const nsModuleComponentInfo components []

Class Documentation

struct encodings

Definition at line 3726 of file nsInternetSearchService.cpp.

Class Members
const char * numericEncoding
const char * stringEncoding

Define Documentation

#define INTL_PROPERTIES   "chrome://navigator/locale/navigator.properties"

Definition at line 111 of file nsInternetSearchService.cpp.

Definition at line 101 of file nsInternetSearchService.cpp.

#define POSTHEADER_PREFIX   "Content-type: application/x-www-form-urlencoded\r\nContent-Length: "

Definition at line 103 of file nsInternetSearchService.cpp.

#define POSTHEADER_SUFFIX   "\r\n\r\n"

Definition at line 104 of file nsInternetSearchService.cpp.

#define SEARCH_PROPERTIES   "chrome://communicator/locale/search/search-panel.properties"

Definition at line 105 of file nsInternetSearchService.cpp.

Definition at line 341 of file nsInternetSearchService.cpp.

#define SEARCHCONFIG_PROPERTIES   "chrome://navigator/content/searchconfig.properties"

Definition at line 110 of file nsInternetSearchService.cpp.


Function Documentation

static NS_DEFINE_CID ( kRDFServiceCID  ,
NS_RDFSERVICE_CID   
) [static]
static NS_DEFINE_CID ( kRDFContainerCID  ,
NS_RDFCONTAINER_CID   
) [static]
static NS_DEFINE_CID ( kRDFContainerUtilsCID  ,
NS_RDFCONTAINERUTILS_CID   
) [static]
static NS_DEFINE_CID ( kRDFInMemoryDataSourceCID  ,
NS_RDFINMEMORYDATASOURCE_CID   
) [static]
static NS_DEFINE_CID ( kRDFXMLDataSourceCID  ,
NS_RDFXMLDATASOURCE_CID   
) [static]
static NS_DEFINE_CID ( kTextToSubURICID  ,
NS_TEXTTOSUBURI_CID   
) [static]
static NS_DEFINE_CID ( kPrefCID  ,
NS_PREF_CID   
) [static]
nsresult NS_NewInternetSearchContext ( PRUint32  contextType,
nsIRDFResource aParent,
nsIRDFResource aEngine,
nsIUnicodeDecoder aUnicodeDecoder,
const PRUnichar hint,
nsIInternetSearchContext **  aResult 
)

Definition at line 311 of file nsInternetSearchService.cpp.

{
        InternetSearchContext *result =
               new InternetSearchContext(contextType, aParent, aEngine, aUnicodeDecoder, hint);

        if (! result)
               return NS_ERROR_OUT_OF_MEMORY;

        nsresult rv = result->Init();
        if (NS_FAILED(rv)) {
               delete result;
               return rv;
        }

        NS_ADDREF(result);
        *aResult = result;
        return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRInt32 nsString_Find ( const nsAString &  aPattern,
const nsAString &  aSource,
PRBool  aIgnoreCase = PR_FALSE,
PRInt32  aOffset = 0,
PRInt32  aCount = -1 
) [static]

Definition at line 139 of file nsInternetSearchService.cpp.

{
    nsAString::const_iterator start, end;
    aSource.BeginReading(start);
    aSource.EndReading(end);

    // now adjust for the parameters
    start.advance(aOffset);
    if (aCount>0) {
       end = start;         // note that start may have been advanced!
       end.advance(aCount);
    }
    PRBool found;
    if (aIgnoreCase)
       found = FindInReadable(aPattern, start, end,
                            nsCaseInsensitiveStringComparator());
    else
       found = FindInReadable(aPattern, start, end);

    if (!found)
       return kNotFound;

    nsAString::const_iterator originalStart;
    aSource.BeginReading(originalStart);
    return Distance(originalStart, start);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int PR_CALLBACK searchModePrefCallback ( const char *  pref,
void aClosure 
)

Definition at line 346 of file nsInternetSearchService.cpp.

{
       InternetSearchDataSource *searchDS = NS_STATIC_CAST(InternetSearchDataSource *, aClosure);
       if (!searchDS)       return(NS_OK);

       if (searchDS->prefs)
       {
              searchDS->prefs->GetIntPref(pref, &searchDS->gBrowserSearchMode);
#ifdef DEBUG
              printf("searchModePrefCallback: '%s' = %d\n", pref, searchDS->gBrowserSearchMode);
#endif
              searchDS->Assert(searchDS->kNC_LastSearchRoot, searchDS->kNC_LastSearchMode, searchDS->kTrueLiteral, PR_TRUE);
       }
       return(NS_OK);
}

Variable Documentation

Initial value:
 {
    { "Local Search", NS_RDFFINDDATASOURCE_CID,
      NS_LOCALSEARCH_SERVICE_CONTRACTID, LocalSearchDataSourceConstructor },
    { "Local Search", NS_RDFFINDDATASOURCE_CID,
      NS_LOCALSEARCH_DATASOURCE_CONTRACTID, LocalSearchDataSourceConstructor },
    { "Internet Search", NS_RDFSEARCHDATASOURCE_CID,
      NS_INTERNETSEARCH_SERVICE_CONTRACTID, InternetSearchDataSourceConstructor },
    { "Internet Search", NS_RDFSEARCHDATASOURCE_CID,
      NS_INTERNETSEARCH_DATASOURCE_CONTRACTID, InternetSearchDataSourceConstructor },
}

Definition at line 6477 of file nsInternetSearchService.cpp.

Definition at line 363 of file nsInternetSearchService.cpp.

Definition at line 362 of file nsInternetSearchService.cpp.

const char kEngineProtocol[] = "engine://" [static]

Definition at line 335 of file nsInternetSearchService.cpp.

const char kSearchCommand[] = "http://home.netscape.com/NC-rdf#command?" [static]

Definition at line 132 of file nsInternetSearchService.cpp.

const char kSearchProtocol[] = "internetsearch:" [static]

Definition at line 336 of file nsInternetSearchService.cpp.

const char kURINC_FilterSearchSitesRoot[] = "NC:FilterSearchSitesRoot" [static]

Definition at line 131 of file nsInternetSearchService.cpp.

const char kURINC_FilterSearchURLsRoot[] = "NC:FilterSearchURLsRoot" [static]

Definition at line 130 of file nsInternetSearchService.cpp.

const char kURINC_LastSearchRoot[] = "NC:LastSearchRoot" [static]

Definition at line 124 of file nsInternetSearchService.cpp.

const char kURINC_SearchCategoryEngineBasenamePrefix[] = "NC:SearchCategory?engine=urn:search:engine:" [static]

Definition at line 128 of file nsInternetSearchService.cpp.

const char kURINC_SearchCategoryEnginePrefix[] = "NC:SearchCategory?engine=" [static]

Definition at line 127 of file nsInternetSearchService.cpp.

const char kURINC_SearchCategoryPrefix[] = "NC:SearchCategory?category=" [static]

Definition at line 126 of file nsInternetSearchService.cpp.

const char kURINC_SearchCategoryRoot[] = "NC:SearchCategoryRoot" [static]

Definition at line 125 of file nsInternetSearchService.cpp.

const char kURINC_SearchEngineRoot[] = "NC:SearchEngineRoot" [static]

Definition at line 122 of file nsInternetSearchService.cpp.

const char kURINC_SearchResultsSitesRoot[] = "NC:SearchResultsSitesRoot" [static]

Definition at line 123 of file nsInternetSearchService.cpp.