Bug 1524683 - Add nsFrameLoaderOwner class; r=nika

Depends on D19727

Differential Revision: https://phabricator.services.mozilla.com/D19728

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kyle Machulis 2019-02-15 22:20:51 +00:00
Родитель 9fb68b2ccf
Коммит 623c5a81b8
3 изменённых файлов: 63 добавлений и 0 удалений

Просмотреть файл

@ -67,6 +67,7 @@ EXPORTS += [
'nsDOMTokenList.h',
'nsFocusManager.h',
'nsFrameLoader.h', # Because binding headers include it.
'nsFrameLoaderOwner.h',
'nsFrameMessageManager.h',
'nsGlobalWindow.h', # Because binding headers include it.
'nsGlobalWindowInner.h', # Because binding headers include it.
@ -331,6 +332,7 @@ UNIFIED_SOURCES += [
'nsDOMWindowList.cpp',
'nsFocusManager.cpp',
'nsFrameLoader.cpp',
'nsFrameLoaderOwner.cpp',
'nsGlobalWindowCommands.cpp',
'nsHistory.cpp',
'nsHTMLContentSerializer.cpp',

Просмотреть файл

@ -0,0 +1,18 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 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 "nsFrameLoaderOwner.h"
#include "nsFrameLoader.h"
already_AddRefed<nsFrameLoader> nsFrameLoaderOwner::GetFrameLoader()
{
return do_AddRef(mFrameLoader);
}
void nsFrameLoaderOwner::SetFrameLoader(nsFrameLoader* aNewFrameLoader)
{
mFrameLoader = aNewFrameLoader;
}

Просмотреть файл

@ -0,0 +1,43 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 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 nsFrameLoaderOwner_h_
#define nsFrameLoaderOwner_h_
class nsFrameLoader;
// IID for the FrameLoaderOwner interface
#define NS_FRAMELOADEROWNER_IID \
{ \
0x1b4fd25c, 0x2e57, 0x11e9, { \
0x9e, 0x5a, 0x5b, 0x86, 0xe9, 0x89, 0xa5, 0xc0 \
} \
}
// Mixin that handles ownership of nsFrameLoader for Frame elements
// (XULFrameElement, HTMLI/FrameElement, etc...). Manages information when doing
// FrameLoader swaps.
//
// This class is considered an XPCOM mixin. This means that while we inherit
// from ISupports in order to be QI'able, we expect the classes that inherit
// nsFrameLoaderOwner to actually implement ISupports for us.
class nsFrameLoaderOwner : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FRAMELOADEROWNER_IID)
nsFrameLoaderOwner() = default;
already_AddRefed<nsFrameLoader> GetFrameLoader();
void SetFrameLoader(nsFrameLoader* aNewFrameLoader);
protected:
virtual ~nsFrameLoaderOwner() = default;
RefPtr<nsFrameLoader> mFrameLoader;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsFrameLoaderOwner, NS_FRAMELOADEROWNER_IID)
#endif //nsFrameLoaderOwner_h_