xpfe/appshell/src/nsXULWindow.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef nsXULWindow_h__
     8 #define nsXULWindow_h__
    10 // Local Includes
    11 #include "nsChromeTreeOwner.h"
    12 #include "nsContentTreeOwner.h"
    14 // Helper classes
    15 #include "nsCOMPtr.h"
    16 #include "nsTArray.h"
    17 #include "nsString.h"
    18 #include "nsWeakReference.h"
    19 #include "nsCOMArray.h"
    20 #include "nsRect.h"
    22 // Interfaces needed
    23 #include "nsIBaseWindow.h"
    24 #include "nsIDocShell.h"
    25 #include "nsIDocShellTreeItem.h"
    26 #include "nsIDOMWindow.h"
    27 #include "nsIInterfaceRequestor.h"
    28 #include "nsIInterfaceRequestorUtils.h"
    29 #include "nsIXULWindow.h"
    30 #include "nsIPrompt.h"
    31 #include "nsIAuthPrompt.h"
    32 #include "nsIXULBrowserWindow.h"
    33 #include "nsIWeakReference.h"
    34 #include "nsIWidgetListener.h"
    36 namespace mozilla {
    37 namespace dom {
    38 class Element;
    39 }
    40 }
    42 // nsXULWindow
    44 #define NS_XULWINDOW_IMPL_CID                         \
    45 { /* 8eaec2f3-ed02-4be2-8e0f-342798477298 */          \
    46      0x8eaec2f3,                                      \
    47      0xed02,                                          \
    48      0x4be2,                                          \
    49    { 0x8e, 0x0f, 0x34, 0x27, 0x98, 0x47, 0x72, 0x98 } \
    50 }
    52 class nsContentShellInfo;
    54 class nsXULWindow : public nsIBaseWindow,
    55                     public nsIInterfaceRequestor,
    56                     public nsIXULWindow,
    57                     public nsSupportsWeakReference
    58 {
    59 friend class nsChromeTreeOwner;
    60 friend class nsContentTreeOwner;
    62 public:
    63    NS_DECL_THREADSAFE_ISUPPORTS
    65    NS_DECL_NSIINTERFACEREQUESTOR
    66    NS_DECL_NSIXULWINDOW
    67    NS_DECL_NSIBASEWINDOW
    69    NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULWINDOW_IMPL_CID)
    71    void LockUntilChromeLoad() { mLockedUntilChromeLoad = true; }
    72    bool IsLocked() const { return mLockedUntilChromeLoad; }
    73    void IgnoreXULSizeMode(bool aEnable) { mIgnoreXULSizeMode = aEnable; }
    75 protected:
    76    enum persistentAttributes {
    77      PAD_MISC =         0x1,
    78      PAD_POSITION =     0x2,
    79      PAD_SIZE =         0x4
    80    };
    82    nsXULWindow(uint32_t aChromeFlags);
    83    virtual ~nsXULWindow();
    85    NS_IMETHOD EnsureChromeTreeOwner();
    86    NS_IMETHOD EnsureContentTreeOwner();
    87    NS_IMETHOD EnsurePrimaryContentTreeOwner();
    88    NS_IMETHOD EnsurePrompter();
    89    NS_IMETHOD EnsureAuthPrompter();
    91    void OnChromeLoaded();
    92    void StaggerPosition(int32_t &aRequestedX, int32_t &aRequestedY,
    93                         int32_t aSpecWidth, int32_t aSpecHeight);
    94    bool       LoadPositionFromXUL();
    95    bool       LoadSizeFromXUL();
    96    bool       LoadMiscPersistentAttributesFromXUL();
    97    void       SyncAttributesToWidget();
    98    NS_IMETHOD SavePersistentAttributes();
   100    NS_IMETHOD GetWindowDOMWindow(nsIDOMWindow** aDOMWindow);
   101    mozilla::dom::Element* GetWindowDOMElement() const;
   103    // See nsIDocShellTreeOwner for docs on next two methods
   104    NS_HIDDEN_(nsresult) ContentShellAdded(nsIDocShellTreeItem* aContentShell,
   105                                           bool aPrimary, bool aTargetable,
   106                                           const nsAString& aID);
   107    NS_HIDDEN_(nsresult) ContentShellRemoved(nsIDocShellTreeItem* aContentShell);
   108    NS_IMETHOD SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX, 
   109       int32_t aCY);
   110    NS_IMETHOD ExitModalLoop(nsresult aStatus);
   111    NS_IMETHOD CreateNewChromeWindow(int32_t aChromeFlags, nsIXULWindow **_retval);
   112    NS_IMETHOD CreateNewContentWindow(int32_t aChromeFlags, nsIXULWindow **_retval);
   114    void       EnableParent(bool aEnable);
   115    bool       ConstrainToZLevel(bool aImmediate, nsWindowZ *aPlacement,
   116                                 nsIWidget *aReqBelow, nsIWidget **aActualBelow);
   117    void       PlaceWindowLayersBehind(uint32_t aLowLevel, uint32_t aHighLevel,
   118                                       nsIXULWindow *aBehind);
   119    void       SetContentScrollbarVisibility(bool aVisible);
   120    bool       GetContentScrollbarVisibility();
   121    void       PersistentAttributesDirty(uint32_t aDirtyFlags);
   123    nsChromeTreeOwner*      mChromeTreeOwner;
   124    nsContentTreeOwner*     mContentTreeOwner;
   125    nsContentTreeOwner*     mPrimaryContentTreeOwner;
   126    nsCOMPtr<nsIWidget>     mWindow;
   127    nsCOMPtr<nsIDocShell>   mDocShell;
   128    nsCOMPtr<nsIDOMWindow>  mDOMWindow;
   129    nsCOMPtr<nsIWeakReference> mParentWindow;
   130    nsCOMPtr<nsIPrompt>     mPrompter;
   131    nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
   132    nsCOMPtr<nsIXULBrowserWindow> mXULBrowserWindow;
   133    nsCOMPtr<nsIDocShellTreeItem> mPrimaryContentShell;
   134    nsTArray<nsContentShellInfo*> mContentShells; // array of doc shells by id
   135    nsresult                mModalStatus;
   136    bool                    mContinueModalLoop;
   137    bool                    mDebuting;       // being made visible right now
   138    bool                    mChromeLoaded; // True when chrome has loaded
   139    bool                    mShowAfterLoad;
   140    bool                    mIntrinsicallySized; 
   141    bool                    mCenterAfterLoad;
   142    bool                    mIsHiddenWindow;
   143    bool                    mLockedUntilChromeLoad;
   144    bool                    mIgnoreXULSize;
   145    bool                    mIgnoreXULPosition;
   146    bool                    mChromeFlagsFrozen;
   147    bool                    mIgnoreXULSizeMode;
   148    // mDestroying is used to prevent reentry into into Destroy(), which can
   149    // otherwise happen due to script running as we tear down various things.
   150    bool                    mDestroying;
   151    uint32_t                mContextFlags;
   152    uint32_t                mPersistentAttributesDirty; // persistentAttributes
   153    uint32_t                mPersistentAttributesMask;
   154    uint32_t                mChromeFlags;
   155    nsString                mTitle;
   156    nsIntRect               mOpenerScreenRect; // the screen rect of the opener
   158    nsCOMArray<nsIWeakReference> mTargetableShells; // targetable shells only
   159 };
   161 NS_DEFINE_STATIC_IID_ACCESSOR(nsXULWindow, NS_XULWINDOW_IMPL_CID)
   163 // nsContentShellInfo
   164 // Used to map shell IDs to nsIDocShellTreeItems.
   166 class nsContentShellInfo
   167 {
   168 public:
   169    nsContentShellInfo(const nsAString& aID,
   170                       nsIWeakReference* aContentShell);
   171    ~nsContentShellInfo();
   173 public:
   174    nsAutoString id; // The identifier of the content shell
   175    nsWeakPtr child; // content shell (weak reference to nsIDocShellTreeItem)
   176 };
   178 #endif /* nsXULWindow_h__ */

mercurial