Back to index

lightning-sunbird  0.9+nobinonly
os2Embed.h File Reference
#include "prtypes.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


nsresult CreateBrowserWindow (PRUint32 aChromeFlags, nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **aNewWindow)
void EnableChromeWindow (nsIWebBrowserChrome *aWindow, PRBool aEnabled)
PRUint32 RunEventLoop (PRBool &aRunCondition)

Function Documentation

nsresult CreateBrowserWindow ( PRUint32  aChromeFlags,
nsIWebBrowserChrome aParent,
nsIWebBrowserChrome **  aNewWindow 

Definition at line 1403 of file os2Embed.cpp.

  WebBrowserChrome * chrome = new WebBrowserChrome();
  if (!chrome)
    return NS_ERROR_FAILURE;

  // the interface to return and one addref, which we assume will be
  // immediately released
  CallQueryInterface(NS_STATIC_CAST(nsIWebBrowserChrome*, chrome), aNewWindow);
  // now an extra addref; the window owns itself (to be released by
  // WebBrowserChromeUI::Destroy)


  // Insert the browser
  nsCOMPtr<nsIWebBrowser> newBrowser;
  chrome->CreateBrowser(-1, -1, -1, -1, getter_AddRefs(newBrowser));
  if (!newBrowser)
    return NS_ERROR_FAILURE;

  // Place it where we want it.
  ResizeEmbedding(NS_STATIC_CAST(nsIWebBrowserChrome*, chrome));

  // Subscribe new window to profile changes so it can kill itself when one happens
  nsCOMPtr<nsIObserverService> observerService(do_GetService(";1"));
  if (observerService)
    observerService->AddObserver(NS_STATIC_CAST(nsIObserver *, chrome),
                                 "profile-change-teardown", PR_TRUE);

  // if opened as chrome, it'll be made visible after the chrome has loaded.
  // otherwise, go ahead and show it now.
  if (!(aChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME))
    WebBrowserChromeUI::ShowWindow(*aNewWindow, PR_TRUE);

  return NS_OK;

Here is the call graph for this function:

void EnableChromeWindow ( nsIWebBrowserChrome aWindow,
PRBool  aEnabled 

Definition at line 1444 of file os2Embed.cpp.

  HWND hwnd = GetBrowserDlgFromChrome(aWindow);
  ::WinEnableWindow(hwnd, aEnabled ? TRUE : FALSE);

Here is the call graph for this function:

PRUint32 RunEventLoop ( PRBool aRunCondition)

Definition at line 1451 of file os2Embed.cpp.

  QMSG msg;
  HEV hFakeEvent = 0; 
  ::DosCreateEventSem(NULL, &hFakeEvent, 0L, FALSE);

  while (aRunCondition ) {
    // Process pending messages
    while (::WinPeekMsg((HAB)0, &msg, NULL, 0, 0, PM_NOREMOVE)) {
      if (!::WinGetMsg((HAB)0, &msg, NULL, 0, 0)) {
        // WM_QUIT
        aRunCondition = PR_FALSE;

      PRBool wasHandled = PR_FALSE;
      ::NS_HandleEmbeddingEvent(msg, wasHandled);
      if (wasHandled)

      ::WinDispatchMsg((HAB)0, &msg);

    // Do idle stuff
    ::DosWaitEventSem(hFakeEvent, 100);
  return LONGFROMMP(msg.mp1);