Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Friends
CBrowserShell Class Reference

#include <CBrowserShell.h>

Collaboration diagram for CBrowserShell:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { class_ID = FOUR_CHAR_CODE('BroS') }
enum  { paneID_MainBrowser = 'WebS' }

Public Member Functions

 CBrowserShell ()
 CBrowserShell (const SPaneInfo &inPaneInfo, const SViewInfo &inViewInfo, UInt32 inChromeFlags, Boolean inIsMainContent)
 CBrowserShell (LStream *inStream)
virtual ~CBrowserShell ()
virtual void FinishCreateSelf ()
virtual void ResizeFrameBy (SInt16 inWidthDelta, SInt16 inHeightDelta, Boolean inRefresh)
virtual void MoveBy (SInt32 inHorizDelta, SInt32 inVertDelta, Boolean inRefresh)
virtual void ActivateSelf ()
virtual void DeactivateSelf ()
virtual void ShowSelf ()
virtual void DrawSelf ()
virtual void ClickSelf (const SMouseDownEvent &inMouseDown)
virtual void EventMouseUp (const EventRecord &inMacEvent)
virtual void AdjustMouseSelf (Point, const EventRecord &inMacEvent, RgnHandle outMouseRgn)
virtual void BeTarget ()
virtual void DontBeTarget ()
virtual Boolean HandleKeyPress (const EventRecord &inKeyEvent)
virtual Boolean ObeyCommand (PP_PowerPlant::CommandT inCommand, void *ioParam)
virtual void FindCommandStatus (PP_PowerPlant::CommandT inCommand, Boolean &outEnabled, Boolean &outUsesMark, UInt16 &outMark, Str255 outName)
virtual void SpendTime (const EventRecord &inMacEvent)
virtual OSStatus HandleUpdateActiveInputArea (const nsAString &text, PRInt16 script, PRInt16 language, PRInt32 fixLen, const TextRangeArray *hiliteRng)
virtual OSStatus HandleUnicodeForKeyEvent (const nsAString &text, PRInt16 script, PRInt16 language, const EventRecord *keyboardEvent)
virtual OSStatus HandleOffsetToPos (PRInt32 offset, PRInt16 *pointX, PRInt16 *pointY)
virtual OSStatus HandlePosToOffset (PRInt16 currentPointX, PRInt16 currentPointY, PRInt32 *offset, PRInt16 *regionClass)
virtual OSStatus HandleGetSelectedText (nsAString &selectedText)
virtual void AddAttachments ()
NS_METHOD GetWebBrowser (nsIWebBrowser **aBrowser)
NS_METHOD SetWebBrowser (nsIWebBrowser *aBrowser)
NS_METHOD GetWebBrowserChrome (nsIWebBrowserChrome **aChrome)
NS_METHOD GetContentViewer (nsIContentViewer **aViewer)
NS_METHOD GetPrintSettings (nsIPrintSettings **aSettings)
NS_METHOD GetFocusedWindowURL (nsAString &outURL)
Boolean IsBusy ()
Boolean CanGoBack ()
Boolean CanGoForward ()
NS_METHOD Back ()
NS_METHOD Forward ()
NS_METHOD Stop ()
NS_METHOD Reload ()
NS_METHOD LoadURL (const nsACString &urlText, const nsACString &referrer=kEmptyCString)
NS_METHOD GetCurrentURL (nsACString &urlText)
NS_METHOD SaveDocument (ESaveFormat inSaveFormat=eSaveFormatUnspecified)
NS_METHOD SaveLink (nsIURI *inURI)
NS_METHOD SaveInternal (nsIURI *inURI, nsIDOMDocument *inDocument, const nsAString &inSuggestedFilename, Boolean inBypassCache, ESaveFormat inSaveFormat=eSaveFormatUnspecified)
Boolean Find ()
Boolean Find (const nsAString &searchStr, Boolean caseSensitive, Boolean searchBackward, Boolean wrapSearch, Boolean wholeWordOnly)
Boolean CanFindNext ()
Boolean FindNext ()

Static Public Attributes

static const nsCString kEmptyCString

Protected Member Functions

virtual void InsideDropArea (DragReference inDragRef)
virtual Boolean PointInDropArea (Point inGlobalPt)
virtual Boolean DragIsAcceptable (DragReference inDragRef)
virtual void EnterDropArea (DragReference inDragRef, Boolean inDragHasLeftSender)
virtual void LeaveDropArea (DragReference inDragRef)
virtual void DoDragReceive (DragReference inDragRef)
NS_IMETHOD OnShowContextMenu (PRUint32 aContextFlags, nsIContextMenuInfo *aInfo)
NS_IMETHOD OnShowTooltip (PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
NS_IMETHOD OnHideTooltip ()
NS_METHOD CommonConstruct ()
void HandleMouseMoved (const EventRecord &inMacEvent)
void AdjustFrame ()
virtual Boolean DoFindDialog (nsAString &searchText, PRBool &findBackwards, PRBool &wrapFind, PRBool &entireWord, PRBool &caseSensitive)
NS_METHOD GetClipboardHandler (nsIClipboardCommands **aCommand)
Boolean HasFormElements ()
virtual void PostOpenURLEvent (const nsACString &url, const nsACString &referrer)

Protected Attributes

UInt32 mChromeFlags
Boolean mIsMainContent
nsCOMPtr< nsIEventSinkmEventSink
nsCOMPtr< nsIWebBrowsermWebBrowser
nsCOMPtr< nsIBaseWindowmWebBrowserAsBaseWin
nsCOMPtr< nsIWebNavigationmWebBrowserAsWebNav
CBrowserChromemChrome
CBrowserShellProgressListenermProgressListener
PRUint32 mContextMenuFlags
nsIContextMenuInfomContextMenuInfo
nsCOMPtr< nsIPrintSettingsmPrintSettings

Static Protected Attributes

static nsCOMPtr
< nsIDragHelperService
sDragHelper

Private Types

typedef LView Inherited

Friends

class CBrowserChrome

Detailed Description

Definition at line 75 of file CBrowserShell.h.


Member Typedef Documentation

typedef LView CBrowserShell::Inherited [private]

Definition at line 84 of file CBrowserShell.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
class_ID 

Definition at line 87 of file CBrowserShell.h.

{ class_ID = FOUR_CHAR_CODE('BroS') };
anonymous enum
Enumerator:
paneID_MainBrowser 

Definition at line 88 of file CBrowserShell.h.

{ paneID_MainBrowser = 'WebS' };

Constructor & Destructor Documentation

Definition at line 272 of file CBrowserShell.cpp.

                             :
    LDropArea(GetMacWindow()),
    mChromeFlags(nsIWebBrowserChrome::CHROME_DEFAULT), mIsMainContent(true),
    mContextMenuFlags(nsIContextMenuListener2::CONTEXT_NONE)
{
       nsresult rv = CommonConstruct();
       if (rv != NS_OK)
          Throw_Err(NS_ERROR_GET_CODE(rv));   // If this fails, there's no reason to live anymore :(
}

Here is the call graph for this function:

CBrowserShell::CBrowserShell ( const SPaneInfo &  inPaneInfo,
const SViewInfo &  inViewInfo,
UInt32  inChromeFlags,
Boolean  inIsMainContent 
)

Definition at line 283 of file CBrowserShell.cpp.

                                                                                      :
    LView(inPaneInfo, inViewInfo), LDropArea(GetMacWindow()),
    mChromeFlags(inChromeFlags), mIsMainContent(inIsMainContent),
    mContextMenuFlags(nsIContextMenuListener2::CONTEXT_NONE)
{
       nsresult rv = CommonConstruct();
       if (rv != NS_OK)
          Throw_Err(NS_ERROR_GET_CODE(rv));   // If this fails, there's no reason to live anymore :(
}

Here is the call graph for this function:

CBrowserShell::CBrowserShell ( LStream *  inStream)

Definition at line 297 of file CBrowserShell.cpp.

                                                    :
       LView(inStream), LDropArea(GetMacWindow()),
    mContextMenuFlags(nsIContextMenuListener2::CONTEXT_NONE)
{
       *inStream >> mChromeFlags;
       *inStream >> mIsMainContent;
       
       nsresult rv = CommonConstruct();
       if (rv != NS_OK)
          Throw_Err(NS_ERROR_GET_CODE(rv));   // If this fails, there's no reason to live anymore :(
}

Here is the call graph for this function:

Definition at line 310 of file CBrowserShell.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 404 of file CBrowserShell.cpp.

{
    EventRecord osEvent;
    osEvent.what = activateEvt;
    osEvent.modifiers = activeFlag;
    PRBool handled = PR_FALSE;
    mEventSink->DispatchEvent(&osEvent, &handled);
}

Definition at line 867 of file CBrowserShell.cpp.

{
    // Only add a context menu attachment for full browser windows -
    // not view-source and chrome dialogs.
    if ((mChromeFlags & (nsIWebBrowserChrome::CHROME_TOOLBAR |
                         nsIWebBrowserChrome::CHROME_STATUSBAR)) != 0)
    {
        CWebBrowserCMAttachment *cmAttachment = new CWebBrowserCMAttachment(this);
        ThrowIfNil_(cmAttachment);
        cmAttachment->SetCommandList(mcmd_BrowserShellContextMenuCmds);
        AddAttachment(cmAttachment);
    }
}

Here is the call graph for this function:

Definition at line 1371 of file CBrowserShell.cpp.

{
    FocusDraw();
       
    Rect portFrame;
    CalcPortFrameRect(portFrame);
    nsRect r(portFrame.left, portFrame.top, portFrame.right - portFrame.left, portFrame.bottom - portFrame.top);
              
    mWebBrowserAsBaseWin->SetPositionAndSize(r.x, r.y, r.width, r.height, PR_TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CBrowserShell::AdjustMouseSelf ( Point  inPortPt,
const EventRecord &  inMacEvent,
RgnHandle  outMouseRgn 
) [virtual]

Definition at line 459 of file CBrowserShell.cpp.

{
    Rect cursorRect = { inPortPt.h, inPortPt.v, inPortPt.h + 1, inPortPt.v + 1 };
    ::RectRgn(outMouseRgn, &cursorRect);
}

Definition at line 1008 of file CBrowserShell.cpp.

{
   nsresult rv;
    
    if (CanGoBack())
      rv = mWebBrowserAsWebNav->GoBack();
   else
   {
      ::SysBeep(5);
      rv = NS_ERROR_FAILURE;
   }
   return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 471 of file CBrowserShell.cpp.

{
    nsCOMPtr<nsIWebBrowserFocus>  focus(do_GetInterface(mWebBrowser));
    if (focus)
        focus->Activate();
}

Here is the call graph for this function:

Definition at line 1241 of file CBrowserShell.cpp.

{
    nsresult    rv;

    nsCOMPtr<nsIWebBrowserFind> finder(do_GetInterface(mWebBrowser));
    if (!finder) return FALSE;
    
    nsXPIDLString searchStr;
    rv = finder->GetSearchString(getter_Copies(searchStr));
    return (NS_SUCCEEDED(rv) && !searchStr.IsEmpty());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 988 of file CBrowserShell.cpp.

{
    PRBool      canDo;
    nsresult    rv;

    rv = mWebBrowserAsWebNav->GetCanGoBack(&canDo);
    return (NS_SUCCEEDED(rv) && canDo);
}

Here is the caller graph for this function:

Definition at line 998 of file CBrowserShell.cpp.

{
    PRBool      canDo;
    nsresult    rv;

    rv = mWebBrowserAsWebNav->GetCanGoForward(&canDo);
    return (NS_SUCCEEDED(rv) && canDo);
}

Here is the caller graph for this function:

void CBrowserShell::ClickSelf ( const SMouseDownEvent &  inMouseDown) [virtual]

Definition at line 437 of file CBrowserShell.cpp.

{
       if (!IsTarget())
              SwitchTarget(this);

       FocusDraw();
  PRBool handled = PR_FALSE;
       mEventSink->DispatchEvent(&const_cast<EventRecord&>(inMouseDown.macEvent), &handled);
}

Definition at line 413 of file CBrowserShell.cpp.

{
    EventRecord osEvent;
    osEvent.what = activateEvt;
    osEvent.modifiers = 0;
    PRBool handled = PR_FALSE;
    mEventSink->DispatchEvent(&osEvent, &handled);
}
void CBrowserShell::DoDragReceive ( DragReference  inDragRef) [protected, virtual]

Definition at line 1597 of file CBrowserShell.cpp.

{
  if ( sDragHelper ) {
    PRBool dragAccepted = PR_FALSE;
    sDragHelper->Drop ( inDragRef, mEventSink, &dragAccepted );
  }
}
Boolean CBrowserShell::DoFindDialog ( nsAString &  searchText,
PRBool findBackwards,
PRBool wrapFind,
PRBool entireWord,
PRBool caseSensitive 
) [protected, virtual]

Definition at line 1383 of file CBrowserShell.cpp.

{
    enum
    {
        kSearchTextEdit       = FOUR_CHAR_CODE('Text'),
        kCaseSensitiveCheck   = FOUR_CHAR_CODE('Case'),
        kWrapAroundCheck      = FOUR_CHAR_CODE('Wrap'),
        kSearchBackwardsCheck = FOUR_CHAR_CODE('Back'),
        kEntireWordCheck      = FOUR_CHAR_CODE('Entr')
    };

    Boolean     result;

    try
    {
        // Create stack-based object for handling the dialog box

        StDialogHandler     theHandler(dlog_FindDialog, this);
        LWindow                    *theDialog = theHandler.GetDialog();
        Str255          aStr;

        // Set initial text for string in dialog box

        CPlatformUCSConversion::GetInstance()->UCSToPlatform(searchText, aStr);

        LEditText    *editField = dynamic_cast<LEditText*>(theDialog->FindPaneByID(kSearchTextEdit));
        editField->SetDescriptor(aStr);
        theDialog->SetLatentSub(editField);

        LCheckBox   *caseSensCheck, *entireWordCheck, *wrapAroundCheck, *backwardsCheck;

        caseSensCheck = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID(kCaseSensitiveCheck));
        ThrowIfNot_(caseSensCheck);
        caseSensCheck->SetValue(caseSensitive ? 1 : 0);
        entireWordCheck = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID(kEntireWordCheck));
        ThrowIfNot_(entireWordCheck);
        entireWordCheck->SetValue(entireWord ? 1 : 0);
        wrapAroundCheck = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID(kWrapAroundCheck));
        ThrowIfNot_(wrapAroundCheck);
        wrapAroundCheck->SetValue(wrapFind ? 1 : 0);
        backwardsCheck = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID(kSearchBackwardsCheck));
        ThrowIfNot_(backwardsCheck);
        backwardsCheck->SetValue(findBackwards ? 1 : 0);

        theDialog->Show();

        while (true)  // This is our modal dialog event loop
        {                          
            MessageT hitMessage = theHandler.DoDialog();

            if (hitMessage == msg_Cancel)
            {
                result = FALSE;
                break;
                     
            }
            else if (hitMessage == msg_OK)
            {
                editField->GetDescriptor(aStr);
                CPlatformUCSConversion::GetInstance()->PlatformToUCS(aStr, searchText);

                caseSensitive = caseSensCheck->GetValue() ? TRUE : FALSE;
                entireWord = entireWordCheck->GetValue() ? TRUE : FALSE;
                wrapFind = wrapAroundCheck->GetValue() ? TRUE : FALSE;
                findBackwards = backwardsCheck->GetValue() ? TRUE : FALSE;

                result = TRUE;
                break;
            }
        }
    }
       catch (...)
       {
          result = FALSE;
          // Don't propagate the error.
       }
       
       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 478 of file CBrowserShell.cpp.

{
    nsCOMPtr<nsIWebBrowserFocus>  focus(do_GetInterface(mWebBrowser));
    if (focus)
        focus->Deactivate();
}

Here is the call graph for this function:

Boolean CBrowserShell::DragIsAcceptable ( DragReference  inDragRef) [protected, virtual]

Definition at line 1591 of file CBrowserShell.cpp.

{
  return true;
}

Definition at line 428 of file CBrowserShell.cpp.

{
    EventRecord osEvent;
    osEvent.what = updateEvt;
    PRBool handled = PR_FALSE;
    mEventSink->DispatchEvent(&osEvent, &handled);
}
void CBrowserShell::EnterDropArea ( DragReference  inDragRef,
Boolean  inDragHasLeftSender 
) [protected, virtual]

Definition at line 1565 of file CBrowserShell.cpp.

{
  sDragHelper = do_GetService ( "@mozilla.org/widget/draghelperservice;1" );
  NS_ASSERTION ( sDragHelper, "Couldn't get a drag service, we're in biiig trouble" );
  if ( sDragHelper )
    sDragHelper->Enter ( inDragRef, mEventSink );
}

Here is the call graph for this function:

void CBrowserShell::EventMouseUp ( const EventRecord &  inMacEvent) [virtual]

Definition at line 448 of file CBrowserShell.cpp.

{
    FocusDraw();
    PRBool handled = PR_FALSE;
    mEventSink->DispatchEvent(&const_cast<EventRecord&>(inMacEvent), &handled);
    
    LEventDispatcher *dispatcher = LEventDispatcher::GetCurrentEventDispatcher();
    if (dispatcher)
        dispatcher->UpdateMenus();
}

Definition at line 1177 of file CBrowserShell.cpp.

{
    nsresult rv;
    nsXPIDLString stringBuf;
    PRBool  findBackwards;
    PRBool  wrapFind;
    PRBool  entireWord;
    PRBool  matchCase;

    nsCOMPtr<nsIWebBrowserFind> finder(do_GetInterface(mWebBrowser));
    if (!finder) return FALSE;
    finder->GetSearchString(getter_Copies(stringBuf));
    finder->GetFindBackwards(&findBackwards);    
    finder->GetWrapFind(&wrapFind);    
    finder->GetEntireWord(&entireWord);    
    finder->GetMatchCase(&matchCase);    

    Boolean     result = FALSE;
    nsString    searchString(stringBuf.get());

    if (DoFindDialog(searchString, findBackwards, wrapFind, entireWord, matchCase))
    {
        PRBool  didFind;

        finder->SetSearchString(searchString.get());
        finder->SetFindBackwards(findBackwards);    
        finder->SetWrapFind(wrapFind);    
        finder->SetEntireWord(entireWord);    
        finder->SetMatchCase(matchCase);    
        rv = finder->FindNext(&didFind);
        result = (NS_SUCCEEDED(rv) && didFind);
        if (!result)
          ::SysBeep(1);
    }
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Boolean CBrowserShell::Find ( const nsAString &  searchStr,
Boolean  caseSensitive,
Boolean  searchBackward,
Boolean  wrapSearch,
Boolean  wholeWordOnly 
)

Definition at line 1214 of file CBrowserShell.cpp.

{
    nsresult    rv;
    Boolean     result;
    PRBool      didFind;

    nsCOMPtr<nsIWebBrowserFind> finder(do_GetInterface(mWebBrowser));
    if (!finder) return FALSE;

    finder->SetSearchString(PromiseFlatString(searchString).get());
    finder->SetFindBackwards(findBackwards);    
    finder->SetWrapFind(wrapFind);    
    finder->SetEntireWord(entireWord);    
    finder->SetMatchCase(matchCase);    

    rv = finder->FindNext(&didFind);
    result = (NS_SUCCEEDED(rv) && didFind);
    if (!result)
        ::SysBeep(1);

    return result;
}

Here is the call graph for this function:

void CBrowserShell::FindCommandStatus ( PP_PowerPlant::CommandT  inCommand,
Boolean outEnabled,
Boolean outUsesMark,
UInt16 outMark,
Str255  outName 
) [virtual]

Definition at line 699 of file CBrowserShell.cpp.

{
    nsresult rv;
    nsCOMPtr<nsIClipboardCommands> clipCmd;
    PRBool haveContent, canDo;
    nsCOMPtr<nsIURI> currURI;

    rv = mWebBrowserAsWebNav->GetCurrentURI(getter_AddRefs(currURI));
    haveContent = NS_SUCCEEDED(rv) && currURI;
    
    switch (inCommand)
    {
        case cmd_Back:
            outEnabled = CanGoBack();
            break;
 
        case cmd_Forward:
            outEnabled = CanGoForward();
            break;
            
        case cmd_Stop:
            outEnabled = IsBusy();
            break;
            
        case cmd_Reload:
            outEnabled = haveContent;
            break;

        case cmd_SaveAs:
            outEnabled = haveContent;
            break;
            
        case cmd_Cut:
            if (haveContent) {
                rv = GetClipboardHandler(getter_AddRefs(clipCmd));
                if (NS_SUCCEEDED(rv)) {
                    rv = clipCmd->CanCutSelection(&canDo);
                    outEnabled = NS_SUCCEEDED(rv) && canDo;
                }
            }
            break;

        case cmd_Copy:
            if (haveContent) {
                rv = GetClipboardHandler(getter_AddRefs(clipCmd));
                if (NS_SUCCEEDED(rv)) {
                    rv = clipCmd->CanCopySelection(&canDo);
                    outEnabled = NS_SUCCEEDED(rv) && canDo;
                }
            }
            break;

        case cmd_Paste:
            if (haveContent) {
                rv = GetClipboardHandler(getter_AddRefs(clipCmd));
                if (NS_SUCCEEDED(rv)) {
                    rv = clipCmd->CanPaste(&canDo);
                    outEnabled = NS_SUCCEEDED(rv) && canDo;
                }
            }
            break;

        case cmd_SelectAll:
            outEnabled = haveContent;
            break;

              case cmd_Find:
                     outEnabled = haveContent;
                     break;

              case cmd_FindNext:
                     outEnabled = haveContent && CanFindNext();
                     break;

        case cmd_OpenLinkInNewWindow:
            outEnabled = haveContent && mContextMenuInfo && ((mContextMenuFlags & nsIContextMenuListener2::CONTEXT_LINK) != 0);
            break;
            
        case cmd_ViewPageSource:
            outEnabled = haveContent && ((mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME) == 0);
            break;
            
        case cmd_ViewImage:
            outEnabled = haveContent && mContextMenuInfo && ((mContextMenuFlags & nsIContextMenuListener2::CONTEXT_IMAGE) != 0);
            break;

        case cmd_ViewBackgroundImage:
            outEnabled = haveContent && mContextMenuInfo && ((mContextMenuFlags & nsIContextMenuListener2::CONTEXT_BACKGROUND_IMAGE) != 0);
            break;

        case cmd_CopyImage:
            if (haveContent) {
                rv = GetClipboardHandler(getter_AddRefs(clipCmd));
                if (NS_SUCCEEDED(rv)) {
                    rv = clipCmd->CanCopyImageContents(&canDo);
                    outEnabled = NS_SUCCEEDED(rv) && canDo;
                }
            }
            break;
            
        case cmd_SaveLinkTarget:
            outEnabled = haveContent && mContextMenuInfo && ((mContextMenuFlags & nsIContextMenuListener2::CONTEXT_LINK) != 0);
            break;
        
        case cmd_SaveImage:
            outEnabled = haveContent && mContextMenuInfo && ((mContextMenuFlags & nsIContextMenuListener2::CONTEXT_IMAGE) != 0);
            break;
            
        case cmd_CopyLinkLocation:
            outEnabled = haveContent && mContextMenuInfo && ((mContextMenuFlags & nsIContextMenuListener2::CONTEXT_LINK) != 0);
            break;
        
        case cmd_CopyImageLocation:
            outEnabled = haveContent && mContextMenuInfo && ((mContextMenuFlags & nsIContextMenuListener2::CONTEXT_IMAGE) != 0);
            break;
        
              case cmd_SaveFormData:
                  outEnabled = haveContent && HasFormElements();
                  break;

              case cmd_PrefillForm:
                  outEnabled = haveContent && HasFormElements();
                  break;

        default:
            LCommander::FindCommandStatus(inCommand, outEnabled,
                                                        outUsesMark, outMark, outName);
            break;
    }
}

Here is the call graph for this function:

Definition at line 1254 of file CBrowserShell.cpp.

{
    nsresult    rv;
    Boolean     result;
    PRBool      didFind;

    nsCOMPtr<nsIWebBrowserFind> finder(do_GetInterface(mWebBrowser));
    if (!finder) return FALSE;
    rv = finder->FindNext(&didFind);
    result = (NS_SUCCEEDED(rv) && didFind);
    if (!result)
        ::SysBeep(1);

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 361 of file CBrowserShell.cpp.

{
       FocusDraw();

       Rect portFrame;
       CalcPortFrameRect(portFrame);
       nsRect   r(portFrame.left, portFrame.top, portFrame.right - portFrame.left, portFrame.bottom - portFrame.top);
       
       nsresult rv;
       
    mWebBrowserAsBaseWin->InitWindow(GetMacWindow(), nsnull, r.x, r.y, r.width, r.height);
    mWebBrowserAsBaseWin->Create();
    mEventSink = do_GetInterface(mWebBrowser);
    ThrowIfNil_(mEventSink);
        
    // Hook up our progress listener
    nsWeakPtr weakling(do_GetWeakReference((nsIWebProgressListener *)mProgressListener));
    rv = mWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener));
    NS_ASSERTION(NS_SUCCEEDED(rv), "Call to AddWebBrowserListener failed");
      
    AdjustFrame();   
       StartRepeating();
}

Here is the call graph for this function:

Definition at line 1022 of file CBrowserShell.cpp.

{
   nsresult rv;

    if (CanGoForward())
      rv = mWebBrowserAsWebNav->GoForward();
   else
   {
      ::SysBeep(5);
      rv = NS_ERROR_FAILURE;
   }
   return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1467 of file CBrowserShell.cpp.

{
    NS_ENSURE_ARG_POINTER(aCommand);

    nsCOMPtr<nsIClipboardCommands> clipCmd(do_GetInterface(mWebBrowser));
    NS_ENSURE_TRUE(clipCmd, NS_ERROR_FAILURE);

    *aCommand = clipCmd;
    NS_ADDREF(*aCommand);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 927 of file CBrowserShell.cpp.

{
    nsCOMPtr<nsIDocShell> ourDocShell(do_GetInterface(mWebBrowser));
    NS_ENSURE_TRUE(ourDocShell, NS_ERROR_FAILURE);
    return ourDocShell->GetContentViewer(aViewer);
}

Here is the call graph for this function:

NS_METHOD CBrowserShell::GetCurrentURL ( nsACString &  urlText)

Definition at line 1065 of file CBrowserShell.cpp.

{
    nsresult rv;
    nsCOMPtr<nsIURI> currentURI;
    rv = mWebBrowserAsWebNav->GetCurrentURI(getter_AddRefs(currentURI));
    if (NS_FAILED(rv)) return rv;
    rv = currentURI->GetSpec(urlText);
    if (NS_FAILED(rv)) return rv;
    
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 934 of file CBrowserShell.cpp.

{
    nsCOMPtr<nsIWebBrowserFocus> wbf(do_GetInterface(mWebBrowser));
    if (!wbf)
        return NS_ERROR_FAILURE;
    nsCOMPtr<nsIDOMWindow> domWindow;
    wbf->GetFocusedWindow(getter_AddRefs(domWindow));
    if (!domWindow)
        mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
    if (!domWindow)
        return NS_ERROR_FAILURE;
    nsCOMPtr<nsIDOMDocument> domDocument;
    domWindow->GetDocument(getter_AddRefs(domDocument));
    if (!domDocument)
        return NS_ERROR_FAILURE;
    nsCOMPtr<nsIDOMNSDocument> nsDoc(do_QueryInterface(domDocument));
    if (!nsDoc)
        return NS_ERROR_FAILURE;
    nsCOMPtr<nsIDOMLocation> location;
    nsDoc->GetLocation(getter_AddRefs(location));
    if (!location)
        return NS_ERROR_FAILURE;
    return location->GetHref(outURL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 959 of file CBrowserShell.cpp.

{
    NS_ENSURE_ARG_POINTER(aSettings);
    *aSettings = nsnull;
    
    if (!mPrintSettings) {
        // If we don't have print settings yet, make new ones.
        nsCOMPtr<nsIWebBrowserPrint> wbPrint(do_GetInterface(mWebBrowser));
        NS_ENSURE_TRUE(wbPrint, NS_ERROR_NO_INTERFACE);
        wbPrint->GetGlobalPrintSettings(getter_AddRefs(mPrintSettings));
    }
    if (mPrintSettings) {
        *aSettings = mPrintSettings;
        NS_ADDREF(*aSettings);
        return NS_OK;
    }
    return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 881 of file CBrowserShell.cpp.

{
    NS_ENSURE_ARG_POINTER(aBrowser);

    *aBrowser = mWebBrowser;
    NS_IF_ADDREF(*aBrowser);
    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 921 of file CBrowserShell.cpp.

{
    NS_ENSURE_ARG_POINTER(aChrome);
    return mChrome->QueryInterface(NS_GET_IID(nsIWebBrowserChrome), (void **)aChrome);
}
OSStatus CBrowserShell::HandleGetSelectedText ( nsAString &  selectedText) [virtual]

Definition at line 1697 of file CBrowserShell.cpp.

{
  nsCOMPtr<nsIMacTextInputEventSink> tieSink;
  tieSink = do_QueryInterface(mEventSink);
  if (!tieSink)
    return eventNotHandledErr;
    
  OSStatus err = noErr;
  nsresult res = tieSink->HandleGetSelectedText( selectedText, &err);

  if (noErr != err)
      return err;
  if (NS_FAILED(res))
      return eventNotHandledErr;
  return noErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Boolean CBrowserShell::HandleKeyPress ( const EventRecord &  inKeyEvent) [virtual]

Definition at line 485 of file CBrowserShell.cpp.

{
       // set the QuickDraw origin
       FocusDraw();

       // dispatch the event
  PRBool handled = PR_FALSE;
       Boolean keyHandled = mEventSink->DispatchEvent(&const_cast<EventRecord&>(inKeyEvent), &handled);

       return keyHandled;
}

Here is the call graph for this function:

void CBrowserShell::HandleMouseMoved ( const EventRecord &  inMacEvent) [protected]

Definition at line 1357 of file CBrowserShell.cpp.

{
    static Point     lastWhere = {0, 0};

    if (IsActive() && (*(long*)&lastWhere != *(long*)&inMacEvent.where))
    {
        FocusDraw();
        PRBool handled = PR_FALSE;
        mEventSink->DispatchEvent(&const_cast<EventRecord&>(inMacEvent), &handled);
        lastWhere = inMacEvent.where;
    }
}

Here is the caller graph for this function:

OSStatus CBrowserShell::HandleOffsetToPos ( PRInt32  offset,
PRInt16 pointX,
PRInt16 pointY 
) [virtual]

Definition at line 1655 of file CBrowserShell.cpp.

{
  nsCOMPtr<nsIMacTextInputEventSink> tieSink;
  tieSink = do_QueryInterface(mEventSink);
  if (!tieSink)
    return eventNotHandledErr;
    
  OSStatus err = noErr;
  nsresult res = tieSink->HandleOffsetToPos( offset, pointX, pointY, &err);

  if (noErr != err)
      return err;
  if (NS_FAILED(res))
      return eventNotHandledErr;
  return noErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

OSStatus CBrowserShell::HandlePosToOffset ( PRInt16  currentPointX,
PRInt16  currentPointY,
PRInt32 offset,
PRInt16 regionClass 
) [virtual]

Definition at line 1675 of file CBrowserShell.cpp.

{
  nsCOMPtr<nsIMacTextInputEventSink> tieSink;
  tieSink = do_QueryInterface(mEventSink);
  if (!tieSink)
    return eventNotHandledErr;
    
  OSStatus err = noErr;
  nsresult res = tieSink->HandlePosToOffset( currentPointX, currentPointY, 
                                             offset, regionClass, &err);
  if (noErr != err)
      return err;
  if (NS_FAILED(res))
      return eventNotHandledErr;
  return noErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

OSStatus CBrowserShell::HandleUnicodeForKeyEvent ( const nsAString &  text,
PRInt16  script,
PRInt16  language,
const EventRecord *  keyboardEvent 
) [virtual]

Definition at line 1632 of file CBrowserShell.cpp.

{
  nsCOMPtr<nsIMacTextInputEventSink> tieSink;
  tieSink = do_QueryInterface(mEventSink);
  if (!tieSink)
    return eventNotHandledErr;
    
  OSStatus err = noErr;
  nsresult res = tieSink->HandleUnicodeForKeyEvent( text,
                                                    script, language, 
                                                    (void*)keyboardEvent, 
                                                    &err);
  if (noErr != err)
      return err;
  if (NS_FAILED(res))
      return eventNotHandledErr;
  return noErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

OSStatus CBrowserShell::HandleUpdateActiveInputArea ( const nsAString &  text,
PRInt16  script,
PRInt16  language,
PRInt32  fixLen,
const TextRangeArray *  hiliteRng 
) [virtual]

Definition at line 1607 of file CBrowserShell.cpp.

{
  nsCOMPtr<nsIMacTextInputEventSink> tieSink;
  tieSink = do_QueryInterface(mEventSink);
  if (!tieSink)
    return eventNotHandledErr;
    
  OSStatus err = noErr;
  nsresult res = tieSink->HandleUpdateActiveInputArea( text,
                                                       script, language, 
                                                       fixLen, (void*)hiliteRng, 
                                                       &err);
  if (noErr != err)
    return err;
  if (NS_FAILED(res))
    return eventNotHandledErr;
  return noErr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1479 of file CBrowserShell.cpp.

{
    nsresult rv;
    
    nsCOMPtr<nsIDOMWindow> domWindow;
    rv = mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
    if (NS_SUCCEEDED(rv)) {
        nsCOMPtr<nsIDOMDocument> domDoc;
        rv = domWindow->GetDocument(getter_AddRefs(domDoc));
        if (NS_SUCCEEDED(rv)) {
            nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(domDoc);
            if (htmlDoc) {
                nsCOMPtr<nsIDOMHTMLCollection> forms;
                htmlDoc->GetForms(getter_AddRefs(forms));
                if (forms) {
                    PRUint32 numForms;
                    forms->GetLength(&numForms);
                    return numForms > 0;
                }
            }
        }
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CBrowserShell::InsideDropArea ( DragReference  inDragRef) [protected, virtual]

Definition at line 1555 of file CBrowserShell.cpp.

{
  if ( sDragHelper ) {
    PRBool dropAllowed = PR_FALSE;
    sDragHelper->Tracking ( inDragRef, mEventSink, &dropAllowed );
  }
}

Definition at line 982 of file CBrowserShell.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBrowserShell::LeaveDropArea ( DragReference  inDragRef) [protected, virtual]

Definition at line 1575 of file CBrowserShell.cpp.

{
  if ( sDragHelper ) {
    sDragHelper->Leave ( inDragRef, mEventSink );
    sDragHelper = nsnull;      
  }
}
NS_METHOD CBrowserShell::LoadURL ( const nsACString &  urlText,
const nsACString &  referrer = kEmptyCString 
)

Definition at line 1051 of file CBrowserShell.cpp.

{    
    nsCOMPtr<nsIURI> referrerURI;
    if (referrer.Length()) {
        nsresult rv = NS_NewURI(getter_AddRefs(referrerURI), referrer);
        NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to make URI for referrer.");
    }
    return mWebBrowserAsWebNav->LoadURI(NS_ConvertUTF8toUCS2(urlText).get(),
                                        nsIWebNavigation::LOAD_FLAGS_NONE,
                                        referrerURI,
                                        nsnull,
                                        nsnull);
}

Here is the call graph for this function:

void CBrowserShell::MoveBy ( SInt32  inHorizDelta,
SInt32  inVertDelta,
Boolean  inRefresh 
) [virtual]

Definition at line 395 of file CBrowserShell.cpp.

{
       LView::MoveBy(inHorizDelta, inVertDelta, inRefresh);
       AdjustFrame();
}

Here is the call graph for this function:

Boolean CBrowserShell::ObeyCommand ( PP_PowerPlant::CommandT  inCommand,
void ioParam 
) [virtual]

Definition at line 497 of file CBrowserShell.cpp.

{
       Boolean              cmdHandled = true;

    nsresult rv;
    nsCOMPtr<nsIClipboardCommands> clipCmd;

    switch (inCommand)
    {
        case cmd_Back:
            Back();
            break;
 
        case cmd_Forward:
            Forward();
            break;
            
        case cmd_Stop:
            Stop();
            break;
            
        case cmd_Reload:
            Reload();
            break;

        case cmd_SaveAs:
            rv = SaveDocument(eSaveFormatHTML);
            ThrowIfError_(rv);
            break;
                        
        case cmd_Cut:
            rv = GetClipboardHandler(getter_AddRefs(clipCmd));
            if (NS_SUCCEEDED(rv))
                clipCmd->CutSelection();
            break;

        case cmd_Copy:
            rv = GetClipboardHandler(getter_AddRefs(clipCmd));
            if (NS_SUCCEEDED(rv))
                clipCmd->CopySelection();
            break;

        case cmd_Paste:
            rv = GetClipboardHandler(getter_AddRefs(clipCmd));
            if (NS_SUCCEEDED(rv))
                clipCmd->Paste();
            break;

        case cmd_SelectAll:
            rv = GetClipboardHandler(getter_AddRefs(clipCmd));
            if (NS_SUCCEEDED(rv))
                clipCmd->SelectAll();
            break;

              case cmd_Find:
                     Find();
                     break;

              case cmd_FindNext:
                     FindNext();
                     break;

        case cmd_OpenLinkInNewWindow:
        case cmd_CopyLinkLocation:
            {               
                // Get the URL from the link
                ThrowIfNil_(mContextMenuInfo);
                nsAutoString temp;
                rv = mContextMenuInfo->GetAssociatedLink(temp);
                ThrowIfError_(rv);
                NS_ConvertUTF16toUTF8 urlSpec(temp);

                if (inCommand == cmd_OpenLinkInNewWindow) {
                    nsCAutoString referrer;
                    rv = GetFocusedWindowURL(temp);
                    if (NS_SUCCEEDED(rv))
                        AppendUTF16toUTF8(temp, referrer);
                    PostOpenURLEvent(urlSpec, referrer);
                }
                else
                    UScrap::SetData(kScrapFlavorTypeText, urlSpec.get(), urlSpec.Length());
            }
            break;
            
              case cmd_SaveFormData:
            {
                nsCOMPtr<nsIDOMWindow> domWindow;
                nsCOMPtr<nsIDOMWindowInternal> domWindowInternal;

                nsCOMPtr<nsIWalletService> walletService = 
                         do_GetService(NS_WALLETSERVICE_CONTRACTID, &rv);
                ThrowIfError_(rv);
                rv = mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
                ThrowIfError_(rv);
                domWindowInternal = do_QueryInterface(domWindow, &rv);
                ThrowIfError_(rv);
                PRUint32 retval;
                rv = walletService->WALLET_RequestToCapture(domWindowInternal, &retval);
            }
            break;
                
              case cmd_PrefillForm:
            {
                nsCOMPtr<nsIDOMWindow> domWindow;
                nsCOMPtr<nsIDOMWindowInternal> domWindowInternal;

                nsCOMPtr<nsIWalletService> walletService = 
                         do_GetService(NS_WALLETSERVICE_CONTRACTID, &rv);
                ThrowIfError_(rv);
                rv = mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
                ThrowIfError_(rv);
                domWindowInternal = do_QueryInterface(domWindow, &rv);
                ThrowIfError_(rv);
                PRBool retval;
                // Don't check the result - A result of NS_ERROR_FAILURE means not to show preview dialog
                rv = walletService->WALLET_Prefill(true, domWindowInternal, &retval);
            }
            break;

        case cmd_ViewPageSource:
            {
                nsCAutoString currentURL;
                rv = GetCurrentURL(currentURL);
                ThrowIfError_(rv);
                currentURL.Insert("view-source:", 0);
                PostOpenURLEvent(currentURL, EmptyCString());
            }
            break;

        case cmd_SaveLinkTarget:
            {
                // Get the URL from the link
                ThrowIfNil_(mContextMenuInfo);
                nsAutoString linkText;
                rv = mContextMenuInfo->GetAssociatedLink(linkText);
                ThrowIfError_(rv);
                
                nsCOMPtr<nsIURI> linkURI;
                rv = NS_NewURI(getter_AddRefs(linkURI), NS_ConvertUCS2toUTF8(linkText));
                ThrowIfError_(rv);

                SaveLink(linkURI);
            }
            break;
            
        case cmd_SaveImage:
            {
                ThrowIfNil_(mContextMenuInfo);
                nsCOMPtr<nsIURI> imgURI;
                mContextMenuInfo->GetImageSrc(getter_AddRefs(imgURI));
                ThrowIfNil_(imgURI);
                
                SaveLink(imgURI);
            }
            break;
            
        case cmd_ViewImage:
        case cmd_CopyImageLocation:
            {
                ThrowIfNil_(mContextMenuInfo);
                nsCOMPtr<nsIURI> imgURI;
                mContextMenuInfo->GetImageSrc(getter_AddRefs(imgURI));
                ThrowIfNil_(imgURI);
                nsCAutoString temp; 
                rv = imgURI->GetSpec(temp);
                ThrowIfError_(rv);
                if (inCommand == cmd_ViewImage)
                    PostOpenURLEvent(temp, EmptyCString());
                else
                    UScrap::SetData(kScrapFlavorTypeText, temp.get(), temp.Length());
            }
            break;
        
        case cmd_ViewBackgroundImage:
            {
                ThrowIfNil_(mContextMenuInfo);
                nsCOMPtr<nsIURI> uri;
                rv = mContextMenuInfo->GetBackgroundImageSrc(getter_AddRefs(uri));
                ThrowIfNil_(uri);
                nsCAutoString temp;
                rv = uri->GetSpec(temp);
                ThrowIfError_(rv);
                PostOpenURLEvent(temp, EmptyCString());
            }
            break;
        
        case cmd_CopyImage:
            {
                GetClipboardHandler(getter_AddRefs(clipCmd));
                if (clipCmd)
                    clipCmd->CopyImageContents();
            }
            break;
                                        
        default:
            cmdHandled = LCommander::ObeyCommand(inCommand, ioParam);
            break;
    }
    return cmdHandled;
}

Here is the call graph for this function:

Definition at line 1341 of file CBrowserShell.cpp.

{
    nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
    
#if TARGET_CARBON
    if ((Ptr)HMHideTag != (Ptr)kUnresolvedCFragSymbolAddress)
    {
        ::HMHideTag();
        rv = NS_OK;
    }
#endif

    return rv;
}
NS_IMETHODIMP CBrowserShell::OnShowContextMenu ( PRUint32  aContextFlags,
nsIContextMenuInfo aInfo 
) [protected]

Definition at line 1271 of file CBrowserShell.cpp.

{
    // Find our CWebBrowserCMAttachment, if any
    CWebBrowserCMAttachment *aCMAttachment = nsnull;
    const TArray<LAttachment*>* theAttachments = GetAttachmentsList();
    
    if (theAttachments) {
        TArrayIterator<LAttachment*> iterate(*theAttachments);
        
        LAttachment*    theAttach;
        while (iterate.Next(theAttach)) {
            aCMAttachment = dynamic_cast<CWebBrowserCMAttachment*>(theAttach);
            if (aCMAttachment != nil)
                break;
        }
    }
    if (!aCMAttachment) {
        NS_ASSERTION(PR_FALSE, "No CWebBrowserCMAttachment");
        return NS_OK;
    }
                
    EventRecord macEvent;        
    UEventMgr::GetMouseAndModifiers(macEvent);
    
    mContextMenuFlags = aContextFlags;
    mContextMenuInfo = aInfo;
    aCMAttachment->DoContextMenuClick(macEvent);
    mContextMenuFlags = 0;
    mContextMenuInfo = nsnull;

    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP CBrowserShell::OnShowTooltip ( PRInt32  aXCoords,
PRInt32  aYCoords,
const PRUnichar aTipText 
) [protected]

Definition at line 1305 of file CBrowserShell.cpp.

{
    nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
    
#if TARGET_CARBON
    if ((Ptr)HMDisplayTag != (Ptr)kUnresolvedCFragSymbolAddress &&
        (Ptr)HMHideTag != (Ptr)kUnresolvedCFragSymbolAddress)
    {
        HMHelpContentRec contentRec;
        Point location;

        location.h = aXCoords; location.v = aYCoords;
        FocusDraw();
        LocalToPortPoint(location);
        PortToGlobalPoint(location);
        
        contentRec.version = kMacHelpVersion;
        contentRec.absHotRect.top = contentRec.absHotRect.bottom = location.v;
        contentRec.absHotRect.left = contentRec.absHotRect.right = location.h;
        ::InsetRect(&contentRec.absHotRect, -4, -4);
        contentRec.tagSide = kHMOutsideBottomScriptAligned;
        contentRec.content[kHMMinimumContentIndex].contentType = kHMCFStringContent;
        contentRec.content[kHMMinimumContentIndex].u.tagCFString = 
            ::CFStringCreateWithCharactersNoCopy(NULL, (const UniChar *)aTipText, nsCRT::strlen(aTipText), kCFAllocatorNull);
        contentRec.content[kHMMaximumContentIndex].contentType = kHMNoContent;
        
        ::HMDisplayTag(&contentRec);
        rv = NS_OK;
    }
#endif

    return rv;
}
Boolean CBrowserShell::PointInDropArea ( Point  inGlobalPt) [protected, virtual]

Definition at line 1585 of file CBrowserShell.cpp.

{
  return true;
}
void CBrowserShell::PostOpenURLEvent ( const nsACString &  url,
const nsACString &  referrer 
) [protected, virtual]

Definition at line 1504 of file CBrowserShell.cpp.

{    
    // 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);

    const nsPromiseFlatCString& flatURL = PromiseFlatCString(url);  
    StAEDescriptor urlDesc(typeChar, flatURL.get(), flatURL.Length());
    
    err = ::AEPutParamDesc(&getURLEvent, keyDirectObject, urlDesc);
    if (err) {
        ::AEDisposeDesc(&getURLEvent);
        Throw_(err);
    }
    if (referrer.Length() != 0) {
        const nsPromiseFlatCString& flatReferrer = PromiseFlatCString(referrer);  
        StAEDescriptor referrerDesc(typeChar, flatReferrer.get(), flatReferrer.Length());
        err = ::AEPutParamDesc(&getURLEvent, keyGetURLReferrer, referrerDesc);
        if (err) {
            ::AEDisposeDesc(&getURLEvent);
            Throw_(err);
        }
    }
    UAppleEventsMgr::SendAppleEvent(getURLEvent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1041 of file CBrowserShell.cpp.

Here is the caller graph for this function:

void CBrowserShell::ResizeFrameBy ( SInt16  inWidthDelta,
SInt16  inHeightDelta,
Boolean  inRefresh 
) [virtual]

Definition at line 386 of file CBrowserShell.cpp.

{
       LView::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh);
       AdjustFrame();
}

Here is the call graph for this function:

Definition at line 1082 of file CBrowserShell.cpp.

{
    nsresult    rv;
    
    nsCOMPtr<nsIDOMDocument> domDocument;
    rv = mWebBrowserAsWebNav->GetDocument(getter_AddRefs(domDocument));
    if (NS_FAILED(rv)) return rv;

    nsCOMPtr<nsIDOMNSDocument> nsDoc(do_QueryInterface(domDocument));
    if (!nsDoc)
        return NS_ERROR_FAILURE;
    nsCOMPtr<nsIDOMLocation> location;
    nsDoc->GetLocation(getter_AddRefs(location));
    if (!location)
        return NS_ERROR_FAILURE;
    
    nsAutoString docLocation;
    rv = location->GetHref(docLocation);
    if (NS_FAILED(rv))
      return rv;

    nsCOMPtr<nsIURI> documentURI;
    rv = NS_NewURI(getter_AddRefs(documentURI), NS_ConvertUCS2toUTF8(docLocation));
    if (NS_FAILED(rv))
      return rv;

    return SaveInternal(documentURI, domDocument, EmptyString(), false, inSaveFormat);     // don't bypass cache
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_METHOD CBrowserShell::SaveInternal ( nsIURI inURI,
nsIDOMDocument inDocument,
const nsAString &  inSuggestedFilename,
Boolean  inBypassCache,
ESaveFormat  inSaveFormat = eSaveFormatUnspecified 
)

Definition at line 1119 of file CBrowserShell.cpp.

{
    nsresult rv;
    // Create our web browser persist object.  This is the object that knows
    // how to actually perform the saving of the page (and of the images
    // on the page).
    nsCOMPtr<nsIWebBrowserPersist> webPersist(do_CreateInstance(kPersistContractID, &rv));
    if (!webPersist)
        return rv;
    
    // Make a temporary file object that we can save to.
    nsCOMPtr<nsIProperties> dirService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
    if (!dirService)
        return rv;
    nsCOMPtr<nsIFile> tmpFile;
    dirService->Get("TmpD", NS_GET_IID(nsIFile), getter_AddRefs(tmpFile));
    static short unsigned int tmpRandom = 0;
    nsAutoString tmpNo; tmpNo.AppendInt(tmpRandom++);
    nsAutoString saveFile(NS_LITERAL_STRING("-sav"));
    saveFile += tmpNo;
    saveFile.Append(NS_LITERAL_STRING("tmp"));
    tmpFile->Append(saveFile);
    
    // Get the post data if we're an HTML doc.
    nsCOMPtr<nsIInputStream> postData;
    if (inDocument) {
      nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
      nsCOMPtr<nsISHistory> sessionHistory;
      webNav->GetSessionHistory(getter_AddRefs(sessionHistory));
      nsCOMPtr<nsIHistoryEntry> entry;
      PRInt32 sindex;
      sessionHistory->GetIndex(&sindex);
      sessionHistory->GetEntryAtIndex(sindex, PR_FALSE, getter_AddRefs(entry));
      nsCOMPtr<nsISHEntry> shEntry(do_QueryInterface(entry));
      if (shEntry)
          shEntry->GetPostData(getter_AddRefs(postData));
    }

    // when saving, we first fire off a save with a nsHeaderSniffer as a progress
    // listener. This allows us to look for the content-disposition header, which
    // can supply a filename, and maybe has something to do with CGI-generated
    // content (?)
    CHeaderSniffer* sniffer = new CHeaderSniffer(webPersist, tmpFile, inURI, inDocument, postData,
                                        inSuggestedFilename, inBypassCache, inSaveFormat);
    if (!sniffer)
        return NS_ERROR_OUT_OF_MEMORY;

    webPersist->SetProgressListener(sniffer);  // owned
    
    return webPersist->SaveURI(inURI, nsnull, nsnull, nsnull, nsnull, tmpFile);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1112 of file CBrowserShell.cpp.

{
    return SaveInternal(inURI, nsnull, EmptyString(), true, eSaveFormatHTML);     // bypass cache
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 891 of file CBrowserShell.cpp.

{
    NS_ENSURE_ARG(aBrowser);

    FocusDraw();

    mWebBrowser = aBrowser;

    nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(mWebBrowser));
    NS_ENSURE_TRUE(baseWin, NS_ERROR_FAILURE);
    mWebBrowserAsBaseWin = baseWin;

    nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
    NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
    mWebBrowserAsWebNav = webNav;

    Rect portFrame;
    CalcPortFrameRect(portFrame);
    nsRect   r(portFrame.left, portFrame.top, portFrame.right - portFrame.left, portFrame.bottom - portFrame.top);
       
    mWebBrowserAsBaseWin->InitWindow(GetMacWindow(), nsnull, r.x, r.y, r.width, r.height);
    mWebBrowserAsBaseWin->Create();
    mEventSink = do_GetInterface(mWebBrowser);
    ThrowIfNil_(mEventSink);

    AdjustFrame();   

    return NS_OK;
}

Here is the call graph for this function:

Definition at line 422 of file CBrowserShell.cpp.

{
    mWebBrowserAsBaseWin->SetVisibility(PR_TRUE);
}
void CBrowserShell::SpendTime ( const EventRecord &  inMacEvent) [virtual]

Definition at line 837 of file CBrowserShell.cpp.

{
    switch (inMacEvent.what)
    {
        case nullEvent:
            HandleMouseMoved(inMacEvent);
            break;
        
        case osEvt:
            {
                // The event sink will not set the cursor if we are in the background - which is right.
                // We have to feed it suspendResumeMessages for it to know

                unsigned char eventType = ((inMacEvent.message >> 24) & 0x00ff);
                if (eventType == suspendResumeMessage) {
                    PRBool handled = PR_FALSE;
                    mEventSink->DispatchEvent(&const_cast<EventRecord&>(inMacEvent), &handled);
                }
                else if (eventType == mouseMovedMessage)
                    HandleMouseMoved(inMacEvent);
            }
            break;
    }
}

Here is the call graph for this function:

Definition at line 1036 of file CBrowserShell.cpp.

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class CBrowserChrome [friend]

Definition at line 81 of file CBrowserShell.h.


Member Data Documentation

Definition at line 89 of file CBrowserShell.h.

Definition at line 241 of file CBrowserShell.h.

Definition at line 231 of file CBrowserShell.h.

Definition at line 247 of file CBrowserShell.h.

Definition at line 248 of file CBrowserShell.h.

Definition at line 234 of file CBrowserShell.h.

Definition at line 232 of file CBrowserShell.h.

Definition at line 250 of file CBrowserShell.h.

Definition at line 242 of file CBrowserShell.h.

Definition at line 235 of file CBrowserShell.h.

Definition at line 236 of file CBrowserShell.h.

Definition at line 237 of file CBrowserShell.h.

Definition at line 239 of file CBrowserShell.h.


The documentation for this class was generated from the following files: