Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
WindowStateHolder Class Reference
Inheritance diagram for WindowStateHolder:
Inheritance graph
[legend]
Collaboration diagram for WindowStateHolder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS WindowStateHolder (nsGlobalWindow *aWindow, nsIXPConnectJSObjectHolder *aHolder, nsNavigator *aNavigator, nsLocation *aLocation, nsIXPConnectJSObjectHolder *aOuterProto)
nsIDOMElementGetFocusedElement ()
nsIDOMWindowInternalGetFocusedWindow ()
nsGlobalWindowGetInnerWindow ()
nsIXPConnectJSObjectHolderGetInnerWindowHolder ()
nsNavigatorGetNavigator ()
nsLocationGetLocation ()
nsIXPConnectJSObjectHolderGetOuterProto ()
void DidRestoreWindow ()

Protected Member Functions

 ~WindowStateHolder ()

Protected Attributes

nsGlobalWindowmInnerWindow
nsCOMPtr
< nsIXPConnectJSObjectHolder
mInnerWindowHolder
nsRefPtr< nsNavigatormNavigator
nsRefPtr< nsLocationmLocation
nsCOMPtr< nsIDOMElementmFocusedElement
nsCOMPtr< nsIDOMWindowInternalmFocusedWindow
nsCOMPtr
< nsIXPConnectJSObjectHolder
mOuterProto

Detailed Description

Definition at line 796 of file nsGlobalWindow.cpp.


Constructor & Destructor Documentation

WindowStateHolder::WindowStateHolder ( nsGlobalWindow aWindow,
nsIXPConnectJSObjectHolder aHolder,
nsNavigator aNavigator,
nsLocation aLocation,
nsIXPConnectJSObjectHolder aOuterProto 
)

Definition at line 844 of file nsGlobalWindow.cpp.

  : mInnerWindow(aWindow),
    mInnerWindowHolder(aHolder),
    mNavigator(aNavigator),
    mLocation(aLocation),
    mOuterProto(aOuterProto)
{
  NS_PRECONDITION(aWindow, "null window");
  NS_PRECONDITION(aWindow->IsInnerWindow(), "Saving an outer window");

  nsIFocusController *fc = aWindow->GetRootFocusController();
  NS_ASSERTION(fc, "null focus controller");

  // We want to save the focused element/window only if they are inside of
  // this window.

  nsCOMPtr<nsIDOMWindowInternal> focusWinInternal;
  fc->GetFocusedWindow(getter_AddRefs(focusWinInternal));

  nsCOMPtr<nsPIDOMWindow> focusedWindow = do_QueryInterface(focusWinInternal);

  // The outer window is used for focus purposes, so make sure that's what
  // we're looking for.
  nsPIDOMWindow *targetWindow = aWindow->GetOuterWindow();

  while (focusedWindow) {
    if (focusedWindow == targetWindow) {
      fc->GetFocusedWindow(getter_AddRefs(mFocusedWindow));
      fc->GetFocusedElement(getter_AddRefs(mFocusedElement));
      break;
    }

    focusedWindow =
      NS_STATIC_CAST(nsGlobalWindow*,
                     NS_STATIC_CAST(nsPIDOMWindow*,
                                    focusedWindow))->GetPrivateParent();
  }

  aWindow->SuspendTimeouts();
}

Here is the call graph for this function:

Definition at line 889 of file nsGlobalWindow.cpp.

{
  if (mInnerWindow) {
    // This window was left in the bfcache and is now going away. We need to
    // free it up.
    nsCOMPtr<nsIThreadJSContextStack> stack(do_GetService(sJSStackContractID));
    JSContext *cx = nsnull;

    if (stack)
      stack->GetSafeJSContext(&cx);

    if (!cx) {
      NS_WARNING("Trusting GC to finish cleaning up this inner window");
      return;
    }

    mInnerWindow->FreeInnerObjects(cx);
  }
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 810 of file nsGlobalWindow.cpp.

{ return mFocusedElement; }

Definition at line 811 of file nsGlobalWindow.cpp.

{ return mFocusedWindow; }

Definition at line 813 of file nsGlobalWindow.cpp.

{ return mInnerWindow; }

Definition at line 814 of file nsGlobalWindow.cpp.

  { return mInnerWindowHolder; }

Definition at line 818 of file nsGlobalWindow.cpp.

{ return mLocation; }

Definition at line 817 of file nsGlobalWindow.cpp.

{ return mNavigator; }

Definition at line 819 of file nsGlobalWindow.cpp.

{ return mOuterProto; }

Member Data Documentation

Definition at line 839 of file nsGlobalWindow.cpp.

Definition at line 840 of file nsGlobalWindow.cpp.

Definition at line 833 of file nsGlobalWindow.cpp.

Definition at line 836 of file nsGlobalWindow.cpp.

Definition at line 838 of file nsGlobalWindow.cpp.

Definition at line 837 of file nsGlobalWindow.cpp.

Definition at line 841 of file nsGlobalWindow.cpp.


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