docshell/base/LoadContext.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.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set sw=2 ts=8 et tw=80 : */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef LoadContext_h
michael@0 8 #define LoadContext_h
michael@0 9
michael@0 10 #include "SerializedLoadContext.h"
michael@0 11 #include "mozilla/Attributes.h"
michael@0 12 #include "nsIWeakReferenceUtils.h"
michael@0 13 #include "mozilla/dom/Element.h"
michael@0 14 #include "nsIInterfaceRequestor.h"
michael@0 15 #include "nsILoadContext.h"
michael@0 16
michael@0 17 class mozIApplication;
michael@0 18
michael@0 19 namespace mozilla {
michael@0 20
michael@0 21 /**
michael@0 22 * Class that provides nsILoadContext info in Parent process. Typically copied
michael@0 23 * from Child via SerializedLoadContext.
michael@0 24 *
michael@0 25 * Note: this is not the "normal" or "original" nsILoadContext. That is
michael@0 26 * typically provided by nsDocShell. This is only used when the original
michael@0 27 * docshell is in a different process and we need to copy certain values from
michael@0 28 * it.
michael@0 29 *
michael@0 30 * Note: we also generate a new nsILoadContext using LoadContext(uint32_t aAppId)
michael@0 31 * to separate the safebrowsing cookie.
michael@0 32 */
michael@0 33
michael@0 34 class LoadContext MOZ_FINAL : public nsILoadContext,
michael@0 35 public nsIInterfaceRequestor
michael@0 36 {
michael@0 37 public:
michael@0 38 NS_DECL_ISUPPORTS
michael@0 39 NS_DECL_NSILOADCONTEXT
michael@0 40 NS_DECL_NSIINTERFACEREQUESTOR
michael@0 41
michael@0 42 // AppId/inBrowser arguments override those in SerializedLoadContext provided
michael@0 43 // by child process.
michael@0 44 LoadContext(const IPC::SerializedLoadContext& aToCopy,
michael@0 45 dom::Element* aTopFrameElement,
michael@0 46 uint32_t aAppId, bool aInBrowser)
michael@0 47 : mTopFrameElement(do_GetWeakReference(aTopFrameElement))
michael@0 48 , mAppId(aAppId)
michael@0 49 , mIsContent(aToCopy.mIsContent)
michael@0 50 , mUsePrivateBrowsing(aToCopy.mUsePrivateBrowsing)
michael@0 51 , mUseRemoteTabs(aToCopy.mUseRemoteTabs)
michael@0 52 , mIsInBrowserElement(aInBrowser)
michael@0 53 #ifdef DEBUG
michael@0 54 , mIsNotNull(aToCopy.mIsNotNull)
michael@0 55 #endif
michael@0 56 {}
michael@0 57
michael@0 58 LoadContext(dom::Element* aTopFrameElement,
michael@0 59 uint32_t aAppId,
michael@0 60 bool aIsContent,
michael@0 61 bool aUsePrivateBrowsing,
michael@0 62 bool aUseRemoteTabs,
michael@0 63 bool aIsInBrowserElement)
michael@0 64 : mTopFrameElement(do_GetWeakReference(aTopFrameElement))
michael@0 65 , mAppId(aAppId)
michael@0 66 , mIsContent(aIsContent)
michael@0 67 , mUsePrivateBrowsing(aUsePrivateBrowsing)
michael@0 68 , mUseRemoteTabs(aUseRemoteTabs)
michael@0 69 , mIsInBrowserElement(aIsInBrowserElement)
michael@0 70 #ifdef DEBUG
michael@0 71 , mIsNotNull(true)
michael@0 72 #endif
michael@0 73 {}
michael@0 74
michael@0 75 // Constructor taking reserved appId for the safebrowsing cookie.
michael@0 76 LoadContext(uint32_t aAppId)
michael@0 77 : mTopFrameElement(nullptr)
michael@0 78 , mAppId(aAppId)
michael@0 79 , mIsContent(false)
michael@0 80 , mUsePrivateBrowsing(false)
michael@0 81 , mUseRemoteTabs(false)
michael@0 82 , mIsInBrowserElement(false)
michael@0 83 #ifdef DEBUG
michael@0 84 , mIsNotNull(true)
michael@0 85 #endif
michael@0 86 {}
michael@0 87
michael@0 88 private:
michael@0 89 nsWeakPtr mTopFrameElement;
michael@0 90 uint32_t mAppId;
michael@0 91 bool mIsContent;
michael@0 92 bool mUsePrivateBrowsing;
michael@0 93 bool mUseRemoteTabs;
michael@0 94 bool mIsInBrowserElement;
michael@0 95 #ifdef DEBUG
michael@0 96 bool mIsNotNull;
michael@0 97 #endif
michael@0 98 };
michael@0 99
michael@0 100 } // namespace mozilla
michael@0 101
michael@0 102 #endif // LoadContext_h
michael@0 103

mercurial