/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=8 et tw=80 : */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_dom_TabContext_h #define mozilla_dom_TabContext_h #include "mozilla/Assertions.h" #include "mozilla/dom/PContent.h" #include "mozilla/dom/PBrowser.h" #include "nsIScriptSecurityManager.h" #include "mozIApplication.h" namespace mozilla { namespace dom { /** * TabContext encapsulates information about an iframe that may be a mozbrowser * or mozapp. You can ask whether a TabContext correspodns to a mozbrowser or * mozapp, get the app that contains the browser, and so on. * * TabParent and TabChild both inherit from TabContext, and you can also have * standalone TabContext objects. * * This class is immutable except by calling one of the protected * SetTabContext*() methods (and those methods can only be called once). See * also MutableTabContext. */ class TabContext { public: /** * This constructor sets is-browser to false, and sets all relevant apps to * NO_APP_ID. If you inherit from TabContext, you can mutate this object * exactly once by calling one of the protected SetTabContext*() methods. */ TabContext(); /** * This constructor copies the information in aContext. The TabContext is * immutable after calling this method; you won't be able call any of the * protected SetTabContext*() methods on an object constructed using this * constructor. * * If aContext is a PopupIPCTabContext with isBrowserElement false and whose * openerParent is a browser element, this constructor will crash (even in * release builds). So please check that case before calling this method. */ TabContext(const IPCTabContext& aContext); /** * Generates IPCTabContext of type BrowserFrameIPCTabContext or * AppFrameIPCTabContext from this TabContext's information. */ IPCTabContext AsIPCTabContext() const; /** * Does this TabContext correspond to a mozbrowser? (