no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docshell / base / LoadContext.h
blob5cb71ff34731b16384bfaa761a25907ec222313c
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 LoadContext_h
8 #define LoadContext_h
10 #include "SerializedLoadContext.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/BasePrincipal.h"
13 #include "nsIWeakReferenceUtils.h"
14 #include "nsIInterfaceRequestor.h"
15 #include "nsILoadContext.h"
17 namespace mozilla::dom {
18 class Element;
21 namespace mozilla {
23 /**
24 * Class that provides nsILoadContext info in Parent process. Typically copied
25 * from Child via SerializedLoadContext.
27 * Note: this is not the "normal" or "original" nsILoadContext. That is
28 * typically provided by BrowsingContext. This is only used when the original
29 * docshell is in a different process and we need to copy certain values from
30 * it.
33 class LoadContext final : public nsILoadContext, public nsIInterfaceRequestor {
34 public:
35 NS_DECL_ISUPPORTS
36 NS_DECL_NSILOADCONTEXT
37 NS_DECL_NSIINTERFACEREQUESTOR
39 LoadContext(const IPC::SerializedLoadContext& aToCopy,
40 dom::Element* aTopFrameElement, OriginAttributes& aAttrs);
42 // Constructor taking reserved origin attributes.
43 explicit LoadContext(OriginAttributes& aAttrs);
45 // Constructor for creating a LoadContext with a given browser flag.
46 explicit LoadContext(nsIPrincipal* aPrincipal,
47 nsILoadContext* aOptionalBase = nullptr);
49 private:
50 ~LoadContext();
52 nsWeakPtr mTopFrameElement;
53 bool mIsContent;
54 bool mUseRemoteTabs;
55 bool mUseRemoteSubframes;
56 bool mUseTrackingProtection;
57 #ifdef DEBUG
58 bool mIsNotNull;
59 #endif
60 OriginAttributes mOriginAttributes;
63 already_AddRefed<nsILoadContext> CreateLoadContext();
64 already_AddRefed<nsILoadContext> CreatePrivateLoadContext();
66 } // namespace mozilla
68 #endif // LoadContext_h