Back to index

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

Abstract base class for our test app's browser windows. More...

#include <nsBrowserWindow.h>

Inheritance diagram for nsBrowserWindow:
Inheritance graph
[legend]
Collaboration diagram for nsBrowserWindow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_IMETHOD Init (nsIAppShell *aAppShell, const nsRect &aBounds, PRUint32 aChromeMask, PRBool aAllowPlugins=PR_TRUE)
NS_IMETHOD InitNativeWindow ()
NS_IMETHOD MoveTo (PRInt32 aX, PRInt32 aY)
NS_IMETHOD SizeContentTo (PRInt32 aWidth, PRInt32 aHeight)
NS_IMETHOD SizeWindowTo (PRInt32 aWidth, PRInt32 aHeight, PRBool aWidthTransient, PRBool aHeightTransient)
NS_IMETHOD GetContentBounds (nsRect &aBounds)
NS_IMETHOD GetWindowBounds (nsRect &aBounds)
NS_IMETHOD SetChrome (PRUint32 aNewChromeMask)
NS_IMETHOD GetChrome (PRUint32 &aChromeMaskResult)
NS_IMETHOD SetProgress (PRInt32 aProgress, PRInt32 aProgressMax)
NS_IMETHOD ShowMenuBar (PRBool aShow)
NS_IMETHOD GetDocShell (nsIDocShell *&aResult)
NS_IMETHOD GetContentDocShell (nsIDocShell **aResult)
NS_DECL_NSIPROGRESSEVENTSINK void SetWebCrawler (nsWebCrawler *aWebCrawler)
virtual nsresult CreateMenuBar (PRInt32 aWidth)=0
virtual nsresult GetMenuBarHeight (PRInt32 *aHeightOut)
virtual nsresult CreateToolBar (PRInt32 aWidth)
virtual nsresult CreateStatusBar (PRInt32 aWidth)
void Layout (PRInt32 aWidth, PRInt32 aHeight)
void Back ()
void Forward ()
void GoTo (const PRUnichar *aURL)
void StartThrobber ()
void StopThrobber ()
void LoadThrobberImages ()
void DestroyThrobberImages ()
virtual nsEventStatus DispatchMenuItem (PRInt32 aID)=0
virtual nsresult GetWindow (nsIWidget **aWindow)
void DoFileOpen ()
void DoCopy ()
void DoPaste ()
void DoJSConsole ()
void DoPrefs ()
void DoEditorMode (nsIDocShell *aDocShell)
void DoEditorTest (nsIDocShell *aDocShell, PRInt32 aCommandID)
nsIPresShellGetPresShell ()
void DoFind ()
NS_IMETHOD FindNext (const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound)
NS_IMETHOD ForceRefresh ()
void DoTreeView ()
void DoToolbarDemo ()
void ShowPrintPreview (PRInt32 aID)
void DoPrint (void)
void DoTableInspector (void)
void DoImageInspector (void)
void SetBoolPref (const char *aPrefName, PRBool aValue)
void SetStringPref (const char *aPrefName, const nsString &aValue)
void GetStringPref (const char *aPrefName, nsString &aValue)
nsEventStatus DispatchStyleMenu (PRInt32 aID)
void SetCompatibilityMode (PRUint32 aMode)
nsEventStatus ProcessDialogEvent (nsGUIEvent *aEvent)
 

Main Handler


nsresult Init (nsIAppShell *aAppShell, const nsRect &aBounds, PRUint32 aChromeMask, PRBool aAllowPlugins, nsIDocumentViewer *aDocViewer, nsPresContext *aPresContext)
void SetApp (nsViewerApp *aApp)
void SetShowLoadTimes (PRBool aOn)
void initWindow (in nativeWindow parentNativeWindow, in nsIWidget parentWidget, in long x, in long y, in long cx, in long cy)
void create ()
void destroy ()
void setPosition (in long x, in long y)
void getPosition (out long x, out long y)
void setSize (in long cx, in long cy, in boolean fRepaint)
void getSize (out long cx, out long cy)
void setPositionAndSize (in long x, in long y, in long cx, in long cy, in boolean fRepaint)
void getPositionAndSize (out long x, out long y, out long cx, out long cy)
void repaint (in boolean force)
 Tell the window to repaint itself.
void setFocus ()
 Give the window focus.
void getInterface (in nsIIDRef uuid,[iid_is(uuid), retval] out nsQIResult result)
 Retrieves the specified interface pointer.
void onProgress (in nsIRequest aRequest, in nsISupports aContext, in unsigned long long aProgress, in unsigned long long aProgressMax)
 Called to notify the event sink that progress has occurred for the given request.
void onStatus (in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatus, in wstring aStatusArg)
 Called to notify the event sink with a status message for the given request.

Static Public Member Functions

static void CloseAllWindows ()
static void AddBrowser (nsBrowserWindow *aBrowser)
static void RemoveBrowser (nsBrowserWindow *aBrowser)
static nsBrowserWindowFindBrowserFor (nsIWidget *aWidget, PRIntn aWhich)

Public Attributes

nsViewerAppmApp
nsWebCrawlermWebCrawler
PRUint32 mChromeMask
nsString mTitle
nsCOMPtr< nsIWidgetmWindow
nsCOMPtr< nsIDocShellmDocShell
nsCOMPtr< nsIWebBrowsermWebBrowser
nsCOMPtr< nsILocalFilemOpenFileDirectory
PRTime mLoadStartTime
PRBool mShowLoadTimes
nsITextWidgetmLocation
nsIButtonmBack
nsIButtonmForward
nsThrobbermThrobber
nsITextWidgetmStatus
nsIXPBaseWindowmXPDialog
nsIXPBaseWindowmTableInspectorDialog
nsIXPBaseWindowmImageInspectorDialog
PrintSetupInfo mPrintSetupInfo
nsTableInspectorDialogmTableInspector
nsImageInspectorDialogmImageInspector
nsIAppShellmAppShell
PRBool mAllowPlugins
attribute nsIWidget parentWidget
attribute nativeWindow parentNativeWindow
attribute boolean visibility
attribute boolean enabled
attribute boolean blurSuppression
 set blurSuppression to true to suppress handling of blur events.
readonly attribute nsIWidget mainWidget
attribute wstring title

Static Public Attributes

static nsVoidArraygBrowsers = nsnull

Protected Member Functions

void DestroyWidget (nsISupports *aWidget)
nsIDOMDocumentGetDOMDocument (nsIDocShell *aDocShell)
NS_IMETHOD EnsureWebBrowserChrome ()
 nsBrowserWindow ()
virtual ~nsBrowserWindow ()

Protected Attributes

nsWebBrowserChromemWebBrowserChrome
PRBool mHaveMenuBar
nsCOMPtr< nsIPrintSettingsmPrintSettings

Friends

class nsWebBrowserChrome

Detailed Description

Abstract base class for our test app's browser windows.

Definition at line 87 of file nsBrowserWindow.h.


Constructor & Destructor Documentation

Definition at line 1240 of file nsBrowserWindow.cpp.

{
  if (!gTitleSuffix) {
#if XXX
    gTitleSuffix = GetTitleSuffix();
#endif
    if ( (gTitleSuffix = new nsString) != 0 )
      gTitleSuffix->AssignLiteral(" - Raptor");
  }
  AddBrowser(this);
}

Here is the call graph for this function:

nsBrowserWindow::~nsBrowserWindow ( ) [protected, virtual]

Member Function Documentation

Definition at line 557 of file nsBrowserWindow.cpp.

{
  if (!gBrowsers) {
    gBrowsers = new nsVoidArray();
    if (!gBrowsers)
      return;
  }
  gBrowsers->AppendElement(aBrowser);
  NS_ADDREF(aBrowser);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1041 of file nsBrowserWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 583 of file nsBrowserWindow.cpp.

{
  while (gBrowsers && gBrowsers->Count()) {
    nsBrowserWindow* bw = (nsBrowserWindow*) gBrowsers->ElementAt(0);
    NS_ADDREF(bw);
    bw->Destroy();
    NS_RELEASE(bw);
  }
  if (gBrowsers) {
    delete gBrowsers;
    gBrowsers = nsnull;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::create ( ) [inherited]
virtual nsresult nsBrowserWindow::CreateMenuBar ( PRInt32  aWidth) [pure virtual]

Implemented in nsNativeBrowserWindow.

Here is the caller graph for this function:

Definition at line 1598 of file nsBrowserWindow.cpp.

{
  nsresult rv;

  nsIDeviceContext* dc = mWindow->GetDeviceContext();
  float t2d;
  t2d = dc->TwipsToDevUnits();
  nsFont font(STATUS_BAR_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
              NS_FONT_WEIGHT_NORMAL, 0,
              nscoord(t2d * NSIntPointsToTwips(STATUS_BAR_FONT_SIZE)));
  NS_RELEASE(dc);

  nsRect r(0, 0, aWidth, THROBBER_HEIGHT);

#ifdef USE_LOCAL_WIDGETS
  rv = NS_NewTextWidget(&mStatus);
#else
  rv = CallCreateInstance(kTextFieldCID, &mStatus);
#endif

  if (NS_OK != rv) {
    return rv;
  }

  nsIWidget* widget = nsnull;
  NS_CreateTextWidget(mWindow,mStatus,r,HandleLocationEvent,&font);
  if (NS_OK == mStatus->QueryInterface(kIWidgetIID,(void**)&widget))
  {
    widget->SetForegroundColor(NS_RGB(0, 0, 0));
    PRUint32 size;
    mStatus->SetText(EmptyString(),size);
    mStatus->SetMaxTextLength(MAX_TEXT_LENGTH);

    nsITextWidget* textWidget = nsnull;
    if (NS_OK == mStatus->QueryInterface(kITextWidgetIID,(void**)&textWidget))
    {
      PRBool  wasReadOnly;
      textWidget->SetReadOnly(PR_TRUE, wasReadOnly);
      NS_RELEASE(textWidget);
    }

    NS_RELEASE(widget);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1489 of file nsBrowserWindow.cpp.

{
  nsresult rv;

  nsIDeviceContext* dc = mWindow->GetDeviceContext();
  float t2d;
  t2d = dc->TwipsToDevUnits();
  float d2a;
  d2a = dc->DevUnitsToAppUnits();
  nsFont font(TOOL_BAR_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
              NS_FONT_WEIGHT_NORMAL, 0,
              nscoord(NSIntPointsToTwips(TOOL_BAR_FONT_SIZE) * t2d * d2a));
  NS_RELEASE(dc);

#ifdef USE_LOCAL_WIDGETS
  rv = NS_NewButton(&mBack);
#else
  // Create and place back button
  rv = CallCreateInstance(kButtonCID, &mBack);
#endif

  if (NS_OK != rv) {
    return rv;
  }
  nsRect r(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT);

  nsIWidget* widget = nsnull;
  NS_CreateButton(mWindow,mBack,r,HandleBackEvent,&font);
  if (NS_OK == mBack->QueryInterface(kIWidgetIID,(void**)&widget))
  {
    nsAutoString back(NS_LITERAL_STRING("Back"));
    mBack->SetLabel(back);
    NS_RELEASE(widget);
  }


  // Create and place forward button
  r.SetRect(BUTTON_WIDTH, 0, BUTTON_WIDTH, BUTTON_HEIGHT);
  
#ifdef USE_LOCAL_WIDGETS
  rv = NS_NewButton(&mForward);
#else
  rv = CallCreateInstance(kButtonCID, &mForward);
#endif
  if (NS_OK != rv) {
    return rv;
  }
  if (NS_OK == mForward->QueryInterface(kIWidgetIID,(void**)&widget))
  {
    widget->Create(mWindow.get(), r, HandleForwardEvent, NULL);
    widget->SetFont(font);
    widget->Show(PR_TRUE);
    nsAutoString forward(NS_LITERAL_STRING("Forward"));
    mForward->SetLabel(forward);
    NS_RELEASE(widget);
  }


  // Create and place location bar
  r.SetRect(2*BUTTON_WIDTH, 0,
            aWidth - 2*BUTTON_WIDTH - THROBBER_WIDTH,
            BUTTON_HEIGHT);

#ifdef USE_LOCAL_WIDGETS
  rv = NS_NewTextWidget(&mLocation);
#else
  rv = CallCreateInstance(kTextFieldCID, &mLocation);
#endif

  if (NS_OK != rv) {
    return rv;
  }

  NS_CreateTextWidget(mWindow,mLocation,r,HandleLocationEvent,&font);
  if (NS_OK == mLocation->QueryInterface(kIWidgetIID,(void**)&widget))
  { 
    widget->SetForegroundColor(NS_RGB(0, 0, 0));
    widget->SetBackgroundColor(NS_RGB(255, 255, 255));
    PRUint32 size;
    nsAutoString empty;
    mLocation->SetText(empty, size);
    mLocation->SetMaxTextLength(MAX_TEXT_LENGTH);
    NS_RELEASE(widget);
  }

  // Create and place throbber
  r.SetRect(aWidth - THROBBER_WIDTH, 0,
            THROBBER_WIDTH, THROBBER_HEIGHT);
  mThrobber = nsThrobber::NewThrobber();
  nsString throbberURL; throbberURL.AssignWithConversion(THROBBER_AT);
  mThrobber->Init(mWindow, r, throbberURL, THROB_NUM);
  mThrobber->Show();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::destroy ( ) [inherited]

Definition at line 1927 of file nsBrowserWindow.cpp.

{
}
void nsBrowserWindow::DestroyWidget ( nsISupports *  aWidget) [protected]

Definition at line 453 of file nsBrowserWindow.cpp.

{
  if(aWidget) {
    nsCOMPtr<nsIWidget> w(do_QueryInterface(aWidget));
    if (w) {
      w->Destroy();
    }
  }
}

Here is the call graph for this function:

Implemented in nsNativeBrowserWindow.

Definition at line 764 of file nsBrowserWindow.cpp.

{
#if defined(CookieManagement) || defined(SingleSignon) || defined(ClientWallet)
  nsresult res;
#if defined(ClientWallet) || defined(SingleSignon)
  nsIWalletService *walletservice;
#endif
#ifdef ClientWallet
#define WALLET_EDITOR_URL "file:///y|/walleted.html"
  nsAutoString urlString; urlString.AssignWithConversion(WALLET_EDITOR_URL);
#endif
#endif

  nsEventStatus result;
#ifdef NS_DEBUG
  result = DispatchDebugMenu(aID);
  if (nsEventStatus_eIgnore != result) {
    return result;
  }
#endif
  result = DispatchStyleMenu(aID);
  if (nsEventStatus_eIgnore != result) {
    return result;
  }

  switch (aID) {
  case VIEWER_EXIT:
    mApp->Exit();
    return nsEventStatus_eConsumeNoDefault;

  case VIEWER_WINDOW_OPEN:
    mApp->OpenWindow();
    break;
  
  case VIEWER_FILE_OPEN:
    DoFileOpen();
    break;

  case VIEW_SOURCE:
    {
      //XXX Find out how the string is allocated, and perhaps delete it...
    }
    break;
  
  case VIEWER_EDIT_COPY:
    DoCopy();
    break;

  case VIEWER_EDIT_PASTE:
    DoPaste();
    break;

  case VIEWER_EDIT_FINDINPAGE:
    DoFind();
    break;

  case VIEWER_DEMO0:
  case VIEWER_DEMO1:
  case VIEWER_DEMO2:
  case VIEWER_DEMO3:
  case VIEWER_DEMO4:
  case VIEWER_DEMO5:
  case VIEWER_DEMO6:
  case VIEWER_DEMO7:
  case VIEWER_DEMO8: 
  case VIEWER_DEMO9: 
  case VIEWER_DEMO10: 
  case VIEWER_DEMO11: 
  case VIEWER_DEMO12: 
  case VIEWER_DEMO13:
  case VIEWER_DEMO14:
  case VIEWER_DEMO15:
  case VIEWER_DEMO16:
  case VIEWER_DEMO17:
    {
      PRIntn ix = aID - VIEWER_DEMO0;
      nsAutoString url; url.AssignWithConversion(SAMPLES_BASE_URL);
      url.AppendLiteral("/test");
      url.AppendInt(ix, 10);
      url.AppendLiteral(".html");
      nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
      webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
    }
    break;

  case VIEWER_XPTOOLKITTOOLBAR1:
    {
      nsAutoString url; url.AssignWithConversion(SAMPLES_BASE_URL);
      url.AppendLiteral("/toolbarTest1.xul");
      nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
      webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
      break;
    }
  case VIEWER_XPTOOLKITTREE1:
    {
      nsAutoString url; url.AssignWithConversion(SAMPLES_BASE_URL);
      url.AppendLiteral("/treeTest1.xul");
      nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
      webNav->LoadURI(url.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
      break;
    }
  
  case JS_CONSOLE:
    DoJSConsole();
    break;

  case VIEWER_PREFS:
    DoPrefs();
    break;

  case EDITOR_MODE:
    DoEditorMode(mDocShell);
    break;

  case VIEWER_ONE_COLUMN:
  case VIEWER_TWO_COLUMN:
  case VIEWER_THREE_COLUMN:
    ShowPrintPreview(aID);
    break;

  case VIEWER_PRINT:
    DoPrint();
    break;

  case VIEWER_TABLE_INSPECTOR:
    DoTableInspector();
    break;

  case VIEWER_IMAGE_INSPECTOR:
    DoImageInspector();
    break;

  case VIEWER_GFX_SCROLLBARS_ON: {
    SetBoolPref("nglayout.widget.gfxscrollbars", PR_TRUE);
    nsAutoString text;
    PRUint32 size;
    mLocation->GetText(text, 1000, size);
    GoTo(text.get());
    }
    break;

  case VIEWER_GFX_SCROLLBARS_OFF: {
    SetBoolPref("nglayout.widget.gfxscrollbars", PR_FALSE);
    nsAutoString text;
    PRUint32 size;
    mLocation->GetText(text, 1000, size);
    GoTo(text.get());
    }
    break;

  case VIEWER_GOTO_TEST_URL1: 
  case VIEWER_GOTO_TEST_URL2: {
    nsAutoString urlStr;
    const char * pref = (aID == VIEWER_GOTO_TEST_URL1) ? "nglayout.widget.testurl1" : "nglayout.widget.testurl2";
    GetStringPref(pref, urlStr);
    PRUint32 size;
    mLocation->SetText(urlStr, size);
    GoTo(urlStr.get());

    }
    break;

  case VIEWER_SAVE_TEST_URL1: 
  case VIEWER_SAVE_TEST_URL2: {
    nsAutoString text;
    PRUint32 size;
    mLocation->GetText(text, 1000, size);
    const char * pref = (aID == VIEWER_SAVE_TEST_URL1) ? "nglayout.widget.testurl1" : "nglayout.widget.testurl2";
    SetStringPref(pref, text);
    }
    break;

#ifdef PURIFY
  case VIEWER_PURIFY_SHOW_NEW_LEAKS:
  case VIEWER_PURIFY_SHOW_ALL_LEAKS:
  case VIEWER_PURIFY_CLEAR_ALL_LEAKS:
  case VIEWER_PURIFY_SHOW_ALL_HANDLES_IN_USE:
  case VIEWER_PURIFY_SHOW_NEW_IN_USE:
  case VIEWER_PURIFY_SHOW_ALL_IN_USE:
  case VIEWER_PURIFY_CLEAR_ALL_IN_USE:
  case VIEWER_PURIFY_HEAP_VALIDATE:
    DispatchPurifyEvent(aID);
    break;
#endif

  case VIEWER_ZOOM_500:
  case VIEWER_ZOOM_300:
  case VIEWER_ZOOM_200:
  case VIEWER_ZOOM_100:
  case VIEWER_ZOOM_070:
  case VIEWER_ZOOM_050:
  case VIEWER_ZOOM_030:
  case VIEWER_ZOOM_020:
    mDocShell->SetZoom((aID - VIEWER_ZOOM_BASE) / 10.0f);
    break;

#ifdef ClientWallet
  case PRVCY_PREFILL:
  case PRVCY_QPREFILL:
  nsIPresShell* shell;
  shell = nsnull;
  shell = GetPresShell();
  res = CallGetService(kWalletServiceCID, &walletservice);
  if ((NS_OK == res) && (nsnull != walletservice)) {
    nsString urlString2;
//    res = walletservice->WALLET_Prefill(shell, (PRVCY_QPREFILL == aID));
    NS_RELEASE(walletservice);
  }

#ifndef HTMLDialogs 
  if (aID == PRVCY_PREFILL) {
    nsAutoString url(NS_LITERAL_STRING("file:///y|/htmldlgs.htm"));
    nsBrowserWindow* bw = nsnull;
    mApp->OpenWindow(PRUint32(~0), bw);
    bw->SetVisibility(PR_TRUE);
    bw->GoTo(url.get());
    NS_RELEASE(bw);
  }
#endif
  break;

  case PRVCY_DISPLAY_WALLET:
  {


  /* set a cookie for the javascript wallet editor */
  res = CallGetService(kWalletServiceCID, &walletservice);
  if ((NS_OK == res) && (nsnull != walletservice)) {
    nsIURI * url;
    nsCOMPtr<nsIIOService> service(do_GetService(kIOServiceCID, &res));
    if (NS_FAILED(res)) return nsEventStatus_eIgnore;

    nsIURI *uri = nsnull;
    res = service->NewURI(NS_LITERAL_CSTRING(WALLET_EDITOR_URL), nsnull, nsnull, &uri);
    if (NS_FAILED(res)) return nsEventStatus_eIgnore;

    res = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url);
    NS_RELEASE(uri);
    if (NS_SUCCEEDED(res)) {
//      res = walletservice->WALLET_PreEdit(url);
      NS_RELEASE(walletservice);
    }
  }

  /* invoke the javascript wallet editor */
  nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
  webNav->LoadURI(urlString.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
  }
  break;
#endif

#if defined(CookieManagement)
  case PRVCY_DISPLAY_COOKIES:
  {
      break;
  }
#endif

#if defined(SingleSignon)
  case PRVCY_DISPLAY_SIGNONS:
  res = CallGetService(kWalletServiceCID, &walletservice);
  if ((NS_OK == res) && (nsnull != walletservice)) {
//    res = walletservice->SI_DisplaySignonInfoAsHTML();
    NS_RELEASE(walletservice);
  }
  break;
#endif

  }

  // Any menu IDs that the editor uses will be processed here
  DoEditorTest(mDocShell, aID);

  return nsEventStatus_eIgnore;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2680 of file nsBrowserWindow.cpp.

{
  nsEventStatus result = nsEventStatus_eIgnore;

  switch(aID) {
  case VIEWER_SELECT_STYLE_LIST:
    {
      nsIPresShell* shell = GetPresShell();
      if (nsnull != shell) {
        nsAutoString  defaultStyle;
        nsIDocument *doc = shell->GetDocument();
        if (doc) {
          nsIAtom* defStyleAtom = NS_NewAtom("default-style");
          doc->GetHeaderData(defStyleAtom, defaultStyle);
          NS_RELEASE(defStyleAtom);
        }

        nsStringArray titles;
        shell->ListAlternateStyleSheets(titles);
        nsAutoString  current;
        shell->GetActiveAlternateStyleSheet(current);

        PRInt32 count = titles.Count();
        fprintf(stdout, "There %s %d alternate style sheet%s\n",  
                ((1 == count) ? "is" : "are"),
                count,
                ((1 == count) ? "" : "s"));
        PRInt32 index;
        for (index = 0; index < count; index++) {
          fprintf(stdout, "%d: \"", index + 1);
          nsAutoString title;
          titles.StringAt(index, title);
          fputs(NS_LossyConvertUCS2toASCII(title).get(), stdout);
          fprintf(stdout, "\" %s%s\n", 
                  ((title.Equals(current, nsCaseInsensitiveStringComparator())) ? "<< current " : ""), 
                  ((title.Equals(defaultStyle, nsCaseInsensitiveStringComparator())) ? "** default" : ""));
        }
        NS_RELEASE(shell);
      }
    }
    result = nsEventStatus_eConsumeNoDefault;
    break;

  case VIEWER_SELECT_STYLE_DEFAULT:
    {
      nsIPresShell* shell = GetPresShell();
      if (nsnull != shell) {
        nsIDocument *doc = shell->GetDocument();
        if (doc) {
          nsAutoString  defaultStyle;
          nsIAtom* defStyleAtom = NS_NewAtom("default-style");
          doc->GetHeaderData(defStyleAtom, defaultStyle);
          NS_RELEASE(defStyleAtom);
          fputs("Selecting default style sheet \"", stdout);
          fputs(NS_LossyConvertUCS2toASCII(defaultStyle).get(), stdout);
          fputs("\"\n", stdout);
          shell->SelectAlternateStyleSheet(defaultStyle);
        }
        NS_RELEASE(shell);
      }
    }
    result = nsEventStatus_eConsumeNoDefault;
    break;

  case VIEWER_SELECT_STYLE_ONE:
  case VIEWER_SELECT_STYLE_TWO:
  case VIEWER_SELECT_STYLE_THREE:
  case VIEWER_SELECT_STYLE_FOUR:
    {
      nsIPresShell* shell = GetPresShell();
      if (nsnull != shell) {
        nsStringArray titles;
        shell->ListAlternateStyleSheets(titles);
        nsAutoString  title;
        titles.StringAt(aID - VIEWER_SELECT_STYLE_ONE, title);
        fputs("Selecting alternate style sheet \"", stdout);
        fputs(NS_LossyConvertUCS2toASCII(title).get(), stdout);
        fputs("\"\n", stdout);
        shell->SelectAlternateStyleSheet(title);
        NS_RELEASE(shell);
      }
    }
    result = nsEventStatus_eConsumeNoDefault;
    break;

  case VIEWER_USE_DTD_MODE:
  case VIEWER_NAV_QUIRKS_MODE:
  case VIEWER_STANDARD_MODE:
    SetCompatibilityMode(aID - VIEWER_USE_DTD_MODE);
    result = nsEventStatus_eConsumeNoDefault;
    break;
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1939 of file nsBrowserWindow.cpp.

{
  nsIPresShell* shell = GetPresShell();
  if (nsnull != shell) {
    shell->DoCopy();
    NS_RELEASE(shell);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2103 of file nsBrowserWindow.cpp.

{
  PRInt32 i, n;
  if (nsnull != aDocShell) {
    nsIContentViewer* mCViewer;
    aDocShell->GetContentViewer(&mCViewer);
    if (nsnull != mCViewer) {
      nsIDocumentViewer* mDViewer;
      if (NS_OK == mCViewer->QueryInterface(kIDocumentViewerIID, (void**) &mDViewer)) 
      {
        nsCOMPtr<nsIDocument> mDoc;
        mDViewer->GetDocument(getter_AddRefs(mDoc));
        if (nsnull != mDoc) {
          nsIDOMDocument* mDOMDoc;
          if (NS_OK == mDoc->QueryInterface(kIDOMDocumentIID, (void**) &mDOMDoc)) 
          {
            nsIPresShell* shell = GetPresShellFor(aDocShell);
            NS_InitEditorMode(mDOMDoc, shell);
            NS_RELEASE(mDOMDoc);
            NS_IF_RELEASE(shell);
          }
        }
        NS_RELEASE(mDViewer);
      }
      NS_RELEASE(mCViewer);
    }
    
    nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
    docShellAsNode->GetChildCount(&n);
    for (i = 0; i < n; i++) {
      nsCOMPtr<nsIDocShellTreeItem> child;
      docShellAsNode->GetChildAt(i, getter_AddRefs(child));
      nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
      DoEditorMode(childAsShell);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBrowserWindow::DoEditorTest ( nsIDocShell aDocShell,
PRInt32  aCommandID 
)

Definition at line 2143 of file nsBrowserWindow.cpp.

{
  if (nsnull != aDocShell) {
    nsIContentViewer* mCViewer;
    aDocShell->GetContentViewer(&mCViewer);
    if (nsnull != mCViewer) {
      nsIDocumentViewer* mDViewer;
      if (NS_OK == mCViewer->QueryInterface(kIDocumentViewerIID, (void**) &mDViewer)) 
      {
        nsCOMPtr<nsIDocument> mDoc;
        mDViewer->GetDocument(getter_AddRefs(mDoc));
        if (nsnull != mDoc) {
          nsIDOMDocument* mDOMDoc;
          if (NS_OK == mDoc->QueryInterface(kIDOMDocumentIID, (void**) &mDOMDoc)) 
          {
            NS_DoEditorTest(aCommandID);
            NS_RELEASE(mDOMDoc);
          }
        }
        NS_RELEASE(mDViewer);
      }
      NS_RELEASE(mCViewer);
    }
    // Do we need to do all the children as in DoEditorMode?
    // Its seems to work if we don't do that
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1096 of file nsBrowserWindow.cpp.

{
  nsCOMPtr<nsILocalFile> file;
  nsCOMPtr<nsIDOMWindow> domWindow;
  nsCOMPtr<nsIDOMWindowInternal> parentWindow;
  nsresult rv;

  // get nsIDOMWindowInternal interface for nsIFilePicker
  rv = mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
  if (NS_SUCCEEDED(rv))
    parentWindow = do_QueryInterface(domWindow);

  if (GetFileFromFileSelector(parentWindow, getter_AddRefs(file),
                              getter_AddRefs(mOpenFileDirectory))) {
    nsCOMPtr<nsIURI> uri;
    NS_NewFileURI(getter_AddRefs(uri), file);
    if (uri) {
      nsCAutoString spec;
      uri->GetSpec(spec);
      
      // Ask the Web widget to load the file URL
      nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
      webNav->LoadURI(NS_ConvertUTF8toUCS2(spec).get(),
                      nsIWebNavigation::LOAD_FLAGS_NONE,
                      nsnull,
                      nsnull,
                      nsnull);
      SetVisibility(PR_TRUE);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1189 of file nsBrowserWindow.cpp.

{
}

Here is the caller graph for this function:

Definition at line 2053 of file nsBrowserWindow.cpp.

{
  if (mImageInspectorDialog) {
    mImageInspectorDialog->SetVisible(PR_TRUE);
    return;
  }

  nsIDOMDocument* domDoc = GetDOMDocument(mDocShell);

  if (nsnull != domDoc) {
    nsString printHTML(NS_LITERAL_STRING("resource:/res/samples/image_props.html"));
    nsRect rect(0, 0, 485, 124);
    nsString title(NS_LITERAL_STRING("Image Inspector"));

    nsCOMPtr<nsIComponentManager> compMgr;
    NS_GetComponentManager(getter_AddRefs(compMgr));

    nsXPBaseWindow * xpWin;
    nsresult rv = compMgr->CreateInstance(kXPBaseWindowCID, nsnull, kIXPBaseWindowIID, (void **) &xpWin);
    if (rv == NS_OK) {
      xpWin->Init(eXPBaseWindowType_dialog, mAppShell, printHTML, title, rect, PRUint32(~0), PR_FALSE);
      xpWin->SetVisible(PR_TRUE);
      if (NS_OK == xpWin->QueryInterface(kIXPBaseWindowIID, (void**) &mImageInspectorDialog)) {
        mImageInspector = new nsImageInspectorDialog(this, domDoc); // ref counts domDoc
        if (nsnull != mImageInspector) {
          xpWin->AddWindowListener(mImageInspector); 
        }
      }
      NS_RELEASE(xpWin);
    }
    NS_RELEASE(domDoc);
  }

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2091 of file nsBrowserWindow.cpp.

{
  mApp->CreateJSConsole(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1949 of file nsBrowserWindow.cpp.

{
  nsIPresShell* shell = GetPresShell();
  if (nsnull != shell) {

    printf("nsBrowserWindow::DoPaste()\n");

    NS_RELEASE(shell);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2097 of file nsBrowserWindow.cpp.

{
  mApp->DoPrefs(this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1978 of file nsBrowserWindow.cpp.

{
  nsCOMPtr <nsIContentViewer> viewer;

  mDocShell->GetContentViewer(getter_AddRefs(viewer));

  if (viewer) {
    nsCOMPtr<nsIWebBrowserPrint> webBrowserPrint = do_QueryInterface(viewer);
    if (webBrowserPrint) {
      if (!mPrintSettings) {
        webBrowserPrint->GetGlobalPrintSettings(getter_AddRefs(mPrintSettings));
      }
      webBrowserPrint->Print(mPrintSettings, (nsIWebProgressListener*)nsnull);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2020 of file nsBrowserWindow.cpp.

{
  if (mTableInspectorDialog) {
    mTableInspectorDialog->SetVisible(PR_TRUE);
    return;
  }
  nsIDOMDocument* domDoc = GetDOMDocument(mDocShell);

  if (nsnull != domDoc) {
    nsString printHTML(NS_LITERAL_STRING("resource:/res/samples/printsetup.html"));
    nsRect rect(0, 0, 375, 510);
    nsString title(NS_LITERAL_STRING("Table Inspector"));

    nsCOMPtr<nsIComponentManager> compMgr;
    NS_GetComponentManager(getter_AddRefs(compMgr));

    nsXPBaseWindow * xpWin = nsnull;
    nsresult rv = compMgr->CreateInstance(kXPBaseWindowCID, nsnull, kIXPBaseWindowIID, (void **) &xpWin);
    if (rv == NS_OK) {
      xpWin->Init(eXPBaseWindowType_dialog, mAppShell, printHTML, title, rect, PRUint32(~0), PR_FALSE);
      xpWin->SetVisible(PR_TRUE);
      if (NS_OK == xpWin->QueryInterface(kIXPBaseWindowIID, (void**) &mTableInspectorDialog)) {
        mTableInspector = new nsTableInspectorDialog(this, domDoc); // ref counts domDoc
        if (nsnull != mTableInspector) {
          xpWin->AddWindowListener(mTableInspector); 
        }
      }
      NS_RELEASE(xpWin);
    }
    NS_RELEASE(domDoc);
  }

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2775 of file nsBrowserWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsBrowserWindow * nsBrowserWindow::FindBrowserFor ( nsIWidget aWidget,
PRIntn  aWhich 
) [static]

Definition at line 498 of file nsBrowserWindow.cpp.

{
  nsIWidget*        widget;
  nsBrowserWindow*  result = nsnull;

  if (!gBrowsers)
    return nsnull;

  PRInt32 i, n = gBrowsers->Count();
  for (i = 0; i < n; i++) {
    nsBrowserWindow* bw = (nsBrowserWindow*) gBrowsers->ElementAt(i);
    if (nsnull != bw) {
      switch (aWhich) {
      case FIND_WINDOW:
        if (bw->mWindow) {
          bw->mWindow->QueryInterface(kIWidgetIID, (void**) &widget);
          if (widget == aWidget) {
            result = bw;
          }
          NS_IF_RELEASE(widget);
        }
        break;
      case FIND_BACK:
        if (bw->mBack) {
          bw->mBack->QueryInterface(kIWidgetIID, (void**) &widget);
          if (widget == aWidget) {
            result = bw;
          }
          NS_IF_RELEASE(widget);
        }
        break;
      case FIND_FORWARD:
        if (bw->mForward) {
          bw->mForward->QueryInterface(kIWidgetIID, (void**) &widget);
          if (widget == aWidget) {
            result = bw;
          }
          NS_IF_RELEASE(widget);
        }
        break;
      case FIND_LOCATION:
        if (bw->mLocation) {
          bw->mLocation->QueryInterface(kIWidgetIID, (void**) &widget);
          if (widget == aWidget) {
            result = bw;
          }
          NS_IF_RELEASE(widget);
        }
        break;
      }
    }
  }
  if (nsnull != result) {
    NS_ADDREF(result);
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBrowserWindow::FindNext ( const nsString aSearchStr,
PRBool  aMatchCase,
PRBool  aSearchDown,
PRBool aIsFound 
)

Definition at line 1132 of file nsBrowserWindow.cpp.

{
  // Insert find code here.

  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 1140 of file nsBrowserWindow.cpp.

{
  nsIPresShell* shell = GetPresShell();
  if (nsnull != shell) {
    nsIViewManager *vm = shell->GetViewManager();
    if (vm) {
      nsIView* root;
      vm->GetRootView(root);
      if (nsnull != root) {
        vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE);
      }
    }
    NS_RELEASE(shell);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1048 of file nsBrowserWindow.cpp.

{
  nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
  webNav->GoForward();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1823 of file nsBrowserWindow.cpp.

{
  aChromeMaskResult = mChromeMask;
  return NS_OK;
}

Definition at line 1798 of file nsBrowserWindow.cpp.

{
  mWindow->GetClientBounds(aBounds);
  return NS_OK;
}

Definition at line 1837 of file nsBrowserWindow.cpp.

{
  NS_IF_ADDREF(*aResult = mDocShell);
  return NS_OK;
}

Definition at line 1830 of file nsBrowserWindow.cpp.

{
  NS_IF_ADDREF(aResult = mDocShell);
  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 1996 of file nsBrowserWindow.cpp.

{
  nsIDOMDocument* domDoc = nsnull;
  if (nsnull != aDocShell) {
    nsIContentViewer* mCViewer;
    aDocShell->GetContentViewer(&mCViewer);
    if (nsnull != mCViewer) {
      nsIDocumentViewer* mDViewer;
      if (NS_OK == mCViewer->QueryInterface(kIDocumentViewerIID, (void**) &mDViewer)) {
        nsCOMPtr<nsIDocument> mDoc;
        mDViewer->GetDocument(getter_AddRefs(mDoc));
        if (nsnull != mDoc) {
          mDoc->QueryInterface(kIDOMDocumentIID, (void**) &domDoc);
        }
        NS_RELEASE(mDViewer);
      }
      NS_RELEASE(mCViewer);
    }
  }
  return domDoc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIInterfaceRequestor::getInterface ( in nsIIDRef  uuid,
[iid_is(uuid), retval] out nsQIResult  result 
) [inherited]

Retrieves the specified interface pointer.

Parameters:
uuidThe IID of the interface being requested.
result[out] The interface pointer to be filled in if the interface is accessible.
Returns:
NS_OK - interface was successfully returned. NS_NOINTERFACE - interface not accessible. NS_ERROR* - method failure.
nsresult nsBrowserWindow::GetMenuBarHeight ( PRInt32 aHeightOut) [virtual]

Reimplemented in nsNativeBrowserWindow.

Definition at line 1588 of file nsBrowserWindow.cpp.

{
  NS_ASSERTION(nsnull != aHeightOut,"null out param.");

  *aHeightOut = 0;

  return NS_OK;
}

Here is the caller graph for this function:

void nsIBaseWindow::getPosition ( out long  x,
out long  y 
) [inherited]
void nsIBaseWindow::getPositionAndSize ( out long  x,
out long  y,
out long  cx,
out long  cy 
) [inherited]

Definition at line 1932 of file nsBrowserWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::getSize ( out long  cx,
out long  cy 
) [inherited]
void nsBrowserWindow::GetStringPref ( const char *  aPrefName,
nsString aValue 
)

Definition at line 2499 of file nsBrowserWindow.cpp.

{
  NS_ASSERTION(nsnull != aPrefName, "null pref name");

  nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
  if (nsnull != prefs && nsnull != aPrefName)
  {
    char* prefCharVal;
    nsresult result = prefs->CopyCharPref(aPrefName, &prefCharVal);
    if (NS_SUCCEEDED(result)) {
      aValue.AssignWithConversion(prefCharVal);
      PL_strfree(prefCharVal);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBrowserWindow::GetWindow ( nsIWidget **  aWindow) [virtual]

Definition at line 2789 of file nsBrowserWindow.cpp.

{
  if (aWindow && mWindow) {
    *aWindow = mWindow.get();
    NS_IF_ADDREF(*aWindow);
    return NS_OK;
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Definition at line 1805 of file nsBrowserWindow.cpp.

{
  mWindow->GetBounds(aBounds);
  return NS_OK;
}

Definition at line 1055 of file nsBrowserWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBrowserWindow::Init ( nsIAppShell aAppShell,
const nsRect aBounds,
PRUint32  aChromeMask,
PRBool  aAllowPlugins = PR_TRUE 
)

Definition at line 1299 of file nsBrowserWindow.cpp.

{
  mChromeMask = aChromeMask;
  mAppShell = aAppShell;
  NS_IF_ADDREF(mAppShell);
  mAllowPlugins = aAllowPlugins;

  // Create top level window
  nsresult rv;
  mWindow = do_CreateInstance(kWindowCID, &rv);
  if (NS_OK != rv) {
    return rv;
  }
  nsWidgetInitData initData;
  initData.mWindowType = eWindowType_toplevel;
  initData.mBorderStyle = eBorderStyle_default;

  nsRect r(0, 0, aBounds.width, aBounds.height);
  mWindow->Create((nsIWidget*)NULL, r, HandleBrowserEvent,
                  nsnull, aAppShell, nsnull, &initData);
  mWindow->GetClientBounds(r);

  // Create web shell
  mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
  NS_ENSURE_TRUE(mWebBrowser, NS_ERROR_FAILURE);

  r.x = r.y = 0;
  nsCOMPtr<nsIBaseWindow> webBrowserWin(do_QueryInterface(mWebBrowser));
  rv = webBrowserWin->InitWindow(mWindow->GetNativeData(NS_NATIVE_WIDGET), nsnull, r.x, r.y, r.width, r.height);
  NS_ENSURE_SUCCESS(EnsureWebBrowserChrome(), NS_ERROR_FAILURE);
  mWebBrowser->SetContainerWindow(mWebBrowserChrome);
  nsWeakPtr weakling(
      do_GetWeakReference((nsIWebProgressListener*)mWebBrowserChrome));
  mWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener));

  webBrowserWin->Create();

  // Give the embedding app a chance to do platforms-specific window setup
  InitNativeWindow();

  // Disable global history because we don't have profile-relative file locations
  nsCOMPtr<nsIWebBrowserSetup> setup(do_QueryInterface(mWebBrowser));
  if (setup)
    setup->SetProperty(nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY, PR_FALSE);

  mDocShell = do_GetInterface(mWebBrowser);
  mDocShell->SetAllowPlugins(aAllowPlugins);
  webBrowserWin->SetVisibility(PR_TRUE);

  if (nsIWebBrowserChrome::CHROME_MENUBAR & aChromeMask) {
    rv = CreateMenuBar(r.width);
    if (NS_OK != rv) {
      return rv;
    }
    mHaveMenuBar = PR_TRUE;
    mWindow->GetClientBounds(r);
    r.x = r.y = 0;
  }

  if (nsIWebBrowserChrome::CHROME_TOOLBAR & aChromeMask) {
    rv = CreateToolBar(r.width);
    if (NS_OK != rv) {
      return rv;
    }
  }

  if (nsIWebBrowserChrome::CHROME_STATUSBAR & aChromeMask) {
    rv = CreateStatusBar(r.width);
    if (NS_OK != rv) {
      return rv;
    }
  }

  // Now lay it all out
  Layout(r.width, r.height);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBrowserWindow::Init ( nsIAppShell aAppShell,
const nsRect aBounds,
PRUint32  aChromeMask,
PRBool  aAllowPlugins,
nsIDocumentViewer aDocViewer,
nsPresContext aPresContext 
)

Definition at line 1382 of file nsBrowserWindow.cpp.

{
  mChromeMask = aChromeMask;
  mAppShell = aAppShell;
  NS_IF_ADDREF(mAppShell);
  mAllowPlugins = aAllowPlugins;
  // Create top level window
  nsresult rv;
  mWindow = do_CreateInstance(kWindowCID, &rv);
  if (NS_FAILED(rv)) {
    return rv;
  }
  nsWidgetInitData initData;
  initData.mWindowType = eWindowType_toplevel;
  initData.mBorderStyle = eBorderStyle_default;
  nsRect r(0, 0, aBounds.width, aBounds.height);
  mWindow->Create((nsIWidget*)NULL, r, HandleBrowserEvent,
                 
nsnull, aAppShell, nsnull, &initData);
  mWindow->GetClientBounds(r);
  // Create web shell
  mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
  NS_ENSURE_TRUE(mWebBrowser, NS_ERROR_FAILURE);
  r.x = r.y = 0;
  nsCOMPtr<nsIBaseWindow> webBrowserWin(do_QueryInterface(mWebBrowser));
  rv = webBrowserWin->InitWindow(mWindow->GetNativeData(NS_NATIVE_WIDGET),
nsnull, r.x, r.y, r.width, r.height);
  NS_ENSURE_SUCCESS(EnsureWebBrowserChrome(), NS_ERROR_FAILURE);
  mWebBrowser->SetContainerWindow(mWebBrowserChrome);
  webBrowserWin->Create();
  mDocShell = do_GetInterface(mWebBrowser);
  mDocShell->SetAllowPlugins(aAllowPlugins);
  webBrowserWin->SetVisibility(PR_TRUE);
  if (nsIWebBrowserChrome::CHROME_MENUBAR & aChromeMask) {
    rv = CreateMenuBar(r.width);
    if (NS_OK != rv) {
      return rv;
    }
    mWindow->GetClientBounds(r);
    r.x = r.y = 0;
  }
  if (nsIWebBrowserChrome::CHROME_TOOLBAR & aChromeMask) {
    rv = CreateToolBar(r.width);
    if (NS_OK != rv) {
      return rv;
    }
  }
  if (nsIWebBrowserChrome::CHROME_STATUSBAR & aChromeMask)
{
    rv = CreateStatusBar(r.width);
    if (NS_OK != rv) {
      return rv;
    }
  }
  // Give the embedding app a chance to do platforms-specific window setup
  InitNativeWindow();
 
  // Now lay it all out
  Layout(r.width, r.height);




  // Create a document viewer and bind it to the webshell
  nsCOMPtr<nsIDocumentViewer> docv;
  aDocumentViewer->CreateDocumentViewerUsing(aPresContext,
                                             getter_AddRefs(docv));
  docv->SetContainer(mWebBrowser);
  nsCOMPtr<nsIContentViewerContainer> cvContainer = do_QueryInterface(mDocShell);
  cvContainer->Embed(docv, "duh", nsnull);

  webBrowserWin->SetVisibility(PR_TRUE);

  return NS_OK;
}

Here is the call graph for this function:

Reimplemented in nsNativeBrowserWindow.

Definition at line 112 of file nsBrowserWindow.h.

{ return NS_OK; }

Here is the caller graph for this function:

void nsIBaseWindow::initWindow ( in nativeWindow  parentNativeWindow,
in nsIWidget  parentWidget,
in long  x,
in long  y,
in long  cx,
in long  cy 
) [inherited]
void nsBrowserWindow::Layout ( PRInt32  aWidth,
PRInt32  aHeight 
)

Definition at line 1646 of file nsBrowserWindow.cpp.

{
  nscoord txtHeight;
  nscoord menuBarHeight;
  {
    nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService(kLookAndFeelCID);
    if (lookAndFeel) {
      lookAndFeel->GetMetric(nsILookAndFeel::eMetric_TextFieldHeight, txtHeight);
    } else {
      txtHeight = 24;
    }
  }

  // Find out the menubar height
  GetMenuBarHeight(&menuBarHeight);

  nsRect rr(0, 0, aWidth, aHeight);

  // position location bar (it's stretchy)
  if (nsIWebBrowserChrome::CHROME_TOOLBAR & mChromeMask) {
    nsIWidget* locationWidget = nsnull;
    if (mLocation &&
        NS_SUCCEEDED(mLocation->QueryInterface(kIWidgetIID,
                                               (void**)&locationWidget))) {
      if (mThrobber) {
        PRInt32 width = PR_MAX(aWidth - (2*BUTTON_WIDTH + THROBBER_WIDTH), 0);
      
        locationWidget->Resize(2*BUTTON_WIDTH, menuBarHeight,
                               width,
                               BUTTON_HEIGHT,
                               PR_TRUE);
        mThrobber->MoveTo(aWidth - THROBBER_WIDTH, menuBarHeight);
      }
      else {
        PRInt32 width = PR_MAX(aWidth - 2*BUTTON_WIDTH, 0);
        locationWidget->Resize(2*BUTTON_WIDTH, menuBarHeight,
                               width,
                               BUTTON_HEIGHT,
                               PR_TRUE);
      }

      locationWidget->Show(PR_TRUE);
      NS_RELEASE(locationWidget);

      nsIWidget* w = nsnull;
      if (mBack &&
          NS_SUCCEEDED(mBack->QueryInterface(kIWidgetIID, (void**)&w))) {
        w->Move(0, menuBarHeight);
        w->Show(PR_TRUE);
        NS_RELEASE(w);
      }
      if (mForward &&
          NS_SUCCEEDED(mForward->QueryInterface(kIWidgetIID, (void**)&w))) {
        w->Move(BUTTON_WIDTH, menuBarHeight);
        w->Show(PR_TRUE);
        NS_RELEASE(w);
      }
    }
  }
  else {
    nsIWidget* w = nsnull;
    if (mLocation &&
        NS_SUCCEEDED(mLocation->QueryInterface(kIWidgetIID, (void**)&w))) {
      w->Show(PR_FALSE);
      NS_RELEASE(w);
    }
    if (mBack &&
        NS_SUCCEEDED(mBack->QueryInterface(kIWidgetIID, (void**)&w))) {
      w->Move(0, menuBarHeight);
      w->Show(PR_FALSE);
      NS_RELEASE(w);
    }
    if (mForward &&
        NS_SUCCEEDED(mForward->QueryInterface(kIWidgetIID, (void**)&w))) {
      w->Move(BUTTON_WIDTH, menuBarHeight);
      w->Show(PR_FALSE);
      NS_RELEASE(w);
    }
    if (mThrobber) {
      mThrobber->Hide();
    }
  }
  
  nsIWidget* statusWidget = nsnull;

  if (mStatus && NS_OK == mStatus->QueryInterface(kIWidgetIID,(void**)&statusWidget)) {
    if (mChromeMask & nsIWebBrowserChrome::CHROME_STATUSBAR) {
      statusWidget->Resize(0, aHeight - txtHeight,
                           aWidth, txtHeight,
                           PR_TRUE);

      //Since allowing a negative height is a bad idea, let's condition this...
      rr.height = PR_MAX(0,rr.height-txtHeight);
      statusWidget->Show(PR_TRUE);
    }
    else {
      statusWidget->Show(PR_FALSE);
    }
    NS_RELEASE(statusWidget);
  }

  // inset the web widget

  if (nsIWebBrowserChrome::CHROME_TOOLBAR & mChromeMask) {
    rr.height -= BUTTON_HEIGHT;
    rr.y += BUTTON_HEIGHT;
  }

  rr.x += WEBSHELL_LEFT_INSET;
  rr.y += WEBSHELL_TOP_INSET + menuBarHeight;
  rr.width -= WEBSHELL_LEFT_INSET + WEBSHELL_RIGHT_INSET;
  rr.height -= WEBSHELL_TOP_INSET + WEBSHELL_BOTTOM_INSET + menuBarHeight;

  //Since allowing a negative height is a bad idea, let's condition this...
  if(rr.height<0)
    rr.height=0;

  nsCOMPtr<nsIBaseWindow> webBrowserWin(do_QueryInterface(mWebBrowser));
  if (webBrowserWin) {
    webBrowserWin->SetPositionAndSize(rr.x, rr.y, rr.width, rr.height, PR_FALSE);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1922 of file nsBrowserWindow.cpp.

{
}

Definition at line 1770 of file nsBrowserWindow.cpp.

{
  NS_PRECONDITION(nsnull != mWindow, "null window");
  mWindow->Move(aX, aY);
  return NS_OK;
}
void nsIProgressEventSink::onProgress ( in nsIRequest  aRequest,
in nsISupports  aContext,
in unsigned long long  aProgress,
in unsigned long long  aProgressMax 
) [inherited]

Called to notify the event sink that progress has occurred for the given request.

Parameters:
aRequestthe request being observed (may QI to nsIChannel).
aContextif aRequest is a channel, then this parameter is the listener context passed to nsIChannel::asyncOpen.
aProgressnumeric value in the range 0 to aProgressMax indicating the number of bytes transfered thus far.
aProgressMaxnumeric value indicating maximum number of bytes that will be transfered (or 0xFFFFFFFFFFFFFFFF if total is unknown).
void nsIProgressEventSink::onStatus ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsresult  aStatus,
in wstring  aStatusArg 
) [inherited]

Called to notify the event sink with a status message for the given request.

Parameters:
aRequestthe request being observed (may QI to nsIChannel).
aContextif aRequest is a channel, then this parameter is the listener context passed to nsIChannel::asyncOpen.
aStatusstatus code (not necessarily an error code) indicating the state of the channel (usually the state of the underlying transport). see nsISocketTransport for socket specific status codes.
aStatusArgstatus code argument to be used with the string bundle service to convert the status message into localized, human readable text. the meaning of this parameter is specific to the value of the status code. for socket status codes, this parameter indicates the host:port associated with the status code.


Main Handler

Definition at line 1165 of file nsBrowserWindow.cpp.

{ 
  nsEventStatus result = nsEventStatus_eIgnore;

  //printf("aEvent->message %d\n", aEvent->message);
  switch(aEvent->message) {

    case NS_KEY_DOWN: {
    } break;

    case NS_MOUSE_LEFT_BUTTON_UP: {
    } break;

    case NS_PAINT: 
      break;
    default:
      result = nsEventStatus_eIgnore;
  }
    //printf("result: %d = %d\n", result, PR_FALSE);

    return result;
}

Definition at line 569 of file nsBrowserWindow.cpp.

{
  //nsViewerApp* app = aBrowser->mApp;
  if (!gBrowsers)
    return;
  gBrowsers->RemoveElement(aBrowser);
  if (!gBrowsers->Count()) {
    delete gBrowsers;
    gBrowsers = nsnull;
  }
  NS_RELEASE(aBrowser);
}
void nsIBaseWindow::repaint ( in boolean  force) [inherited]

Tell the window to repaint itself.

Parameters:
aForce- if true, repaint immediately if false, the window may defer repainting as it sees fit.

Definition at line 206 of file nsBrowserWindow.h.

                                 {
    mApp = aApp;
  }

Here is the caller graph for this function:

void nsBrowserWindow::SetBoolPref ( const char *  aPrefName,
PRBool  aValue 
)

Definition at line 2470 of file nsBrowserWindow.cpp.

{
  NS_ASSERTION(nsnull != aPrefName,"null pref name");

  nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
  if (prefs && nsnull != aPrefName)
  {
    prefs->SetBoolPref(aPrefName, aValue);
    prefs->SavePrefFile(nsnull);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1812 of file nsBrowserWindow.cpp.

{
  mChromeMask = aChromeMask;
  nsRect r;
  mWindow->GetClientBounds(r);
  Layout(r.width, r.height);

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 2663 of file nsBrowserWindow.cpp.

{
  nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID));
  if (pref) { 
    int32 prefInt = USE_DTD;
    if (STANDARD == aMode) {
      prefInt = eCompatibility_FullStandards;
    }
    else if (QUIRKS == aMode) {
      prefInt = eCompatibility_NavQuirks;
    }
    pref->SetIntPref("nglayout.compatibility.mode", prefInt);
    pref->SavePrefFile(nsnull);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::setFocus ( ) [inherited]

Give the window focus.

void nsIBaseWindow::setPosition ( in long  x,
in long  y 
) [inherited]
void nsIBaseWindow::setPositionAndSize ( in long  x,
in long  y,
in long  cx,
in long  cy,
in boolean  fRepaint 
) [inherited]
NS_IMETHODIMP nsBrowserWindow::SetProgress ( PRInt32  aProgress,
PRInt32  aProgressMax 
)

Definition at line 1845 of file nsBrowserWindow.cpp.

{
  return NS_OK;
}

Definition at line 212 of file nsBrowserWindow.h.

                                    {
    mShowLoadTimes = aOn;
  }

Here is the caller graph for this function:

void nsIBaseWindow::setSize ( in long  cx,
in long  cy,
in boolean  fRepaint 
) [inherited]
void nsBrowserWindow::SetStringPref ( const char *  aPrefName,
const nsString aValue 
)

Definition at line 2483 of file nsBrowserWindow.cpp.

{
  NS_ASSERTION(nsnull != aPrefName, "null pref name");

  nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
  if (nsnull != prefs && nsnull != aPrefName)
  {
    char * prefStr = ToNewCString(aValue);
    prefs->SetCharPref(aPrefName, prefStr);
    prefs->SavePrefFile(nsnull);
    delete [] prefStr;
  }

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1464 of file nsBrowserWindow.cpp.

{
  if (mWebCrawler) {
    if (mDocShell) {
      nsCOMPtr<nsIWebProgress> progress(do_GetInterface(mDocShell));
      NS_ASSERTION(progress, "no web progress avail");

      (void) progress->RemoveProgressListener(
                                (nsIWebProgressListener*)mWebCrawler);
    }
    NS_RELEASE(mWebCrawler);
  }
  if (aCrawler) {
    mWebCrawler = aCrawler;
    NS_ADDREF(aCrawler);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1851 of file nsBrowserWindow.cpp.

{
  return NS_OK;
}

Definition at line 1963 of file nsBrowserWindow.cpp.

{
  nsCOMPtr <nsIContentViewer> viewer;

  mDocShell->GetContentViewer(getter_AddRefs(viewer));

  if (viewer)
  {
    nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
    if (viewerFile) {
      //viewerFile->PrintPreview(nsnull);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1778 of file nsBrowserWindow.cpp.

{
  NS_PRECONDITION(nsnull != mWindow, "null window");

  // XXX We want to do this in one shot
  mWindow->Resize(aWidth, aHeight, PR_FALSE);
  Layout(aWidth, aHeight);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBrowserWindow::SizeWindowTo ( PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aWidthTransient,
PRBool  aHeightTransient 
)

Definition at line 1790 of file nsBrowserWindow.cpp.

{
  return SizeContentTo(aWidth, aHeight);
}

Here is the call graph for this function:

Definition at line 1912 of file nsBrowserWindow.cpp.

{
}

Definition at line 1917 of file nsBrowserWindow.cpp.

{
}

Friends And Related Function Documentation

friend class nsWebBrowserChrome [friend]

Definition at line 91 of file nsBrowserWindow.h.


Member Data Documentation

set blurSuppression to true to suppress handling of blur events.

set it false to re-enable them. query it to determine whether blur events are suppressed. The implementation should allow for blur events to be suppressed multiple times.

Definition at line 205 of file nsIBaseWindow.idl.

Definition at line 198 of file nsIBaseWindow.idl.

Definition at line 253 of file nsBrowserWindow.h.

Definition at line 212 of file nsIBaseWindow.idl.

Definition at line 250 of file nsBrowserWindow.h.

Definition at line 216 of file nsBrowserWindow.h.

Definition at line 249 of file nsBrowserWindow.h.

Definition at line 233 of file nsBrowserWindow.h.

Definition at line 219 of file nsBrowserWindow.h.

Definition at line 223 of file nsBrowserWindow.h.

Definition at line 234 of file nsBrowserWindow.h.

Definition at line 266 of file nsBrowserWindow.h.

Definition at line 246 of file nsBrowserWindow.h.

Definition at line 242 of file nsBrowserWindow.h.

Definition at line 228 of file nsBrowserWindow.h.

Definition at line 232 of file nsBrowserWindow.h.

Definition at line 226 of file nsBrowserWindow.h.

Definition at line 268 of file nsBrowserWindow.h.

Definition at line 243 of file nsBrowserWindow.h.

Definition at line 229 of file nsBrowserWindow.h.

Definition at line 238 of file nsBrowserWindow.h.

Definition at line 245 of file nsBrowserWindow.h.

Definition at line 241 of file nsBrowserWindow.h.

Definition at line 235 of file nsBrowserWindow.h.

Definition at line 220 of file nsBrowserWindow.h.

Definition at line 224 of file nsBrowserWindow.h.

Definition at line 265 of file nsBrowserWindow.h.

Definition at line 217 of file nsBrowserWindow.h.

Definition at line 222 of file nsBrowserWindow.h.

Definition at line 240 of file nsBrowserWindow.h.

Definition at line 185 of file nsIBaseWindow.idl.

Definition at line 174 of file nsIBaseWindow.idl.

attribute wstring nsIBaseWindow::title [inherited]

Definition at line 222 of file nsIBaseWindow.idl.

Definition at line 192 of file nsIBaseWindow.idl.


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