Exemple #1
0
// (static) Asynchronously creates a cached ICO file on disk for the favicon of
// page aFaviconPageURI and stores it to disk at the path of aICOFile.
nsresult
JumpListShortcut::CacheIconFileFromFaviconURIAsync(nsCOMPtr<nsIURI> aFaviconPageURI,
        nsCOMPtr<nsIFile> aICOFile,
        nsCOMPtr<nsIThread> &aIOThread)
{
    // Obtain the favicon service and get the favicon for the specified page
    nsCOMPtr<mozIAsyncFavicons> favIconSvc(
        do_GetService("@mozilla.org/browser/favicon-service;1"));
    NS_ENSURE_TRUE(favIconSvc, NS_ERROR_FAILURE);

    nsCOMPtr<nsIFaviconDataCallback> callback =
        new AsyncFaviconDataReady(aFaviconPageURI, aIOThread);

    favIconSvc->GetFaviconDataForPage(aFaviconPageURI, callback);
    return NS_OK;
}
Exemple #2
0
// (static) Asynchronously creates a cached ICO file on disk for the favicon of
// page aFaviconPageURI and stores it to disk at the path of aICOFile.
nsresult 
  FaviconHelper::CacheIconFileFromFaviconURIAsync(nsCOMPtr<nsIURI> aFaviconPageURI,
                                                  nsCOMPtr<nsIFile> aICOFile,
                                                  nsCOMPtr<nsIThread> &aIOThread,
                                                  bool aURLShortcut)
{
#ifdef MOZ_PLACES
  // Obtain the favicon service and get the favicon for the specified page
  nsCOMPtr<mozIAsyncFavicons> favIconSvc(
    do_GetService("@mozilla.org/browser/favicon-service;1"));
  NS_ENSURE_TRUE(favIconSvc, NS_ERROR_FAILURE);

  nsCOMPtr<nsIFaviconDataCallback> callback = 
    new mozilla::widget::AsyncFaviconDataReady(aFaviconPageURI, 
                                               aIOThread, 
                                               aURLShortcut);

  favIconSvc->GetFaviconDataForPage(aFaviconPageURI, callback);
#endif
  return NS_OK;
}