2018-09-08 01:53:33 +03:00
|
|
|
/* -*- 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 mozilla_PendingFullscreenEvent_h_
|
|
|
|
#define mozilla_PendingFullscreenEvent_h_
|
|
|
|
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
|
|
|
|
class nsIDocument;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2018-09-10 02:33:40 +03:00
|
|
|
enum class FullscreenEventType
|
|
|
|
{
|
|
|
|
Change,
|
|
|
|
Error,
|
|
|
|
};
|
|
|
|
|
2018-09-08 01:53:33 +03:00
|
|
|
/*
|
|
|
|
* Class for dispatching a fullscreen event. It should be queued and
|
|
|
|
* invoked as part of "run the fullscreen steps" algorithm.
|
|
|
|
*/
|
|
|
|
class PendingFullscreenEvent
|
|
|
|
{
|
|
|
|
public:
|
2018-09-10 02:33:40 +03:00
|
|
|
PendingFullscreenEvent(FullscreenEventType aType, nsIDocument* aDoc)
|
2018-09-08 01:53:33 +03:00
|
|
|
: mDocument(aDoc)
|
2018-09-10 02:33:40 +03:00
|
|
|
, mType(aType)
|
2018-09-08 01:53:33 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(aDoc);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIDocument* Document() const { return mDocument; }
|
|
|
|
|
|
|
|
void Dispatch()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
MOZ_ASSERT(!mDispatched);
|
|
|
|
mDispatched = true;
|
|
|
|
#endif
|
2018-09-10 02:33:40 +03:00
|
|
|
nsString name;
|
|
|
|
switch (mType) {
|
|
|
|
case FullscreenEventType::Change:
|
|
|
|
name = NS_LITERAL_STRING("fullscreenchange");
|
|
|
|
break;
|
|
|
|
case FullscreenEventType::Error:
|
|
|
|
name = NS_LITERAL_STRING("fullscreenerror");
|
|
|
|
break;
|
|
|
|
}
|
2018-09-08 01:53:33 +03:00
|
|
|
Unused << nsContentUtils::DispatchTrustedEvent(
|
2018-09-10 02:33:40 +03:00
|
|
|
mDocument, mDocument, name,
|
2018-09-08 01:53:33 +03:00
|
|
|
CanBubble::eYes, Cancelable::eNo, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
2018-09-10 02:33:40 +03:00
|
|
|
FullscreenEventType mType;
|
2018-09-08 01:53:33 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool mDispatched = false;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_PendingFullscreenEvent_h_
|