Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
CHBrowserService.mm File Reference
#import "NSString+Utils.h"
#import "CHBrowserService.h"
#import "CHDownloadFactories.h"
#import "CHBrowserView.h"
#include "nsIWindowWatcher.h"
#include "nsIWebBrowserChrome.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsIGenericFactory.h"
#include "nsIComponentRegistrar.h"
#include "nsEmbedAPI.h"
#include "nsIDownload.h"
#include "nsIExternalHelperAppService.h"

Go to the source code of this file.

Defines

#define NS_HELPERAPPLAUNCHERDIALOG_CID   {0xf68578eb, 0x6ec2, 0x4169, {0xae, 0x19, 0x8c, 0x62, 0x43, 0xf0, 0xab, 0xe1}}
#define NS_ALERT_NIB_NAME   "alert"

Functions

 NS_IMPL_ISUPPORTS3 (CHBrowserService, nsIWindowCreator, nsIFactory, nsIHelperAppLauncherDialog) nsresult CHBrowserService

Variables

NSStringTermEmbeddingNotificationName = @"TermEmbedding"
NSStringXPCOMShutDownNotificationName = @"XPCOMShutDown"

Define Documentation

#define NS_ALERT_NIB_NAME   "alert"

Definition at line 164 of file CHBrowserService.mm.

#define NS_HELPERAPPLAUNCHERDIALOG_CID   {0xf68578eb, 0x6ec2, 0x4169, {0xae, 0x19, 0x8c, 0x62, 0x43, 0xf0, 0xab, 0xe1}}

Function Documentation

Definition at line 72 of file CHBrowserService.mm.

{
  sNumBrowsers++;
  
  if (sSingleton)
    return NS_OK;

  sSingleton = new CHBrowserService();
  if (!sSingleton)
    return NS_ERROR_OUT_OF_MEMORY;
  NS_ADDREF(sSingleton);
  
  // Register as the window creator
  nsCOMPtr<nsIWindowWatcher> watcher(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
  if (!watcher) 
    return NS_ERROR_FAILURE;
  watcher->SetWindowCreator(sSingleton);

  nsCOMPtr<nsIComponentRegistrar> cr;
  NS_GetComponentRegistrar(getter_AddRefs(cr));
  if ( !cr )
    return NS_ERROR_FAILURE;

  // replace the external helper app dialog with our own
  #define NS_HELPERAPPLAUNCHERDIALOG_CID \
          {0xf68578eb, 0x6ec2, 0x4169, {0xae, 0x19, 0x8c, 0x62, 0x43, 0xf0, 0xab, 0xe1}}
  static NS_DEFINE_CID(kHelperDlgCID, NS_HELPERAPPLAUNCHERDIALOG_CID);
  nsresult rv = cr->RegisterFactory(kHelperDlgCID, NS_IHELPERAPPLAUNCHERDLG_CLASSNAME, NS_IHELPERAPPLAUNCHERDLG_CONTRACTID,
                            sSingleton);
  
  // replace the downloader with our own which does not rely on the xpfe downlaod manager
  nsCOMPtr<nsIFactory> downloadFactory;
  rv = NewDownloadListenerFactory(getter_AddRefs(downloadFactory));
  if (NS_FAILED(rv)) return rv;
  
  static NS_DEFINE_CID(kDownloadCID, NS_DOWNLOAD_CID);
  rv = cr->RegisterFactory(kDownloadCID, "Download", NS_TRANSFER_CONTRACTID, downloadFactory);

  return rv;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 54 of file CHBrowserService.mm.

Definition at line 55 of file CHBrowserService.mm.