version 1.16, 2002/02/05 10:16:31
|
version 1.21, 2002/02/13 01:58:55
|
Line 64
|
Line 64
|
// Saving of links/images/docs |
// 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 77
|
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 |
// Cut/copy/paste |
#include "nsIClipboardCommands.h" |
#include "nsIClipboardCommands.h" |
Line 562 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 921 nsHeaderSniffer::OnSecurityChange(nsIWeb
|
Line 934 nsHeaderSniffer::OnSecurityChange(nsIWeb
|
|
|
nsCocoaBrowserService::BrowserClosed(); |
nsCocoaBrowserService::BrowserClosed(); |
|
|
|
printf("NSBrowserView died.\n"); |
|
|
[super dealloc]; |
[super dealloc]; |
} |
} |
|
|
Line 1170 nsHeaderSniffer::OnSecurityChange(nsIWeb
|
Line 1185 nsHeaderSniffer::OnSecurityChange(nsIWeb
|
print->Print(nsnull, nsnull); |
print->Print(nsnull, nsnull); |
} |
} |
|
|
-(void)printPreview |
|
{ |
|
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->PrintPreview(nsnull); |
|
} |
|
|
|
-(void)findInPage |
-(void)findInPage |
{ |
{ |
FindDlgController* findDialog = [[FindDlgController alloc] initWithWindowNibName: @"FindDialog"]; |
FindDlgController* findDialog = [[FindDlgController alloc] initWithWindowNibName: @"FindDialog"]; |
Line 1217 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 1261 nsHeaderSniffer::OnSecurityChange(nsIWeb
|
Line 1283 nsHeaderSniffer::OnSecurityChange(nsIWeb
|
clipboard->SelectAll(); |
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()]; |
|
} |
|
|
|
- (void)setActive: (BOOL)aIsActive |
|
{ |
|
nsCOMPtr<nsIWebBrowserFocus> wbf(do_QueryInterface(_webBrowser)); |
|
if (aIsActive) |
|
wbf->Activate(); |
|
else |
|
wbf->Deactivate(); |
|
} |
@end |
@end |
|
|