gecko-dev/docshell/base/LoadInfo.cpp

60 lines
1.3 KiB
C++

/* -*- 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/. */
#include "mozilla/LoadInfo.h"
#include "mozilla/Assertions.h"
#include "nsISupportsImpl.h"
#include "nsISupportsUtils.h"
namespace mozilla {
LoadInfo::LoadInfo(nsIPrincipal* aPrincipal,
InheritType aInheritPrincipal,
SandboxType aSandboxed)
: mPrincipal(aPrincipal)
, mInheritPrincipal(aInheritPrincipal == eInheritPrincipal &&
aSandboxed != eSandboxed)
, mSandboxed(aSandboxed == eSandboxed)
{
MOZ_ASSERT(aPrincipal);
}
LoadInfo::~LoadInfo()
{
}
NS_IMPL_ISUPPORTS(LoadInfo, nsILoadInfo)
NS_IMETHODIMP
LoadInfo::GetLoadingPrincipal(nsIPrincipal** aPrincipal)
{
NS_ADDREF(*aPrincipal = mPrincipal);
return NS_OK;
}
nsIPrincipal*
LoadInfo::LoadingPrincipal()
{
return mPrincipal;
}
NS_IMETHODIMP
LoadInfo::GetForceInheritPrincipal(bool* aInheritPrincipal)
{
*aInheritPrincipal = mInheritPrincipal;
return NS_OK;
}
NS_IMETHODIMP
LoadInfo::GetLoadingSandboxed(bool* aLoadingSandboxed)
{
*aLoadingSandboxed = mSandboxed;
return NS_OK;
}
} // namespace mozilla