Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
Mozilla::Embedding::Gecko Class Reference

#include <DotNETEmbed.h>

Collaboration diagram for Mozilla::Embedding::Gecko:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Gecko ()
void OpenURL (String *url)

Static Public Member Functions

static void TermEmbedding ()

Protected Member Functions

void OnResize (EventArgs *e)

Private Member Functions

void CreateBrowserWindow (PRUint32 aChromeFlags, nsIWebBrowserChrome *aParent)

Private Attributes

nsIWebBrowserChromemChrome

Static Private Attributes

static bool sIsInitialized = false

Detailed Description

Definition at line 57 of file DotNETEmbed.h.


Constructor & Destructor Documentation

Definition at line 311 of file DotNETEmbed.cpp.

  : mChrome(nsnull)
{
}

Here is the caller graph for this function:


Member Function Documentation

void Gecko::CreateBrowserWindow ( PRUint32  aChromeFlags,
nsIWebBrowserChrome aParent 
) [private]

Definition at line 387 of file DotNETEmbed.cpp.

{
  WebBrowserChrome * chrome = new WebBrowserChrome();
  if (!chrome) {
    throw new OutOfMemoryException();
  }

  mChrome = chrome;
  NS_ADDREF(mChrome);

  // XXX: Is this really needed?
  // now an extra addref; the window owns itself (to be released by
  // WebBrowserChromeUI::Destroy)
  NS_ADDREF(mChrome);

  chrome->SetChromeFlags(aChromeFlags);

  HWND hWnd = (HWND)Handle.ToPointer();

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

  // Place it where we want it.
  OnResize(0);

  // 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))
    ::ShowWindow(hWnd, SW_RESTORE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Gecko::OnResize ( EventArgs *  e) [protected]

Definition at line 360 of file DotNETEmbed.cpp.

{
  if (mChrome) {
    nsCOMPtr<nsIEmbeddingSiteWindow> embeddingSite =
      do_QueryInterface(mChrome);

    RECT rect;
    GetClientRect((HWND)Handle.ToPointer(), &rect);

    // Make sure the browser is visible and sized
    nsCOMPtr<nsIWebBrowser> webBrowser;
    mChrome->GetWebBrowser(getter_AddRefs(webBrowser));
    nsCOMPtr<nsIBaseWindow> webBrowserAsWin = do_QueryInterface(webBrowser);
    if (webBrowserAsWin) {
      webBrowserAsWin->SetPositionAndSize(rect.left,
                                          rect.top,
                                          rect.right - rect.left,
                                          rect.bottom - rect.top,
                                          PR_TRUE);
      webBrowserAsWin->SetVisibility(PR_TRUE);
    }
  }

  UserControl::OnResize(e);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 330 of file DotNETEmbed.cpp.

{
  if (!sIsInitialized) {
    nsresult rv = NS_InitEmbedding(nsnull, nsnull);
    ThrowIfFailed(rv);

    sIsInitialized = true;
  }

  const wchar_t __pin * url = PtrToStringChars(aUrl);
  nsresult rv;

  HWND hWnd = (HWND)Handle.ToPointer();

  if (!mChrome) {
    CreateBrowserWindow(nsIWebBrowserChrome::CHROME_ALL, nsnull);
  }

  // Start loading a page
  nsCOMPtr<nsIWebBrowser> newBrowser;
  mChrome->GetWebBrowser(getter_AddRefs(newBrowser));
  nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(newBrowser));

  rv = webNav->LoadURI(url, nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull,
                       nsnull);

  ThrowIfFailed(rv);
}

Here is the call graph for this function:

void Gecko::TermEmbedding ( ) [static]

Definition at line 317 of file DotNETEmbed.cpp.

{
  if (!sIsInitialized) {
    return;
  }

  sIsInitialized = false;

  nsresult rv = NS_TermEmbedding();
  ThrowIfFailed(rv);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 74 of file DotNETEmbed.h.

Definition at line 76 of file DotNETEmbed.h.


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