From 0e128bb5efe5eea6cdfd59e304c7b3602aea8306 Mon Sep 17 00:00:00 2001 From: "ccarlen%netscape.com" Date: Fri, 15 Dec 2000 13:33:56 +0000 Subject: [PATCH] NOT PART OF THE BUILD Added context menu support Added way to make window properly from chrome flags git-svn-id: svn://10.0.0.236/trunk@83723 18797224-902f-48f8-a5cc-f745e15eee43 --- .../powerplant/source/CBrowserWindow.cp | 409 ++++++++++++++++-- .../powerplant/source/CBrowserWindow.h | 117 +++-- 2 files changed, 442 insertions(+), 84 deletions(-) diff --git a/mozilla/embedding/browser/powerplant/source/CBrowserWindow.cp b/mozilla/embedding/browser/powerplant/source/CBrowserWindow.cp index fb1a26ab094..6ba40bc5c4a 100644 --- a/mozilla/embedding/browser/powerplant/source/CBrowserWindow.cp +++ b/mozilla/embedding/browser/powerplant/source/CBrowserWindow.cp @@ -21,16 +21,23 @@ */ #include "nsString.h" +#include "nsReadableUtils.h" #include "nsWidgetsCID.h" #include "nsIComponentManager.h" #include "nsComponentManagerUtils.h" +#include "nsIServiceManager.h" #include "nsIChannel.h" #include "nsIURI.h" #include "nsXPIDLString.h" +#include "nsIContentViewer.h" +#include "nsIMarkupDocumentViewer.h" +#include "nsIDOMHTMLLinkElement.h" +#include "nsIDOMHTMLAnchorElement.h" #include "CBrowserWindow.h" #include "CBrowserShell.h" #include "CWebBrowserChrome.h" +#include "CWebBrowserCMAttachment.h" #include "CThrobber.h" #include "ApplIDs.h" #include "UMacUnicode.h" @@ -41,6 +48,8 @@ #include #include +#include + // CBrowserWindow: // A simple browser window that hooks up a CWebShell to a minimal set of controls // (Back, Forward and Stop buttons + URL field + status bar). @@ -55,7 +64,7 @@ enum paneID_WebShellView = 'WebS', paneID_StatusBar = 'Stat', paneID_Throbber = 'THRB', - paneID_ProgressBar = 'Prog' + paneID_ProgressBar = 'Prog' }; // CIDs @@ -66,10 +75,13 @@ static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID); // --------------------------------------------------------------------------- CBrowserWindow::CBrowserWindow() : - mBrowserShell(NULL), mBrowserChrome(NULL), - mURLField(NULL), mStatusBar(NULL), mThrobber(NULL), - mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL), - mProgressBar(NULL) + mBrowserShell(NULL), mBrowserChrome(NULL), + mURLField(NULL), mStatusBar(NULL), mThrobber(NULL), + mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL), + mProgressBar(NULL), mBusy(false), + mInitialLoadComplete(false), mShowOnInitialLoad(false), + mSizeToContent(true), + mContextMenuContext(nsIContextMenuListener::CONTEXT_NONE) { nsresult rv = CommonConstruct(); if (NS_FAILED(rv)) @@ -77,17 +89,44 @@ CBrowserWindow::CBrowserWindow() : } +// --------------------------------------------------------------------------- +// ¥ CBrowserWindow Parameterized Constructor [public] +// --------------------------------------------------------------------------- + +CBrowserWindow::CBrowserWindow(LCommander* inSuperCommander, + const Rect& inGlobalBounds, + ConstStringPtr inTitle, + SInt16 inProcID, + UInt32 inAttributes, + WindowPtr inBehind) : + LWindow(inSuperCommander, inGlobalBounds, inTitle, inProcID, inAttributes, inBehind), + mBrowserShell(NULL), mBrowserChrome(NULL), + mURLField(NULL), mStatusBar(NULL), mThrobber(NULL), + mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL), + mProgressBar(NULL), mBusy(false), + mInitialLoadComplete(false), mShowOnInitialLoad(false), + mSizeToContent(true), + mContextMenuContext(nsIContextMenuListener::CONTEXT_NONE) +{ + nsresult rv = CommonConstruct(); + if (NS_FAILED(rv)) + Throw_(NS_ERROR_GET_CODE(rv)); +} + // --------------------------------------------------------------------------- // ¥ CBrowserWindow Stream Constructor [public] // --------------------------------------------------------------------------- -CBrowserWindow::CBrowserWindow(LStream* inStream) - : LWindow(inStream), - mBrowserShell(NULL), mBrowserChrome(NULL), - mURLField(NULL), mStatusBar(NULL), mThrobber(NULL), - mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL), - mProgressBar(NULL) +CBrowserWindow::CBrowserWindow(LStream* inStream) : + LWindow(inStream), + mBrowserShell(NULL), mBrowserChrome(NULL), + mURLField(NULL), mStatusBar(NULL), mThrobber(NULL), + mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL), + mProgressBar(NULL), mBusy(false), + mInitialLoadComplete(false), mShowOnInitialLoad(false), + mSizeToContent(true), + mContextMenuContext(nsIContextMenuListener::CONTEXT_NONE) { nsresult rv = CommonConstruct(); if (NS_FAILED(rv)) @@ -113,6 +152,109 @@ CBrowserWindow::~CBrowserWindow() } +CBrowserWindow* CBrowserWindow::CreateWindow(PRUint32 chromeFlags, PRInt32 width, PRInt32 height) +{ + const SInt16 kToolBarHeight = 34; + + CBrowserWindow *theWindow; + + if (chromeFlags == nsIWebBrowserChrome::CHROME_DEFAULT || chromeFlags == nsIWebBrowserChrome::CHROME_ALL) + { + theWindow = dynamic_cast(LWindow::CreateWindow(wind_BrowserWindow, LCommander::GetTopCommander())); + ThrowIfNil_(theWindow); + } + else + { + // Bounds - Set to an arbitrary rect - we'll size it after all the subviews are in. + Rect globalBounds; + globalBounds.left = 4; + globalBounds.top = 42; + globalBounds.right = globalBounds.left + 600; + globalBounds.bottom = globalBounds.top + 400; + + // ProcID and attributes + short windowDefProc; + UInt32 windowAttrs = (windAttr_Enabled | windAttr_Targetable); + if (chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG) + { + windowAttrs |= windAttr_Modal; + + if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR) + { + windowDefProc = kWindowMovableModalDialogProc; + windowAttrs |= windAttr_TitleBar; + } + else + windowDefProc = kWindowModalDialogProc; + } + else + { + windowAttrs |= windAttr_Regular; + + if (chromeFlags & nsIWebBrowserChrome::CHROME_WITH_SIZE) + { + windowDefProc = kWindowGrowDocumentProc; + windowAttrs |= windAttr_Resizable; + } + else + windowDefProc = kWindowDocumentProc; + + if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_CLOSE) + windowAttrs |= windAttr_CloseBox; + } + + theWindow = new CBrowserWindow(LCommander::GetTopCommander(), globalBounds, "\p", windowDefProc, windowAttrs, window_InFront); + ThrowIfNil_(theWindow); + theWindow->SetUserCon(wind_BrowserWindow); + + SPaneInfo aPaneInfo; + SViewInfo aViewInfo; + + aPaneInfo.paneID = paneID_WebShellView; + aPaneInfo.width = globalBounds.right - globalBounds.left; + aPaneInfo.height = globalBounds.bottom - globalBounds.top; + if (!(chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG) && chromeFlags & nsIWebBrowserChrome::CHROME_WITH_SIZE) + aPaneInfo.height -= 15; + if (chromeFlags & nsIWebBrowserChrome::CHROME_TOOLBAR) + aPaneInfo.height -= kToolBarHeight; + aPaneInfo.visible = true; + aPaneInfo.enabled = true; + aPaneInfo.bindings.left = true; + aPaneInfo.bindings.top = true; + aPaneInfo.bindings.right = true; + aPaneInfo.bindings.bottom = true; + aPaneInfo.left = 0; + aPaneInfo.top = (chromeFlags & nsIWebBrowserChrome::CHROME_TOOLBAR) ? kToolBarHeight - 1 : 0; + aPaneInfo.userCon = 0; + aPaneInfo.superView = theWindow; + + aViewInfo.imageSize.width = 0; + aViewInfo.imageSize.height = 0; + aViewInfo.scrollPos.h = aViewInfo.scrollPos.v = 0; + aViewInfo.scrollUnit.h = aViewInfo.scrollUnit.v = 1; + aViewInfo.reconcileOverhang = 0; + + CBrowserShell *aShell = new CBrowserShell(aPaneInfo, aViewInfo); + ThrowIfNil_(aShell); + aShell->PutInside(theWindow, false); + + // Now the window is constructed... + theWindow->FinishCreate(); + } + + Rect theBounds; + theWindow->GetGlobalBounds(theBounds); + if (width == -1) + width = theBounds.right - theBounds.left; + if (height == -1) + height = theBounds.bottom - theBounds.top; + + theWindow->ResizeWindowTo(width, height); + + return theWindow; +} + + NS_IMETHODIMP CBrowserWindow::CommonConstruct() { nsresult rv; @@ -156,6 +298,7 @@ void CBrowserWindow::FinishCreateSelf() { mBrowserShell = dynamic_cast(FindPaneByID(paneID_WebShellView)); ThrowIfNULL_(mBrowserShell); // Curtains if we don't have this + SetLatentSub(mBrowserShell); // Tell our CBrowserShell about the chrome mBrowserShell->SetTopLevelWindow(mBrowserChrome); @@ -166,9 +309,6 @@ void CBrowserWindow::FinishCreateSelf() // window with various chrome flags, we may or may not have // all of these subviews so don't fail if they don't exist mURLField = dynamic_cast(FindPaneByID(paneID_URLField)); - if (mURLField) - SwitchTarget(mURLField); - mStatusBar = dynamic_cast(FindPaneByID(paneID_StatusBar)); mThrobber = dynamic_cast(FindPaneByID(paneID_Throbber)); mProgressBar = dynamic_cast(FindPaneByID(paneID_ProgressBar)); @@ -233,6 +373,60 @@ Boolean CBrowserWindow::ObeyCommand(CommandT inCommand, switch (inCommand) { + case cmd_OpenLinkInNewWindow: + { + nsresult rv; + + // Get the URL from the link + ThrowIfNil_(mContextMenuDOMNode); + nsCOMPtr linkElement(do_QueryInterface(mContextMenuDOMNode, &rv)); + ThrowIfError_(rv); + + nsAutoString href; + rv = linkElement->GetHref(href); + ThrowIfError_(rv); + + nsCAutoString urlSpec; + CopyUCS2toASCII(href, urlSpec); + + // Send an AppleEvent to ourselves to open a new window with the given URL + + // IMPORTANT: We need to make our target address using a ProcessSerialNumber + // from GetCurrentProcess. This will cause our AppleEvent to be handled from + // the event loop. Creating and showing a new window before the context menu + // click is done being processed is fatal. If we make the target address with a + // ProcessSerialNumber in which highLongOfPSN == 0 && lowLongOfPSN == kCurrentProcess, + // the event will be dispatched to us directly and we die. + + OSErr err; + ProcessSerialNumber currProcess; + StAEDescriptor selfAddrDesc; + + err = ::GetCurrentProcess(&currProcess); + ThrowIfOSErr_(err); + err = ::AECreateDesc(typeProcessSerialNumber, (Ptr) &currProcess, + sizeof(currProcess), selfAddrDesc); + ThrowIfOSErr_(err); + + AppleEvent getURLEvent; + err = ::AECreateAppleEvent(kInternetEventClass, kAEGetURL, + selfAddrDesc, + kAutoGenerateReturnID, + kAnyTransactionID, + &getURLEvent); + ThrowIfOSErr_(err); + + StAEDescriptor urlDesc(typeChar, urlSpec.GetBuffer(), urlSpec.Length()); + + err = ::AEPutParamDesc(&getURLEvent, keyDirectObject, urlDesc); + if (err) { + ::AEDisposeDesc(&getURLEvent); + Throw_(err); + } + UAppleEventsMgr::SendAppleEvent(getURLEvent); + } + break; + case paneID_BackButton: mBrowserShell->Back(); break; @@ -255,21 +449,13 @@ Boolean CBrowserWindow::ObeyCommand(CommandT inCommand, } break; - case CBrowserShell::cmd_Find: - mBrowserShell->Find(); - break; - - case CBrowserShell::cmd_FindNext: - mBrowserShell->FindNext(); - break; - default: - cmdHandled = false; - break; + cmdHandled = false; + break; } if (!cmdHandled) - cmdHandled = Inherited::ObeyCommand(inCommand, ioParam); + cmdHandled = LWindow::ObeyCommand(inCommand, ioParam); return cmdHandled; } @@ -278,9 +464,6 @@ Boolean CBrowserWindow::ObeyCommand(CommandT inCommand, // ¥ FindCommandStatus // --------------------------------------------------------------------------- // This function enables menu commands. -// Although cmd_Find and cmd_FindNext are handled by CBrowserShell, we handle them -// here because we want them to be enabled even when the CBrowserShell is not in -// the target chain. void CBrowserWindow::FindCommandStatus( @@ -293,17 +476,45 @@ CBrowserWindow::FindCommandStatus( switch (inCommand) { - case CBrowserShell::cmd_Find: - outEnabled = true; + case cmd_OpenLinkInNewWindow: + outEnabled = (mContextMenuContext & nsIContextMenuListener::CONTEXT_LINK) != 0; break; - case CBrowserShell::cmd_FindNext: - outEnabled = mBrowserShell->CanFindNext(); - break; + case cmd_Back: + outEnabled = mBrowserShell->CanGoBack(); + break; + + case cmd_Forward: + outEnabled = mBrowserShell->CanGoForward(); + break; + + case cmd_Stop: + outEnabled = mBusy; + break; + + case cmd_Reload: + outEnabled = true; + break; + + case cmd_ViewPageSource: + outEnabled = true; + break; + + case cmd_ViewImage: + outEnabled = (mContextMenuContext & nsIContextMenuListener::CONTEXT_IMAGE) != 0; + break; + + case cmd_CopyLinkLocation: + outEnabled = (mContextMenuContext & nsIContextMenuListener::CONTEXT_LINK) != 0; + break; + case cmd_CopyImageLocation: + outEnabled = (mContextMenuContext & nsIContextMenuListener::CONTEXT_IMAGE) != 0; + break; + default: - PP_PowerPlant::LCommander::FindCommandStatus(inCommand, outEnabled, - outUsesMark, outMark, outName); + LWindow::FindCommandStatus(inCommand, outEnabled, + outUsesMark, outMark, outName); break; } } @@ -320,6 +531,24 @@ NS_METHOD CBrowserWindow::GetWidget(nsIWidget** aWidget) } +NS_METHOD CBrowserWindow::SizeToContent() +{ + nsCOMPtr aContentViewer; + mBrowserShell->GetContentViewer(getter_AddRefs(aContentViewer)); + NS_ENSURE_TRUE(aContentViewer, NS_ERROR_FAILURE); + nsCOMPtr markupViewer(do_QueryInterface(aContentViewer)); + NS_ENSURE_TRUE(markupViewer, NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(markupViewer->SizeToContent(), NS_ERROR_FAILURE); + + return NS_OK; +} + +NS_METHOD CBrowserWindow::Stop() +{ + return mBrowserShell->Stop(); +} + + //***************************************************************************** //*** Chrome Interraction //***************************************************************************** @@ -328,11 +557,10 @@ NS_METHOD CBrowserWindow::SetStatus(const PRUnichar* aStatus) { if (mStatusBar) { - nsAutoString statusStr(aStatus); - Str255 aStr; + nsCAutoString cStr; - UMacUnicode::StringToStr255(statusStr, aStr); - mStatusBar->SetDescriptor(aStr); + CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(aStatus), cStr); + mStatusBar->SetText(const_cast(cStr.GetBuffer()), cStr.Length()); } return NS_OK; } @@ -341,10 +569,10 @@ NS_METHOD CBrowserWindow::SetLocation(const nsString& aLocation) { if (mURLField) { - Str255 aStr; + nsCAutoString cStr; - UMacUnicode::StringToStr255(aLocation, aStr); - mURLField->SetDescriptor(aStr); + CPlatformUCSConversion::GetInstance()->UCSToPlatform(aLocation, cStr); + mURLField->SetText(const_cast(cStr.GetBuffer()), cStr.Length()); } return NS_OK; } @@ -363,6 +591,8 @@ NS_METHOD CBrowserWindow::OnStatusNetStart(nsIWebProgress *progress, nsIRequest if (mStopButton) mStopButton->Enable(); + mBusy = true; + // Inform any other interested parties // Actually, all of the above stuff should done through // broadcasters and listeners. But for demo's sake this @@ -392,6 +622,22 @@ NS_METHOD CBrowserWindow::OnStatusNetStop(nsIWebProgress *progress, nsIRequest * if (mStopButton) mStopButton->Disable(); + // If this is our first load, check to see if we need to be sized/shown. + if (!mInitialLoadComplete) { + if (mSizeToContent) { + SizeToContent(); + mSizeToContent = false; + } + if (mShowOnInitialLoad) { + Show(); + Select(); + mShowOnInitialLoad = false; + } + mInitialLoadComplete = true; + } + + mBusy = false; + // Inform any other interested parties // Actually, all of the above stuff should done through // broadcasters and listeners. But for demo's sake this @@ -422,3 +668,82 @@ NS_METHOD CBrowserWindow::OnProgressChange(nsIWebProgress *progress, nsIRequest return NS_OK; } +NS_METHOD CBrowserWindow::SetVisibility(PRBool aVisibility) +{ + // If we are waiting for content to load in order to size ourself, + // defer making ourselves visible until the load completes. + + if (aVisibility) { + if (!mSizeToContent || mInitialLoadComplete) { + Show(); + Select(); + } + else + mShowOnInitialLoad = true; + } + else + Hide(); + + return NS_OK; +} + + +NS_METHOD CBrowserWindow::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) +{ + // Find our CWebBrowserCMAttachment, if any + CWebBrowserCMAttachment *aCMAttachment = nsnull; + const TArray* theAttachments = GetAttachmentsList(); + + if (theAttachments) { + TArrayIterator iterate(*theAttachments); + + LAttachment* theAttach; + while (iterate.Next(theAttach)) { + aCMAttachment = dynamic_cast(theAttach); + if (aCMAttachment != nil) + break; + } + } + if (!aCMAttachment) { + NS_ASSERTION(PR_FALSE, "No CWebBrowserCMAttachment"); + return NS_OK; + } + + Boolean bHandleClick = true; + SInt16 cmdListResID; + + if (aContextFlags & nsIContextMenuListener::CONTEXT_LINK) { + cmdListResID = mcmd_ContextLinkCmds; + } + else if (aContextFlags & nsIContextMenuListener::CONTEXT_IMAGE) { + cmdListResID = mcmd_ContextImageCmds; + } + else if (aContextFlags & nsIContextMenuListener::CONTEXT_DOCUMENT) { + cmdListResID = mcmd_ContextDocumentCmds; + } + else if (aContextFlags & nsIContextMenuListener::CONTEXT_TEXT) { + cmdListResID = mcmd_ContextTextCmds; + } + else { + bHandleClick = false; + mContextMenuContext = nsIContextMenuListener::CONTEXT_NONE; + mContextMenuDOMNode = nsnull; + } + + + if (bHandleClick) { + + // Call OSEventAvail with an event mask of zero which will return a + // null event but will fill in the mouse location and modifier keys. + + EventRecord macEvent; + ::OSEventAvail(0, &macEvent); + + mContextMenuContext = aContextFlags; + mContextMenuDOMNode = aNode; + aCMAttachment->SetCommandList(cmdListResID); + aCMAttachment->DoContextMenuClick(macEvent); + } + + return NS_OK; +} diff --git a/mozilla/embedding/browser/powerplant/source/CBrowserWindow.h b/mozilla/embedding/browser/powerplant/source/CBrowserWindow.h index ffeca62672e..207a29c73ad 100644 --- a/mozilla/embedding/browser/powerplant/source/CBrowserWindow.h +++ b/mozilla/embedding/browser/powerplant/source/CBrowserWindow.h @@ -43,6 +43,8 @@ #include "nsIWidget.h" #endif +#include "nsIWebBrowserChrome.h" + class CBrowserShell; class CWebBrowserChrome; class LEditText; @@ -54,6 +56,9 @@ class nsIDocumentLoader; class nsIURI; class nsIRequest; class nsIWebProgress; +class CWebBrowserCMAttachment; +class nsIDOMEvent; +class nsIDOMNode; // CBrowserWindow: // A simple browser window that hooks up a CBrowserShell to a minimal set of controls @@ -61,45 +66,62 @@ class nsIWebProgress; class CBrowserWindow : public LWindow, - public LListener, - public LBroadcaster + public LListener, + public LBroadcaster { private: - typedef LWindow Inherited; + typedef LWindow Inherited; - friend class CWebBrowserChrome; + friend class CWebBrowserChrome; public: enum { class_ID = FOUR_CHAR_CODE('BroW') }; - CBrowserWindow(); - CBrowserWindow(LStream* inStream); + CBrowserWindow(); + CBrowserWindow(LCommander* inSuperCommander, + const Rect& inGlobalBounds, + ConstStringPtr inTitle, + SInt16 inProcID, + UInt32 inAttributes, + WindowPtr inBehind); + CBrowserWindow(LStream* inStream); - virtual ~CBrowserWindow(); + virtual ~CBrowserWindow(); + static CBrowserWindow* CreateWindow(PRUint32 chromeFlags, PRInt32 width, PRInt32 height); - virtual void FinishCreate(); - virtual void FinishCreateSelf(); - virtual void ResizeFrameBy(SInt16 inWidthDelta, + virtual void FinishCreate(); + virtual void FinishCreateSelf(); + virtual void ResizeFrameBy(SInt16 inWidthDelta, SInt16 inHeightDelta, - Boolean inRefresh); - virtual void ShowSelf(); + Boolean inRefresh); + virtual void ShowSelf(); - virtual void ListenToMessage(MessageT inMessage, + virtual void ListenToMessage(MessageT inMessage, void* ioParam); - virtual Boolean ObeyCommand(CommandT inCommand, - void *ioParam); + virtual Boolean ObeyCommand(CommandT inCommand, + void *ioParam); - virtual void FindCommandStatus(PP_PowerPlant::CommandT inCommand, - Boolean &outEnabled, - Boolean &outUsesMark, - PP_PowerPlant::Char16 &outMark, - Str255 outName); + virtual void FindCommandStatus(PP_PowerPlant::CommandT inCommand, + Boolean &outEnabled, + Boolean &outUsesMark, + PP_PowerPlant::Char16 &outMark, + Str255 outName); - NS_METHOD GetWidget(nsIWidget** aWidget); - CBrowserShell* GetBrowserShell() const - { return mBrowserShell; } + NS_METHOD GetWidget(nsIWidget** aWidget); + CBrowserShell* GetBrowserShell() const + { return mBrowserShell; } + + void SetSizeToContent(Boolean isSizedToContent) + { mSizeToContent = isSizedToContent; } + Boolean GetSizeToContent() + { return mSizeToContent; } + NS_METHOD SizeToContent(); + + NS_METHOD Stop(); + Boolean IsBusy() + { return mBusy; } protected: @@ -110,30 +132,41 @@ protected: // Methods called by CWebBrowserChrome // ----------------------------------- - NS_METHOD SetStatus(const PRUnichar* aStatus); - NS_METHOD SetOverLink(const PRUnichar* aStatus) - { return SetStatus(aStatus); } + NS_METHOD SetStatus(const PRUnichar* aStatus); + NS_METHOD SetOverLink(const PRUnichar* aStatus) + { return SetStatus(aStatus); } - NS_METHOD SetLocation(const nsString& aLocation); + NS_METHOD SetLocation(const nsString& aLocation); - NS_METHOD OnStatusNetStart(nsIWebProgress *progress, nsIRequest *request, - PRInt32 progressStateFlags, PRUint32 status); - NS_METHOD OnStatusNetStop(nsIWebProgress *progress, nsIRequest *request, - PRInt32 progressStateFlags, PRUint32 status); + NS_METHOD OnStatusNetStart(nsIWebProgress *progress, nsIRequest *request, + PRInt32 progressStateFlags, PRUint32 status); + NS_METHOD OnStatusNetStop(nsIWebProgress *progress, nsIRequest *request, + PRInt32 progressStateFlags, PRUint32 status); - NS_METHOD OnProgressChange(nsIWebProgress *progress, nsIRequest *request, - PRInt32 curSelfProgress, PRInt32 maxSelfProgress, - PRInt32 curTotalProgress, PRInt32 maxTotalProgress); + NS_METHOD OnProgressChange(nsIWebProgress *progress, nsIRequest *request, + PRInt32 curSelfProgress, PRInt32 maxSelfProgress, + PRInt32 curTotalProgress, PRInt32 maxTotalProgress); + + NS_METHOD SetVisibility(PRBool aVisibility); + + NS_METHOD OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode); + protected: - nsCOMPtr mWindow; + nsCOMPtr mWindow; - CBrowserShell* mBrowserShell; - CWebBrowserChrome* mBrowserChrome; - LEditText* mURLField; - LStaticText* mStatusBar; - CThrobber* mThrobber; - LBevelButton *mBackButton, *mForwardButton, *mStopButton; - LProgressBar* mProgressBar; + CBrowserShell* mBrowserShell; + CWebBrowserChrome* mBrowserChrome; + LEditText* mURLField; + LStaticText* mStatusBar; + CThrobber* mThrobber; + LBevelButton *mBackButton, *mForwardButton, *mStopButton; + LProgressBar* mProgressBar; + Boolean mBusy; + Boolean mInitialLoadComplete, mShowOnInitialLoad; + Boolean mSizeToContent; + + PRUint32 mContextMenuContext; + nsIDOMNode* mContextMenuDOMNode; // weak ref - only kept during call of OnShowContextMenu };