Diff for /chimera/nsCocoaBrowserService.mm between versions 1.4 and 1.8

version 1.4, 2002/02/05 01:17:11 version 1.8, 2002/02/25 08:44:17
Line 47 Line 47
   
 nsAlertController* nsCocoaBrowserService::sController = nsnull;  nsAlertController* nsCocoaBrowserService::sController = nsnull;
 nsCocoaBrowserService* nsCocoaBrowserService::sSingleton = nsnull;  nsCocoaBrowserService* nsCocoaBrowserService::sSingleton = nsnull;
   PRUint32 nsCocoaBrowserService::sNumBrowsers = 0;
   
 // nsCocoaBrowserService implementation  // nsCocoaBrowserService implementation
 nsCocoaBrowserService::nsCocoaBrowserService()  nsCocoaBrowserService::nsCocoaBrowserService()
Line 66  NS_IMPL_ISUPPORTS3(nsCocoaBrowserService Line 67  NS_IMPL_ISUPPORTS3(nsCocoaBrowserService
 nsresult  nsresult
 nsCocoaBrowserService::InitEmbedding()  nsCocoaBrowserService::InitEmbedding()
 {  {
     sNumBrowsers++;
     
   if (sSingleton)    if (sSingleton)
     return NS_OK;      return NS_OK;
   
Line 137  nsCocoaBrowserService::InitEmbedding() Line 140  nsCocoaBrowserService::InitEmbedding()
 }  }
   
 void  void
   nsCocoaBrowserService::BrowserClosed()
   {
       sNumBrowsers--;
       if (!sSingleton && sNumBrowsers == 0) {
           // The app is terminating *and* our count dropped to 0.
           NS_TermEmbedding();
           printf("Shutting down embedding!\n");
       }
   }
   
   void
 nsCocoaBrowserService::TermEmbedding()  nsCocoaBrowserService::TermEmbedding()
 {  {
     NS_RELEASE(sSingleton);      NS_RELEASE(sSingleton);
    printf("Terminating embedding and shutting down.\n");    
    NS_TermEmbedding();    if (sNumBrowsers == 0) {
         NS_TermEmbedding(); // Safe to terminate now.
         printf("Shutting down embedding.\n");
     }
     
     // Otherwise we cannot yet terminate.  We have to let the death of the browser windows
     // induce termination.
 }  }
   
 #define NS_ALERT_NIB_NAME "alert"  #define NS_ALERT_NIB_NAME "alert"
Line 324  nsCocoaBrowserService::ConfirmEx(nsIDOMW Line 344  nsCocoaBrowserService::ConfirmEx(nsIDOMW
                                  const PRUnichar *checkMsg,                                    const PRUnichar *checkMsg, 
                                  PRBool *checkValue, PRInt32 *buttonPressed)                                   PRBool *checkValue, PRInt32 *buttonPressed)
 {  {
  return NS_ERROR_NOT_IMPLEMENTED;  nsAlertController* controller = GetAlertController();
   if (!controller) {
     return NS_ERROR_FAILURE;
   }
 
   NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
   NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
   NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
   NSWindow* window = GetNSWindowForDOMWindow(parent);
 
   NSString* btn1Str = [NSString stringWithCharacters:button0Title length:(button0Title ? nsCRT::strlen(button0Title) : 0)];
   NSString* btn2Str = [NSString stringWithCharacters:button1Title length:(button1Title ? nsCRT::strlen(button1Title) : 0)];
   NSString* btn3Str = [NSString stringWithCharacters:button2Title length:(button2Title ? nsCRT::strlen(button2Title) : 0)];
   
   if (checkValue) {
     BOOL valueBool = *checkValue ? YES : NO;
     
     *buttonPressed = (PRInt32)[controller confirmCheckEx:window title:titleStr text:textStr 
                                button1: btn1Str button2: btn2Str button3: btn3Str
                                checkMsg:msgStr checkValue:&valueBool];
     
     *checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
   }
   else {
     *buttonPressed = (PRInt32)[controller confirmEx:window title:titleStr text:textStr
                                button1: btn1Str button2: btn2Str button3: btn3Str];
   }
   
   printf("Uh-oh! Not posing the confirm yet, but just assuming OK was pressed.\n");
   
   return NS_OK;
 
 }  }
   
 /* boolean prompt (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, inout wstring value, in wstring checkMsg, inout boolean checkValue); */  /* boolean prompt (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, inout wstring value, in wstring checkMsg, inout boolean checkValue); */
Line 467  nsCocoaBrowserService::Select(nsIDOMWind Line 518  nsCocoaBrowserService::Select(nsIDOMWind
                               PRInt32 *outSelection,                                 PRInt32 *outSelection, 
                               PRBool *_retval)                                PRBool *_retval)
 {  {
     printf("Uh-oh. Select has not been implemented.\n");
   return NS_ERROR_NOT_IMPLEMENTED;    return NS_ERROR_NOT_IMPLEMENTED;
 }  }
   
Line 477  nsCocoaBrowserService::CreateChromeWindo Line 529  nsCocoaBrowserService::CreateChromeWindo
                                           PRUint32 chromeFlags,                                             PRUint32 chromeFlags, 
                                           nsIWebBrowserChrome **_retval)                                            nsIWebBrowserChrome **_retval)
 {  {
  return NS_ERROR_NOT_IMPLEMENTED;  if (!parent) {
     printf("Uh-oh. Attempt to create a new browser window with a null parent.  Should not happen in Chimera.\n");
     return NS_ERROR_FAILURE;
   }
     
   nsCOMPtr<nsIWindowCreator> browserChrome(do_QueryInterface(parent));
   return browserChrome->CreateChromeWindow(parent, chromeFlags, _retval);
 }  }
   

Removed from v.1.4  
changed lines
  Added in v.1.8


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>