Diff for /chimera/NSBrowserView.mm between versions 1.4 and 1.20

version 1.4, 2002/02/04 01:33:00 version 1.20, 2002/02/12 01:47:57
Line 37 Line 37
   
 #import "NSBrowserView.h"  #import "NSBrowserView.h"
 #import "ProgressDlgController.h"  #import "ProgressDlgController.h"
   #import "FindDlgController.h"
 #import "nsCocoaBrowserService.h"  #import "nsCocoaBrowserService.h"
   
 // Embedding includes  // Embedding includes
Line 56 Line 57
 #include "nsXPIDLString.h"  #include "nsXPIDLString.h"
 #include "nsCOMPtr.h"  #include "nsCOMPtr.h"
   
   // Printing
   #include "nsIWebBrowserPrint.h"
   #include "nsIPrintSettings.h"
   
   // Saving of links/images/docs
 #include "nsIWebBrowserFocus.h"  #include "nsIWebBrowserFocus.h"
 #include "nsIDOMHTMLDocument.h"  #include "nsIDOMHTMLDocument.h"
#include "nsIDocument.h"#include "nsIDOMNSDocument.h"
 #include "nsIDOMLocation.h"
 #include "nsIURL.h"  #include "nsIURL.h"
 #include "nsIWebBrowserPersist.h"  #include "nsIWebBrowserPersist.h"
 #include "nsIProperties.h"  #include "nsIProperties.h"
Line 71 Line 78
 #include "nsISHistory.h"  #include "nsISHistory.h"
 #include "nsIHistoryEntry.h"  #include "nsIHistoryEntry.h"
 #include "nsISHEntry.h"  #include "nsISHEntry.h"
   #include "nsNetUtil.h"
   
   // Cut/copy/paste
   #include "nsIClipboardCommands.h"
   #include "nsIInterfaceRequestorUtils.h"
   
 const char* persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1";  const char* persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1";
 const char* dirServiceContractID = "@mozilla.org/file/directory_service;1";  const char* dirServiceContractID = "@mozilla.org/file/directory_service;1";
Line 552  nsCocoaBrowserListener::OnStatusChange(n Line 564  nsCocoaBrowserListener::OnStatusChange(n
                                        nsresult aStatus,                                          nsresult aStatus, 
                                        const PRUnichar *aMessage)                                         const PRUnichar *aMessage)
 {  {
     nsCAutoString msg; msg.AssignWithConversion(aMessage);
     
     NSString* str = [NSString stringWithCString:msg.get()];
     
     NSEnumerator* enumerator = [mListeners objectEnumerator];
     id obj;
    
     while ((obj = [enumerator nextObject])) {
       [obj onStatusChange: str];
     }
   
   return NS_OK;    return NS_OK;
 }  }
   
Line 898  nsHeaderSniffer::OnSecurityChange(nsIWeb Line 921  nsHeaderSniffer::OnSecurityChange(nsIWeb
   return self;    return self;
 }  }
   
   - (void)destroyWebBrowser
   {
     nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(_webBrowser);
     baseWin->Destroy();
   }
   
 - (void)dealloc   - (void)dealloc 
 {  {
   NS_RELEASE(_listener);    NS_RELEASE(_listener);
   NS_IF_RELEASE(_webBrowser);    NS_IF_RELEASE(_webBrowser);
  nsCocoaBrowserService::TermEmbedding();  
  nsCocoaBrowserService::BrowserClosed();
   
   printf("NSBrowserView died.\n");
   
   [super dealloc];    [super dealloc];
 }  }
   
Line 1143  nsHeaderSniffer::OnSecurityChange(nsIWeb Line 1175  nsHeaderSniffer::OnSecurityChange(nsIWeb
     webPersist->SaveURI(aURI, nsnull, tmpFile);      webPersist->SaveURI(aURI, nsnull, tmpFile);
 }  }
   
   -(void)printDocument
   {
       nsCOMPtr<nsIDOMWindow> domWindow;
       _webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
       nsCOMPtr<nsIInterfaceRequestor> ir(do_QueryInterface(domWindow));
       nsCOMPtr<nsIWebBrowserPrint> print;
       ir->GetInterface(NS_GET_IID(nsIWebBrowserPrint), getter_AddRefs(print));
       print->Print(nsnull, nsnull);
   }
   
   -(void)findInPage
   {
       FindDlgController* findDialog = [[FindDlgController alloc] initWithWindowNibName: @"FindDialog"];
       nsCOMPtr<nsIWebBrowserFocus> wbf(do_QueryInterface(_webBrowser));
       nsCOMPtr<nsIDOMWindow> rootWindow;
       nsCOMPtr<nsIDOMWindow> focusedWindow;
       _webBrowser->GetContentDOMWindow(getter_AddRefs(rootWindow));
       wbf->GetFocusedWindow(getter_AddRefs(focusedWindow));
       if (!focusedWindow)
           focusedWindow = rootWindow;
       nsCOMPtr<nsIWebBrowserFind> webFind(do_GetInterface(_webBrowser));
       nsCOMPtr<nsIWebBrowserFindInFrames> framesFind(do_QueryInterface(webFind));
       framesFind->SetRootSearchFrame(rootWindow);
       framesFind->SetCurrentSearchFrame(focusedWindow);
       
       [findDialog setFind: webFind];
       [findDialog showWindow: findDialog];
   }
   
   -(void)findAgain
   {
   }
   
 -(void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList  -(void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
 {  {
     nsCOMPtr<nsIWebBrowserFocus> wbf(do_QueryInterface(_webBrowser));      nsCOMPtr<nsIWebBrowserFocus> wbf(do_QueryInterface(_webBrowser));
Line 1157  nsHeaderSniffer::OnSecurityChange(nsIWeb Line 1222  nsHeaderSniffer::OnSecurityChange(nsIWeb
     domWindow->GetDocument(getter_AddRefs(domDocument));      domWindow->GetDocument(getter_AddRefs(domDocument));
     if (!domDocument)      if (!domDocument)
         return;          return;
       nsCOMPtr<nsIDOMNSDocument> nsDoc(do_QueryInterface(domDocument));
       if (!nsDoc)
           return;
       nsCOMPtr<nsIDOMLocation> location;
       nsDoc->GetLocation(getter_AddRefs(location));
       if (!location)
           return;
       nsAutoString urlStr;
       location->GetHref(urlStr);
       nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
       nsCOMPtr<nsIURI> url;
       nsresult rv = NS_NewURI(getter_AddRefs(url), urlCStr.get());
       if (NS_FAILED(rv))
           return;
           
   #if 0
     nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDocument));      nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDocument));
     if (!doc)      if (!doc)
         return;          return;
     nsCOMPtr<nsIURI> url;      nsCOMPtr<nsIURI> url;
     doc->GetDocumentURL(getter_AddRefs(url));      doc->GetDocumentURL(getter_AddRefs(url));
   #endif
             
     [self saveInternal: url.get()      [self saveInternal: url.get()
           withDocument: domDocument            withDocument: domDocument
Line 1170  nsHeaderSniffer::OnSecurityChange(nsIWeb Line 1252  nsHeaderSniffer::OnSecurityChange(nsIWeb
           filterList: aFilterList];            filterList: aFilterList];
 }  }
   
   
   -(IBAction)cut:(id)aSender
   {
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(_webBrowser));
       clipboard->CutSelection();
   }
   
   -(IBAction)copy:(id)aSender
   {
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(_webBrowser));
       clipboard->CopySelection();
   }
   
   -(IBAction)paste:(id)aSender
   {
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(_webBrowser));
       clipboard->Paste();
   }
   
   -(IBAction)clear:(id)aSender
   {
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(_webBrowser));
       clipboard->SelectNone();
   }
   
   -(IBAction)selectAll:(id)aSender
   {
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(_webBrowser));
       clipboard->SelectAll();
   }
   
   -(NSString*)getCurrentURLSpec
   {
       NSString* empty = @"";
       nsCOMPtr<nsIDOMWindow> domWindow;
       _webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
       if (!domWindow)
           return empty;
       
       nsCOMPtr<nsIDOMDocument> domDocument;
       domWindow->GetDocument(getter_AddRefs(domDocument));
       if (!domDocument)
           return empty;
       nsCOMPtr<nsIDOMNSDocument> nsDoc(do_QueryInterface(domDocument));
       if (!nsDoc)
           return empty;
       nsCOMPtr<nsIDOMLocation> location;
       nsDoc->GetLocation(getter_AddRefs(location));
       if (!location)
           return empty;
       nsAutoString urlStr;
       location->GetHref(urlStr);
       nsCAutoString urlCStr; urlCStr.AssignWithConversion(urlStr);
       
       return [NSString stringWithCString: urlCStr.get()];
   }
 @end  @end
   

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


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