Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
EmbedPrivate Class Reference

#include <EmbedPrivate.h>

Collaboration diagram for EmbedPrivate:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 EmbedPrivate ()
 ~EmbedPrivate ()
nsresult Init (GtkMozEmbed *aOwningWidget)
nsresult Realize (PRBool *aAlreadRealized)
void Unrealize (void)
void Show (void)
void Hide (void)
void Resize (PRUint32 aWidth, PRUint32 aHeight)
void Destroy (void)
void SetURI (const char *aURI)
void LoadCurrentURI (void)
void Reload (PRUint32 reloadFlags)
void SetChromeMask (PRUint32 chromeMask)
void ApplyChromeMask ()
nsresult OpenStream (const char *aBaseURI, const char *aContentType)
nsresult AppendToStream (const PRUint8 *aData, PRUint32 aLen)
nsresult CloseStream (void)
void ContentStateChange (void)
void ContentFinishedLoading (void)
void ChildFocusIn (void)
void ChildFocusOut (void)
 EmbedPrivate ()
 ~EmbedPrivate ()
nsresult Init (PtWidget_t *aOwningWidget)
nsresult Setup ()
void Unrealize (void)
void Show (void)
void Hide (void)
void Position (PRUint32 aX, PRUint32 aY)
void Size (PRUint32 aWidth, PRUint32 aHeight)
void Destroy (void)
void SetURI (const char *aURI)
void LoadCurrentURI (void)
void Stop (void)
void Reload (int32_t flags)
void Back (void)
void Forward (void)
void ScrollUp (int amount)
void ScrollDown (int amount)
void ScrollLeft (int amount)
void ScrollRight (int amount)
void ScrollTo (int x, int y)
void Cut (int ig)
void Copy (int ig)
void Paste (int ig)
void SelectAll (void)
void Clear (void)
int SaveAs (char *fname, char *dirname)
void Print (PpPrintContext_t *pc)
PRBool CanGoBack ()
PRBool CanGoForward ()
nsIPrefGetPrefs ()
nsresult OpenStream (const char *aBaseURI, const char *aContentType)
nsresult AppendToStream (const char *aData, PRInt32 aLen)
nsresult CloseStream (void)
void ContentStateChange (void)
void ContentFinishedLoading (void)
nsresult GetPIDOMWindow (nsPIDOMWindow **aPIWin)

Static Public Member Functions

static void PushStartup (void)
static void PopStartup (void)
static void SetCompPath (const char *aPath)
static void SetAppComponents (const nsModuleComponentInfo *aComps, int aNumComponents)
static void SetProfilePath (const char *aDir, const char *aName)
static void SetDirectoryServiceProvider (nsIDirectoryServiceProvider *appFileLocProvider)
static EmbedPrivateFindPrivateForBrowser (nsIWebBrowserChrome *aBrowser)
static EmbedPrivateFindPrivateForBrowser (nsIWebBrowserChrome *aBrowser)

Public Attributes

GtkMozEmbed * mOwningWidget
EmbedWindowmWindow
nsCOMPtr< nsISupports > mWindowGuard
EmbedProgressmProgress
nsCOMPtr< nsISupports > mProgressGuard
EmbedContentListenermContentListener
nsCOMPtr< nsISupports > mContentListenerGuard
EmbedEventListenermEventListener
nsCOMPtr< nsISupports > mEventListenerGuard
nsCOMPtr< nsIWebNavigationmNavigation
nsCOMPtr< nsISHistorymSessionHistory
nsCOMPtr< nsIDOMEventReceivermEventReceiver
nsString mURI
PRUint32 mChromeMask
PRBool mIsChrome
PRBool mChromeLoaded
GtkWidget * mMozWindowWidget
PRBool mIsDestroyed
PtWidget_t * mOwningWidget
EmbedStreammStream
nsCOMPtr< nsISupports > mStreamGuard
EmbedPrintListenermPrint
nsCOMPtr< nsISupports > mPrintGuard
nsCOMPtr< nsIPrintSettingsm_PrintSettings
PtWidget_t * mMozWindowWidget

Static Public Attributes

static PRUint32 sWidgetCount = 0
static char * sCompPath = nsnull
static const
nsModuleComponentInfo
sAppComps = nsnull
static int sNumAppComps = 0
static nsIAppShellsAppShell = nsnull
static nsVoidArraysWindowList = nsnull
static char * sProfileDir = nsnull
static char * sProfileName = nsnull
static
nsProfileDirServiceProvider
sProfileDirServiceProvider = nsnull
static nsIPrefsPrefs = nsnull
static
nsIDirectoryServiceProvider
sAppFileLocProvider = nsnull
static nsClipboardsClipboard = nsnull

Private Member Functions

void GetListener (void)
void AttachListeners (void)
void DetachListeners (void)
nsresult GetPIDOMWindow (nsPIDOMWindow **aPIWin)
void GetListener (void)
void AttachListeners (void)
void DetachListeners (void)
void PrintHeaderFooter_FormatSpecialCodes (const char *original, nsString &aNewStr)

Static Private Member Functions

static nsresult StartupProfile (void)
static void ShutdownProfile (void)
static nsresult RegisterAppComponents ()
static void EnsureOffscreenWindow (void)
static void DestroyOffscreenWindow (void)

Private Attributes

PRBool mListenersAttached

Static Private Attributes

static GtkWidget * sOffscreenWindow = 0
static GtkWidget * sOffscreenFixed = 0

Detailed Description

Definition at line 68 of file EmbedPrivate.h.


Constructor & Destructor Documentation

Definition at line 162 of file EmbedPrivate.cpp.

{
  sWindowList->RemoveElement(this);
  PopStartup();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 617 of file EmbedPrivate.cpp.

{
  // Attach listeners to this document since in some cases we don't
  // get updates for content added this way.
  ContentStateChange();

  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  nsCOMPtr<nsIWebBrowserStream> wbStream = do_QueryInterface(webBrowser);
  if (!wbStream) return NS_ERROR_FAILURE;

  return wbStream->AppendToStream(aData, aLen);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult EmbedPrivate::AppendToStream ( const char *  aData,
PRInt32  aLen 
)

Definition at line 688 of file EmbedPrivate.cpp.

{
  if (!mStream)
    return NS_ERROR_FAILURE;

  // Attach listeners to this document since in some cases we don't
  // get updates for content added this way.
  ContentStateChange();

  return mStream->AppendToStream(aData, aLen);
}

Here is the call graph for this function:

Definition at line 436 of file EmbedPrivate.cpp.

{
   if (mWindow) {
      nsCOMPtr<nsIWebBrowser> webBrowser;
      mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

      nsCOMPtr<nsIDOMWindow> domWindow;
      webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
      if (domWindow) {

         nsCOMPtr<nsIDOMBarProp> scrollbars;
         domWindow->GetScrollbars(getter_AddRefs(scrollbars));
         if (scrollbars) {

            scrollbars->SetVisible
               (mChromeMask & nsIWebBrowserChrome::CHROME_SCROLLBARS ?
                PR_TRUE : PR_FALSE);
         }
      }
   }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 842 of file EmbedPrivate.cpp.

{
  if (!mEventReceiver || mListenersAttached)
    return;

  nsIDOMEventListener *eventListener =
    NS_STATIC_CAST(nsIDOMEventListener *,
                 NS_STATIC_CAST(nsIDOMKeyListener *, mEventListener));

  // add the key listener
  nsresult rv;
  rv = mEventReceiver->AddEventListenerByIID(eventListener,
                                        NS_GET_IID(nsIDOMKeyListener));
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to add key listener\n");
    return;
  }

  rv = mEventReceiver->AddEventListenerByIID(eventListener,
                                        NS_GET_IID(nsIDOMMouseListener));
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to add mouse listener\n");
    return;
  }

  rv = mEventReceiver->AddEventListenerByIID(eventListener,
                                             NS_GET_IID(nsIDOMUIListener));
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to add UI listener\n");
    return;
  }

  // ok, all set.
  mListenersAttached = PR_TRUE;
}

Here is the caller graph for this function:

Definition at line 425 of file EmbedPrivate.cpp.

{
       if (mNavigation)
              mNavigation->GoBack();
}

Here is the caller graph for this function:

Definition at line 505 of file EmbedPrivate.cpp.

{
       PRBool nsresult = PR_FALSE;

       if (mNavigation)
       mNavigation->GetCanGoBack(&nsresult);

       return (nsresult);
}

Here is the caller graph for this function:

Definition at line 516 of file EmbedPrivate.cpp.

{
       PRBool nsresult = PR_FALSE;

       if (mNavigation)
       mNavigation->GetCanGoForward(&nsresult);

       return (nsresult);
}

Here is the caller graph for this function:

Definition at line 755 of file EmbedPrivate.cpp.

{
  if (mIsDestroyed)
    return;

#ifdef MOZ_WIDGET_GTK2
  nsresult rv;
  nsCOMPtr<nsIWebBrowser> webBrowser;
  rv = mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
  if (NS_FAILED(rv))
    return;

  nsCOMPtr<nsIWebBrowserFocus> webBrowserFocus(do_QueryInterface(webBrowser));
  if (!webBrowserFocus)
    return;
  
  webBrowserFocus->Activate();
#endif /* MOZ_WIDGET_GTK2 */

#ifdef MOZ_WIDGET_GTK
  nsCOMPtr<nsPIDOMWindow> piWin;
  GetPIDOMWindow(getter_AddRefs(piWin));

  if (!piWin)
    return;

  piWin->Activate();
#endif /* MOZ_WIDGET_GTK */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 786 of file EmbedPrivate.cpp.

{
  if (mIsDestroyed)
    return;

#ifdef MOZ_WIDGET_GTK2
  nsresult rv;
  nsCOMPtr<nsIWebBrowser> webBrowser;
  rv = mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
  if (NS_FAILED(rv))
         return;

  nsCOMPtr<nsIWebBrowserFocus> webBrowserFocus(do_QueryInterface(webBrowser));
  if (!webBrowserFocus)
         return;
  
  webBrowserFocus->Deactivate();
#endif /* MOZ_WIDGET_GTK2 */

#ifdef MOZ_WIDGET_GTK
  nsCOMPtr<nsPIDOMWindow> piWin;
  GetPIDOMWindow(getter_AddRefs(piWin));

  if (!piWin)
    return;

  piWin->Deactivate();

  // but the window is still active until the toplevel gets a focus
  // out
  nsIFocusController *focusController = piWin->GetRootFocusController();
  if (focusController)
    focusController->SetActive(PR_TRUE);
#endif /* MOZ_WIDGET_GTK */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 620 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(mWindow->mWebBrowser));
       if (clipboard)
           clipboard->SelectNone();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 633 of file EmbedPrivate.cpp.

{
  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  nsCOMPtr<nsIWebBrowserStream> wbStream = do_QueryInterface(webBrowser);
  if (!wbStream) return NS_ERROR_FAILURE;

  return wbStream->CloseStream();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 687 of file EmbedPrivate.cpp.

{
  if (mIsChrome) {
    // We're done loading.
    mChromeLoaded = PR_TRUE;

    // get the web browser
    nsCOMPtr<nsIWebBrowser> webBrowser;
    mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

    // get the content DOM window for that web browser
    nsCOMPtr<nsIDOMWindow> domWindow;
    webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
    if (!domWindow) {
      NS_WARNING("no dom window in content finished loading\n");
      return;
    }

    // resize the content
    domWindow->SizeToContent();

    // and since we're done loading show the window, assuming that the
    // visibility flag has been set.
    PRBool visibility;
    mWindow->GetVisibility(&visibility);
    if (visibility)
      mWindow->SetVisibility(PR_TRUE);
  }
}

Here is the call graph for this function:

Definition at line 670 of file EmbedPrivate.cpp.

{

  // we don't attach listeners to chrome
  if (mListenersAttached && !mIsChrome)
    return;

  GetListener();

  if (!mEventReceiver)
    return;

  AttachListeners();

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 542 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(mWindow->mWebBrowser));
       if (clipboard) {
              //
              // Pass Voyager input group to clipboard functions.
              // Using Ctrl-C/V does not do this, only Edit->Copy/Paste.
              //
              if (sClipboard)
                     sClipboard->SetInputGroup(ig);
           clipboard->CopySelection();
              }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 527 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(mWindow->mWebBrowser));
       if (clipboard) {
              //
              // Pass Voyager input group to clipboard functions.
              // Using Ctrl-C/V does not do this, only Edit->Copy/Paste.
              //
              if (sClipboard)
                     sClipboard->SetInputGroup(ig);
           clipboard->CutSelection();
              }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 335 of file EmbedPrivate.cpp.

{
  // This flag might have been set from
  // EmbedWindow::DestroyBrowserWindow() as well if someone used a
  // window.close() or something or some other script action to close
  // the window.  No harm setting it again.
  mIsDestroyed = PR_TRUE;

  // Get the nsIWebBrowser object for our embedded window.
  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  // Release our progress listener
  nsCOMPtr<nsISupportsWeakReference> supportsWeak;
  supportsWeak = do_QueryInterface(mProgressGuard);
  nsCOMPtr<nsIWeakReference> weakRef;
  supportsWeak->GetWeakReference(getter_AddRefs(weakRef));
  webBrowser->RemoveWebBrowserListener(weakRef,
                                   nsIWebProgressListener::GetIID());
  weakRef = nsnull;
  supportsWeak = nsnull;

  // Release our content listener
  webBrowser->SetParentURIContentListener(nsnull);
  mContentListenerGuard = nsnull;
  mContentListener = nsnull;

  // Now that we have removed the listener, release our progress
  // object
  mProgressGuard = nsnull;
  mProgress = nsnull;

  // detach our event listeners and release the event receiver
  DetachListeners();
  if (mEventReceiver)
    mEventReceiver = nsnull;

  // destroy our child window
  mWindow->ReleaseChildren();

  // release navigation
  mNavigation = nsnull;

  // release session history
  mSessionHistory = nsnull;

  mOwningWidget = nsnull;

  mMozWindowWidget = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1079 of file EmbedPrivate.cpp.

{
  if (!sOffscreenWindow)
    return;
  gtk_widget_destroy(sOffscreenWindow);
  sOffscreenWindow = 0;
}

Here is the caller graph for this function:

Definition at line 879 of file EmbedPrivate.cpp.

{
  if (!mListenersAttached || !mEventReceiver)
    return;

  nsIDOMEventListener *eventListener =
    NS_STATIC_CAST(nsIDOMEventListener *,
                 NS_STATIC_CAST(nsIDOMKeyListener *, mEventListener));

  nsresult rv;
  rv = mEventReceiver->RemoveEventListenerByIID(eventListener,
                                          NS_GET_IID(nsIDOMKeyListener));
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to remove key listener\n");
    return;
  }

  rv =
    mEventReceiver->RemoveEventListenerByIID(eventListener,
                                        NS_GET_IID(nsIDOMMouseListener));
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to remove mouse listener\n");
    return;
  }

  rv = mEventReceiver->RemoveEventListenerByIID(eventListener,
                                          NS_GET_IID(nsIDOMUIListener));
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to remove UI listener\n");
    return;
  }

  mListenersAttached = PR_FALSE;
}

Here is the caller graph for this function:

Definition at line 1066 of file EmbedPrivate.cpp.

{
  if (sOffscreenWindow)
    return;
  sOffscreenWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_realize(sOffscreenWindow);
  sOffscreenFixed = gtk_fixed_new();
  gtk_container_add(GTK_CONTAINER(sOffscreenWindow), sOffscreenFixed);
  gtk_widget_realize(sOffscreenFixed);
}

Here is the caller graph for this function:

Definition at line 646 of file EmbedPrivate.cpp.

{
  if (!sWindowList)
    return nsnull;

  // Get the number of browser windows.
  PRInt32 count = sWindowList->Count();
  // This function doesn't get called very often at all ( only when
  // creating a new window ) so it's OK to walk the list of open
  // windows.
  for (int i = 0; i < count; i++) {
    EmbedPrivate *tmpPrivate = NS_STATIC_CAST(EmbedPrivate *,
                                         sWindowList->ElementAt(i));
    // get the browser object for that window
    nsIWebBrowserChrome *chrome = NS_STATIC_CAST(nsIWebBrowserChrome *,
                                           tmpPrivate->mWindow);
    if (chrome == aBrowser)
      return tmpPrivate;
  }

  return nsnull;
}

Definition at line 432 of file EmbedPrivate.cpp.

{
       if (mNavigation)
              mNavigation->GoForward();
}

Here is the caller graph for this function:

Definition at line 825 of file EmbedPrivate.cpp.

{
  if (mEventReceiver)
    return;

  nsCOMPtr<nsPIDOMWindow> piWin;
  GetPIDOMWindow(getter_AddRefs(piWin));

  if (!piWin)
    return;

  mEventReceiver = do_QueryInterface(piWin->GetChromeEventHandler());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 915 of file EmbedPrivate.cpp.

{
  *aPIWin = nsnull;

  // get the web browser
  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  // get the content DOM window for that web browser
  nsCOMPtr<nsIDOMWindow> domWindow;
  webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
  if (!domWindow)
    return NS_ERROR_FAILURE;

  // get the private DOM window
  nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
  // and the root window for that DOM window
  *aPIWin = domWindowPrivate->GetPrivateRoot();

  if (*aPIWin) {
    NS_ADDREF(*aPIWin);
    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 230 of file EmbedPrivate.cpp.

{
       return (sPrefs);
}

Here is the caller graph for this function:

Definition at line 315 of file EmbedPrivate.cpp.

{
  // Get the nsIWebBrowser object for our embedded window.
  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  // and set the visibility on the thing
  nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(webBrowser);
  baseWindow->SetVisibility(PR_FALSE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult EmbedPrivate::Init ( GtkMozEmbed *  aOwningWidget)

Definition at line 169 of file EmbedPrivate.cpp.

{
  // are we being re-initialized?
  if (mOwningWidget)
    return NS_OK;

  // hang on with a reference to the owning widget
  mOwningWidget = aOwningWidget;

  // Create our embed window, and create an owning reference to it and
  // initialize it.  It is assumed that this window will be destroyed
  // when we go out of scope.
  mWindow = new EmbedWindow();
  mWindowGuard = NS_STATIC_CAST(nsIWebBrowserChrome *, mWindow);
  mWindow->Init(this);

  // Create our progress listener object, make an owning reference,
  // and initialize it.  It is assumed that this progress listener
  // will be destroyed when we go out of scope.
  mProgress = new EmbedProgress();
  mProgressGuard = NS_STATIC_CAST(nsIWebProgressListener *,
                                   mProgress);
  mProgress->Init(this);

  // Create our content listener object, initialize it and attach it.
  // It is assumed that this will be destroyed when we go out of
  // scope.
  mContentListener = new EmbedContentListener();
  mContentListenerGuard = NS_STATIC_CAST(nsISupports*, NS_STATIC_CAST(nsIURIContentListener*, mContentListener));
  mContentListener->Init(this);

  // Create our key listener object and initialize it.  It is assumed
  // that this will be destroyed before we go out of scope.
  mEventListener = new EmbedEventListener();
  mEventListenerGuard =
    NS_STATIC_CAST(nsISupports *, NS_STATIC_CAST(nsIDOMKeyListener *,
                                           mEventListener));
  mEventListener->Init(this);

  // has the window creator service been set up?
  static int initialized = PR_FALSE;
  // Set up our window creator ( only once )
  if (!initialized) {
    // We set this flag here instead of on success.  If it failed we
    // don't want to keep trying and leaking window creator objects.
    initialized = PR_TRUE;

    // create our local object
    EmbedWindowCreator *creator = new EmbedWindowCreator();
    nsCOMPtr<nsIWindowCreator> windowCreator;
    windowCreator = NS_STATIC_CAST(nsIWindowCreator *, creator);

    // Attach it via the watcher service
    nsCOMPtr<nsIWindowWatcher> watcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
    if (watcher)
      watcher->SetWindowCreator(windowCreator);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult EmbedPrivate::Init ( PtWidget_t *  aOwningWidget)

Definition at line 145 of file EmbedPrivate.cpp.

{
       // are we being re-initialized?
       if (mOwningWidget)
              return NS_OK;

       // hang on with a reference to the owning widget
       mOwningWidget = aOwningWidget;

       // Create our embed window, and create an owning reference to it and
       // initialize it.  It is assumed that this window will be destroyed
       // when we go out of scope.
       mWindow = new EmbedWindow();
       mWindowGuard = NS_STATIC_CAST(nsIWebBrowserChrome *, mWindow);
       mWindow->Init(this);

       // Create our progress listener object, make an owning reference,
       // and initialize it.  It is assumed that this progress listener
       // will be destroyed when we go out of scope.
       mProgress = new EmbedProgress();
       mProgressGuard = NS_STATIC_CAST(nsIWebProgressListener *,
                                      mProgress);
       mProgress->Init(this);

       // Create our content listener object, initialize it and attach it.
       // It is assumed that this will be destroyed when we go out of
       // scope.
       mContentListener = new EmbedContentListener();
       mContentListenerGuard = mContentListener;
       mContentListener->Init(this);

       // Create our key listener object and initialize it.  It is assumed
       // that this will be destroyed before we go out of scope.
       mEventListener = new EmbedEventListener();
       mEventListenerGuard =
       NS_STATIC_CAST(nsISupports *, NS_STATIC_CAST(nsIDOMKeyListener *,
                                           mEventListener));
       mEventListener->Init(this);

       // Create our print listener object, make an owning reference,
       // and initialize it.  It is assumed that this print listener
       // will be destroyed when we go out of scope.
       mPrint = new EmbedPrintListener();
       mPrintGuard = NS_STATIC_CAST(nsIWebProgressListener *, mPrint);
       mPrint->Init(this);

       // has the window creator service been set up?
       static int initialized = PR_FALSE;
       // Set up our window creator ( only once )
       if (!initialized) 
       {
              // We set this flag here instead of on success.  If it failed we
              // don't want to keep trying and leaking window creator objects.
              initialized = PR_TRUE;

              // create our local object
              EmbedWindowCreator *creator = new EmbedWindowCreator();
              nsCOMPtr<nsIWindowCreator> windowCreator;
              windowCreator = NS_STATIC_CAST(nsIWindowCreator *, creator);

              // Attach it via the watcher service
              nsCOMPtr<nsIWindowWatcher> watcher = do_GetService(sWatcherContractID);
              if (watcher)
              watcher->SetWindowCreator(windowCreator);
  }

       if (!sPrefs)
       {
              // get prefs
              nsresult rv;
              nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID, &rv));
              if (pref)
              {
                     sPrefs = pref.get();
                     NS_ADDREF( sPrefs );
                     extern int sProfileDirCreated;
                     if( sProfileDirCreated ) mozilla_set_default_pref( pref );
                     sPrefs->ReadUserPrefs( nsnull );
              }
       }

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 401 of file EmbedPrivate.cpp.

{
  if (mURI.Length()) {
    nsCOMPtr<nsPIDOMWindow> piWin;
    GetPIDOMWindow(getter_AddRefs(piWin));

    nsAutoPopupStatePusher popupStatePusher(piWin, openAllowed);

    mNavigation->LoadURI(mURI.get(),                        // URI string
                         nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
                         nsnull,                            // Referring URI
                         nsnull,                            // Post data
                         nsnull);                           // extra headers
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult EmbedPrivate::OpenStream ( const char *  aBaseURI,
const char *  aContentType 
)

Definition at line 599 of file EmbedPrivate.cpp.

{
  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  nsCOMPtr<nsIWebBrowserStream> wbStream = do_QueryInterface(webBrowser);
  if (!wbStream) return NS_ERROR_FAILURE;

  nsCOMPtr<nsIURI> uri;
  nsresult rv = NS_NewURI(getter_AddRefs(uri), aBaseURI);
  if (NS_FAILED(rv))
    return rv;

  rv = wbStream->OpenStream(uri, nsDependentCString(aContentType));
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult EmbedPrivate::OpenStream ( const char *  aBaseURI,
const char *  aContentType 
)

Definition at line 557 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(mWindow->mWebBrowser));
       if (clipboard) {
              //
              // Pass Voyager input group to clipboard functions.
              // Using Ctrl-C/V does not do this, only Edit->Copy/Paste.
              //
              if (sClipboard)
                     sClipboard->SetInputGroup(ig);
           clipboard->Paste();
              }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 521 of file EmbedPrivate.cpp.

{
  sWidgetCount--;
  if (sWidgetCount == 0) {

    // destroy the offscreen window
    DestroyOffscreenWindow();

    // shut down the profiles
    ShutdownProfile();

    if (sAppShell) {
      // Shutdown the appshell service.
      sAppShell->Spindown();
      NS_RELEASE(sAppShell);
      sAppShell = 0;
    }

    // shut down XPCOM/Embedding
    NS_TermEmbedding();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 303 of file EmbedPrivate.cpp.

{
       mWindow->mBaseWindow->SetPosition(aX, aY);
}

Here is the caller graph for this function:

void EmbedPrivate::Print ( PpPrintContext_t *  pc)

Definition at line 628 of file EmbedPrivate.cpp.

{
    nsCOMPtr<nsIWebBrowserPrint> browserAsPrint = do_GetInterface(mWindow->mWebBrowser);
    NS_ASSERTION(browserAsPrint, "No nsIWebBrowserPrint!");

    nsCOMPtr<nsIPrintSettings> printSettings;
    browserAsPrint->GetGlobalPrintSettings(getter_AddRefs(printSettings));
    if (printSettings) 
    {
    printSettings->SetPrintSilent(PR_TRUE);
              printSettings->SetEndPageRange((PRInt32) pc);

              nsAutoString format_left_footer;
              PrintHeaderFooter_FormatSpecialCodes( g_Print_Left_Footer_String, format_left_footer );
              nsAutoString format_right_footer;
              PrintHeaderFooter_FormatSpecialCodes( g_Print_Right_Footer_String, format_right_footer );
              nsAutoString format_left_header;
              PrintHeaderFooter_FormatSpecialCodes( g_Print_Left_Header_String, format_left_header );
              nsAutoString format_right_header;
              PrintHeaderFooter_FormatSpecialCodes( g_Print_Right_Header_String, format_right_header );

              printSettings->SetFooterStrLeft( format_left_footer.get() );
              printSettings->SetFooterStrRight( format_right_footer.get() );
              printSettings->SetHeaderStrLeft( format_left_header.get() );
              printSettings->SetHeaderStrRight( format_right_header.get() );
    }

              nsIPref *pref = GetPrefs();
              pref->SetBoolPref( "print.show_print_progress", PR_FALSE );

    browserAsPrint->Print(printSettings, mPrint);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::PrintHeaderFooter_FormatSpecialCodes ( const char *  original,
nsString aNewStr 
) [private]

Definition at line 1022 of file EmbedPrivate.cpp.

{
       /* Think of this as a sprintf-variant. */

       const char *szPattern = original;

       time_t aclock;
       struct tm *tm;

       char workBuffer[20], *sz;

       nsAutoString result;

       while ( *szPattern )
       {
              if (*szPattern != FORMAT_ESCAPE_CHARACTER)
              {
                     workBuffer[0] = *szPattern;
                     szPattern++;
                     workBuffer[1] = 0;

                     nsAutoString ss;
                     ss.AssignWithConversion( workBuffer );
                     result += ss;
              }
              else
              {
                     szPattern++;                       /* skip over '&' */
                     switch (*szPattern)
                     {
                     case 'w':                                 /* window name */
                     case 'W':
                            szPattern++;                /* advance past "&w" */

                            /* add the title */
                            PRUnichar *uTitle;
                            mWindow->GetTitle( &uTitle );
                            result += uTitle;
                            break;


                     case 'u':                                 /* URL */
                     case 'U':                                 /* TODO should this be ifdef'd for kiosk's */
                            szPattern++;                /* advance past "&w" */

                            /* add the URL */
                            result += mURI.get();
                            break;


                     case 'd':            /* date -- american style "mmm dd yyyy" */
                     case 'D':            /* date -- european style "dd mmm yyyy" */
                            szPattern++;
                            
                            (void) time(&aclock);
                            tm = localtime(&aclock);
                            sz = asctime(tm);

                            /*  ..........1.........2.... .   */
                            /*  012345678901234567890123. .   */
                            /* "Fri Oct 22 09:15:00 1993\n\0" */

                            if (szPattern[1] == 'd')
                            {
                                   workBuffer[0] = sz[4];      /* O */
                                   workBuffer[1] = sz[5];      /* c */
                                   workBuffer[2] = sz[6];      /* t */
                                   workBuffer[3] = sz[7];      /* _ */
                                   workBuffer[4] = sz[8];      /* 2 */
                                   workBuffer[5] = sz[9];      /* 2 */
                            }
                            else
                            {
                                   workBuffer[0] = sz[8];      /* 2 */
                                   workBuffer[1] = sz[9];      /* 2 */
                                   workBuffer[2] = sz[7];      /* _ */
                                   workBuffer[3] = sz[4];      /* O */
                                   workBuffer[4] = sz[5];      /* c */
                                   workBuffer[5] = sz[6];      /* t */
                            }
                            workBuffer[6] = sz[10];     /* _ */
                            workBuffer[7] = sz[20];     /* 1 */
                            workBuffer[8] = sz[21];     /* 9 */
                            workBuffer[9] = sz[22];     /* 9 */
                            workBuffer[10] = sz[23];    /* 3 */
                            workBuffer[11] = 0;

                            /* add the content of workBuffer */
                            {
                            nsAutoString ss;
                            ss.AssignWithConversion( workBuffer );
                            result += ss;
                            }

                            break;


                     case 't':                                 /* time "HH:MM am" (12 hour format) */
                            szPattern++;

                            (void) time(&aclock);
                            tm = localtime(&aclock);

                            strftime(workBuffer, sizeof(workBuffer), "%I:%M %p", tm);

                            {
                            /* add the content of workBuffer */
                            nsAutoString ss;
                            ss.AssignWithConversion( workBuffer );
                            result += ss;
                            }

                            break;

                            
                     case 'T':                                 /* time "HH:MM" (24 hour format) */
                            szPattern++;

                            (void) time(&aclock);
                            tm = localtime(&aclock);

                            strftime(workBuffer, sizeof(workBuffer), "%H:%M", tm);

                            /* add the content of workBuffer */
                            {
                            nsAutoString ss;
                            ss.AssignWithConversion( workBuffer );
                            result += ss;
                            }
                            break;

                     case 'p':                                 /* current page number */
                            szPattern++;

                            {
                            /* add the page number */
                            const PRUnichar * uStr = NS_LITERAL_STRING( "&P" ).get();
                            result += uStr;
                            }
                            break;

                     case 'P': /* current of total number of pages */
                            /* add the page number */
                            {
                            const PRUnichar * uStr = NS_LITERAL_STRING( "&PT" ).get();
                            result += uStr;
                            }
                            break;

                     case FORMAT_ESCAPE_CHARACTER:      /* && expands to a single & */

                            workBuffer[0] = *szPattern;
                            szPattern++;
                            workBuffer[1] = 0;
                            {
                            nsAutoString ss;
                            ss.AssignWithConversion( workBuffer );
                            result += ss;
                            }
                            break;

                     case '\0':                                /* copy '&' to output */

                            workBuffer[0] = FORMAT_ESCAPE_CHARACTER;
                            workBuffer[1] = 0;
                            {
                            nsAutoString ss;
                            ss.AssignWithConversion( workBuffer );
                            result += ss;
                            }
                            break;
                            
                     default:                                  /* copy '&*' to output */
#if 0
                            SM_STRNCPY(p,(const char *) &szPattern[-1],lenCopy);
#endif
                            szPattern++;

                            /* add the &szPattern[-1] */
                            {
                            nsAutoString ss;
                            ss.AssignWithConversion( &szPattern[-1] );
                            result += ss;
                            }
                            break;
                     }
              }
       }

       aNewStr.Assign( result );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 470 of file EmbedPrivate.cpp.

{
  // increment the number of widgets
  sWidgetCount++;

  // if this is the first widget, fire up xpcom
  if (sWidgetCount == 1) {
    nsresult rv;
    nsCOMPtr<nsILocalFile> binDir;

    if (sCompPath) {
      rv = NS_NewNativeLocalFile(nsDependentCString(sCompPath), 1, getter_AddRefs(binDir));
      if (NS_FAILED(rv))
       return;
    }

    rv = NS_InitEmbedding(binDir, sAppFileLocProvider);
    if (NS_FAILED(rv))
      return;

    // we no longer need a reference to the DirectoryServiceProvider
    if (sAppFileLocProvider) {
      NS_RELEASE(sAppFileLocProvider);
      sAppFileLocProvider = nsnull;
    }

    rv = StartupProfile();
    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to start up profiles.\n");

    rv = RegisterAppComponents();
    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n");

    // XXX startup appshell service?
    // XXX create offscreen window for appshell service?
    // XXX remove X prop from offscreen window?

    nsCOMPtr<nsIAppShell> appShell;
    appShell = do_CreateInstance(kAppShellCID);
    if (!appShell) {
      NS_WARNING("Failed to create appshell in EmbedPrivate::PushStartup!\n");
      return;
    }
    sAppShell = appShell.get();
    NS_ADDREF(sAppShell);
    sAppShell->Create(0, nsnull);
    sAppShell->Spinup();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult EmbedPrivate::Realize ( PRBool aAlreadRealized)

Definition at line 230 of file EmbedPrivate.cpp.

{

  *aAlreadyRealized = PR_FALSE;

  // create the offscreen window if we have to
  EnsureOffscreenWindow();

  // Have we ever been initialized before?  If so then just reparetn
  // from the offscreen window.
  if (mMozWindowWidget) {
    gtk_widget_reparent(mMozWindowWidget, GTK_WIDGET(mOwningWidget));
    *aAlreadyRealized = PR_TRUE;
    return NS_OK;
  }

  // Get the nsIWebBrowser object for our embedded window.
  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  // get a handle on the navigation object
  mNavigation = do_QueryInterface(webBrowser);

  // Create our session history object and tell the navigation object
  // to use it.  We need to do this before we create the web browser
  // window.
  mSessionHistory = do_CreateInstance(NS_SHISTORY_CONTRACTID);
  mNavigation->SetSessionHistory(mSessionHistory);

  // create the window
  mWindow->CreateWindow();

  // bind the progress listener to the browser object
  nsCOMPtr<nsISupportsWeakReference> supportsWeak;
  supportsWeak = do_QueryInterface(mProgressGuard);
  nsCOMPtr<nsIWeakReference> weakRef;
  supportsWeak->GetWeakReference(getter_AddRefs(weakRef));
  webBrowser->AddWebBrowserListener(weakRef,
                                nsIWebProgressListener::GetIID());

  // set ourselves as the parent uri content listener
  nsCOMPtr<nsIURIContentListener> uriListener;
  uriListener = do_QueryInterface(mContentListenerGuard);
  webBrowser->SetParentURIContentListener(uriListener);

  // save the window id of the newly created window
  nsCOMPtr<nsIWidget> mozWidget;
  mWindow->mBaseWindow->GetMainWidget(getter_AddRefs(mozWidget));
  // get the native drawing area
  GdkWindow *tmp_window =
    NS_STATIC_CAST(GdkWindow *,
                 mozWidget->GetNativeData(NS_NATIVE_WINDOW));
  // and, thanks to superwin we actually need the parent of that.
  tmp_window = gdk_window_get_parent(tmp_window);
  // save the widget ID - it should be the mozarea of the window.
  gpointer data = nsnull;
  gdk_window_get_user_data(tmp_window, &data);
  mMozWindowWidget = NS_STATIC_CAST(GtkWidget *, data);

  // Apply the current chrome mask
  ApplyChromeMask();

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1030 of file EmbedPrivate.cpp.

{
  nsCOMPtr<nsIComponentRegistrar> cr;
  nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(cr));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIComponentManager> cm;
  rv = NS_GetComponentManager (getter_AddRefs (cm));
  NS_ENSURE_SUCCESS (rv, rv);

  for (int i = 0; i < sNumAppComps; ++i) {
    nsCOMPtr<nsIGenericFactory> componentFactory;
    rv = NS_NewGenericFactory(getter_AddRefs(componentFactory),
                              &(sAppComps[i]));
    if (NS_FAILED(rv)) {
      NS_WARNING("Unable to create factory for component");
      continue;  // don't abort registering other components
    }

    rv = cr->RegisterFactory(sAppComps[i].mCID, sAppComps[i].mDescription,
                             sAppComps[i].mContractID, componentFactory);
    NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to register factory for component");

    // Call the registration hook of the component, if any
    if (sAppComps[i].mRegisterSelfProc) {
      rv = sAppComps[i].mRegisterSelfProc(cm, nsnull, nsnull, nsnull,
                                          &(sAppComps[i]));
      NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to self-register component");
    }
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 418 of file EmbedPrivate.cpp.

{
  /* Use the session history if it is available, this
   * allows framesets to reload correctly */
  nsCOMPtr<nsIWebNavigation> wn;

  if (mSessionHistory) {
    wn = do_QueryInterface(mSessionHistory);
  }
  if (!wn)
    wn = mNavigation;

  if (wn)
    wn->Reload(reloadFlags);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 392 of file EmbedPrivate.cpp.

{
       PRUint32 reloadFlags = 0;

       // map the external API to the internal web navigation API.
       switch (flags) 
       {
              case MOZ_EMBED_FLAG_RELOADNORMAL:
                     reloadFlags = 0;
                     break;
              case MOZ_EMBED_FLAG_RELOADBYPASSCACHE:
                     reloadFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE;
                     break;
              case MOZ_EMBED_FLAG_RELOADBYPASSPROXY:
                     reloadFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
                     break;
              case MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE:
                     reloadFlags = (nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY |
                             nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE);
                     break;
              case MOZ_EMBED_FLAG_RELOADCHARSETCHANGE:
                     reloadFlags = nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE;
                     break;
              default:
                     reloadFlags = 0;
                     break;
       }

       if (mNavigation)
              mNavigation->Reload(reloadFlags);
}
void EmbedPrivate::Resize ( PRUint32  aWidth,
PRUint32  aHeight 
)

Definition at line 327 of file EmbedPrivate.cpp.

Here is the caller graph for this function:

int EmbedPrivate::SaveAs ( char *  fname,
char *  dirname 
)

Definition at line 680 of file EmbedPrivate.cpp.

{      
       if (mWindow)
              return (mWindow->SaveAs(fname, dirname));
       return (1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 451 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIWebBrowser> webBrowser;
       mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

       nsCOMPtr<nsIDOMWindow> oDomWindow;
       nsresult rv = webBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));

       if (oDomWindow)
              rv = oDomWindow->ScrollBy(0, amount);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 463 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIWebBrowser> webBrowser;
       mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

       nsCOMPtr<nsIDOMWindow> oDomWindow;
       nsresult rv = webBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));

       if (oDomWindow)
              rv = oDomWindow->ScrollBy(-amount, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 475 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIWebBrowser> webBrowser;
       mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

       nsCOMPtr<nsIDOMWindow> oDomWindow;
       nsresult rv = webBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));

       if (oDomWindow)
              rv = oDomWindow->ScrollBy(amount, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 488 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIWebBrowser> webBrowser;
       mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

       nsCOMPtr<nsIDOMWindow> oDomWindow;
       nsresult rv = webBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));

       if (oDomWindow)
              rv = oDomWindow->ScrollTo(x, y);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 439 of file EmbedPrivate.cpp.

{
       nsCOMPtr<nsIWebBrowser> webBrowser;
       mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

       nsCOMPtr<nsIDOMWindow> oDomWindow;
       nsresult rv = webBrowser->GetContentDOMWindow(getter_AddRefs(oDomWindow));

       if (oDomWindow)
              rv = oDomWindow->ScrollBy(0, -amount);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 572 of file EmbedPrivate.cpp.

{
/*
       nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(mWindow->mWebBrowser));
       if (clipboard)
           clipboard->SelectAll();
*/

       nsCOMPtr<nsIDOMWindow> domWindow;
       mWindow->mWebBrowser->GetContentDOMWindow( getter_AddRefs( domWindow ) );
       if( !domWindow ) {
              NS_WARNING( "no dom window in content finished loading\n" );
              return;
              }

       nsCOMPtr<nsIDOMDocument> domDocument;
       domWindow->GetDocument( getter_AddRefs( domDocument ) );
       if( !domDocument ) {
              NS_WARNING( "no dom document\n" );
              return;
              }

       nsCOMPtr<nsIDOMNodeList> list;
       domDocument->GetElementsByTagName( NS_LITERAL_STRING( "body" ), getter_AddRefs( list ) );
       if( !list ) {
              NS_WARNING( "no list\n" );
              return;
              }

       nsCOMPtr<nsIDOMNode> node;
       list->Item( 0, getter_AddRefs( node ) );
       if( !node ) {
              NS_WARNING( "no node\n" );
              return;
              }

       nsCOMPtr<nsISelection> selection;
       domWindow->GetSelection( getter_AddRefs( selection ) );
       if( !selection ) {
              NS_WARNING( "no selection\n" );
              return;
              }

       selection->SelectAllChildren( node );

}

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::SetAppComponents ( const nsModuleComponentInfo aComps,
int  aNumComponents 
) [static]

Definition at line 558 of file EmbedPrivate.cpp.

{
  sAppComps = aComps;
  sNumAppComps = aNumComponents;
}

Here is the caller graph for this function:

Definition at line 460 of file EmbedPrivate.cpp.

{
   mChromeMask = aChromeMask;

   ApplyChromeMask();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::SetCompPath ( const char *  aPath) [static]

Definition at line 546 of file EmbedPrivate.cpp.

Here is the caller graph for this function:

Definition at line 587 of file EmbedPrivate.cpp.

{
  if (sAppFileLocProvider)
    NS_RELEASE(sAppFileLocProvider);

  if (appFileLocProvider) {
    sAppFileLocProvider = appFileLocProvider;
    NS_ADDREF(sAppFileLocProvider);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::SetProfilePath ( const char *  aDir,
const char *  aName 
) [static]

Definition at line 567 of file EmbedPrivate.cpp.

{
  if (sProfileDir) {
    nsMemory::Free(sProfileDir);
    sProfileDir = nsnull;
  }

  if (sProfileName) {
    nsMemory::Free(sProfileName);
    sProfileName = nsnull;
  }

  if (aDir)
    sProfileDir = (char *)nsMemory::Clone(aDir, strlen(aDir) + 1);

  if (aName)
    sProfileName = (char *)nsMemory::Clone(aName, strlen(aName) + 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 236 of file EmbedPrivate.cpp.

{
       // Get the nsIWebBrowser object for our embedded window.
       nsCOMPtr<nsIWebBrowser> webBrowser;
       mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

       // Configure what the web browser can and cannot do
       PRBool aAllowPlugins = PR_TRUE;
       nsCOMPtr<nsIWebBrowserSetup> webBrowserAsSetup(do_QueryInterface(webBrowser));
       webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, aAllowPlugins);

       // get a handle on the navigation object
       mNavigation = do_QueryInterface(webBrowser);

       // Create our session history object and tell the navigation object
       // to use it.  We need to do this before we create the web browser
       // window.
       mSessionHistory = do_CreateInstance(NS_SHISTORY_CONTRACTID);
       mNavigation->SetSessionHistory(mSessionHistory);

       // create the window
       mWindow->CreateWindow();

       // bind the progress listener to the browser object
       nsCOMPtr<nsISupportsWeakReference> supportsWeak;
       supportsWeak = do_QueryInterface(mProgressGuard);
       nsCOMPtr<nsIWeakReference> weakRef;
       supportsWeak->GetWeakReference(getter_AddRefs(weakRef));
       webBrowser->AddWebBrowserListener(weakRef, nsIWebProgressListener::GetIID());

       // set ourselves as the parent uri content listener
       nsCOMPtr<nsIURIContentListener> uriListener;
       uriListener = do_QueryInterface(mContentListenerGuard);
       webBrowser->SetParentURIContentListener(uriListener);

       nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(webBrowser));
//     if (print)
//            print->GetNewPrintSettings(getter_AddRefs(m_PrintSettings));

       return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::SetURI ( const char *  aURI)

Definition at line 387 of file EmbedPrivate.cpp.

{
#ifdef MOZ_WIDGET_GTK
  // XXX: Even though NS_CopyNativeToUnicode is not designed for non-filenames,
  // we know that it will do "the right thing" on UNIX.
  NS_CopyNativeToUnicode(nsDependentCString(aURI), mURI);
#endif

#ifdef MOZ_WIDGET_GTK2
  CopyUTF8toUTF16(aURI, mURI);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::SetURI ( const char *  aURI)

Definition at line 303 of file EmbedPrivate.cpp.

{
  // Get the nsIWebBrowser object for our embedded window.
  nsCOMPtr<nsIWebBrowser> webBrowser;
  mWindow->GetWebBrowser(getter_AddRefs(webBrowser));

  // and set the visibility on the thing
  nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(webBrowser);
  baseWindow->SetVisibility(PR_TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::ShutdownProfile ( void  ) [static, private]

Definition at line 1015 of file EmbedPrivate.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void EmbedPrivate::Size ( PRUint32  aWidth,
PRUint32  aHeight 
)

Definition at line 309 of file EmbedPrivate.cpp.

{
       mWindow->mBaseWindow->SetSize(aWidth, aHeight, PR_TRUE);
}

Here is the caller graph for this function:

nsresult EmbedPrivate::StartupProfile ( void  ) [static, private]

Definition at line 975 of file EmbedPrivate.cpp.

{
  // initialize profiles
  if (sProfileDir && sProfileName) {
    nsresult rv;
    nsCOMPtr<nsILocalFile> profileDir;
    NS_NewNativeLocalFile(nsDependentCString(sProfileDir), PR_TRUE,
                          getter_AddRefs(profileDir));
    if (!profileDir)
      return NS_ERROR_FAILURE;
    rv = profileDir->AppendNative(nsDependentCString(sProfileName));
    if (NS_FAILED(rv))
      return NS_ERROR_FAILURE;

    nsCOMPtr<nsProfileDirServiceProvider> locProvider;
    NS_NewProfileDirServiceProvider(PR_TRUE, getter_AddRefs(locProvider));
    if (!locProvider)
      return NS_ERROR_FAILURE;
    rv = locProvider->Register();
    if (NS_FAILED(rv))
      return rv;
    rv = locProvider->SetProfileDir(profileDir);
    if (NS_FAILED(rv))
      return rv;
    // Keep a ref so we can shut it down.
    NS_ADDREF(sProfileDirServiceProvider = locProvider);

    // get prefs
    nsCOMPtr<nsIPref> pref;
    pref = do_GetService(NS_PREF_CONTRACTID);
    if (!pref)
      return NS_ERROR_FAILURE;
    sPrefs = pref.get();
    NS_ADDREF(sPrefs);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 385 of file EmbedPrivate.cpp.

Here is the caller graph for this function:

Definition at line 296 of file EmbedPrivate.cpp.

{
  // reparent to our offscreen window
  gtk_widget_reparent(mMozWindowWidget, sOffscreenFixed);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 171 of file EmbedPrivate.h.

Definition at line 178 of file EmbedPrivate.h.

Definition at line 174 of file EmbedPrivate.h.

Definition at line 139 of file EmbedPrivate.h.

Definition at line 140 of file EmbedPrivate.h.

Definition at line 141 of file EmbedPrivate.h.

Definition at line 142 of file EmbedPrivate.h.

Definition at line 148 of file EmbedPrivate.h.

Definition at line 176 of file EmbedPrivate.h.

Definition at line 182 of file EmbedPrivate.h.

Definition at line 187 of file EmbedPrivate.h.

Definition at line 180 of file EmbedPrivate.h.

Definition at line 192 of file EmbedPrivate.h.

Definition at line 144 of file EmbedPrivate.h.

Definition at line 132 of file EmbedPrivate.h.

Definition at line 146 of file EmbedPrivate.h.

Definition at line 159 of file EmbedPrivate.h.

Definition at line 160 of file EmbedPrivate.h.

Definition at line 137 of file EmbedPrivate.h.

Definition at line 138 of file EmbedPrivate.h.

Definition at line 145 of file EmbedPrivate.h.

Definition at line 157 of file EmbedPrivate.h.

Definition at line 158 of file EmbedPrivate.h.

Definition at line 151 of file EmbedPrivate.h.

Definition at line 135 of file EmbedPrivate.h.

Definition at line 136 of file EmbedPrivate.h.

Definition at line 158 of file EmbedPrivate.h.

Definition at line 171 of file EmbedPrivate.h.

Definition at line 161 of file EmbedPrivate.h.

Definition at line 183 of file EmbedPrivate.h.

static char * EmbedPrivate::sCompPath = nsnull [static]

Definition at line 156 of file EmbedPrivate.h.

Definition at line 159 of file EmbedPrivate.h.

GtkWidget * EmbedPrivate::sOffscreenFixed = 0 [static, private]

Definition at line 205 of file EmbedPrivate.h.

GtkWidget * EmbedPrivate::sOffscreenWindow = 0 [static, private]

Definition at line 204 of file EmbedPrivate.h.

static nsIPref * EmbedPrivate::sPrefs = nsnull [static]

Definition at line 169 of file EmbedPrivate.h.

char * EmbedPrivate::sProfileDir = nsnull [static]

Definition at line 165 of file EmbedPrivate.h.

Definition at line 168 of file EmbedPrivate.h.

Definition at line 166 of file EmbedPrivate.h.

static PRUint32 EmbedPrivate::sWidgetCount = 0 [static]

Definition at line 154 of file EmbedPrivate.h.

Definition at line 163 of file EmbedPrivate.h.


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