ApplicationManifest.h [plain text]
#pragma once
#if ENABLE(APPLICATION_MANIFEST)
#include "URL.h"
#include <wtf/EnumTraits.h>
#include <wtf/Optional.h>
namespace WebCore {
struct ApplicationManifest {
enum class Display {
Browser,
MinimalUI,
Standalone,
Fullscreen,
};
String name;
String shortName;
String description;
URL scope;
Display display;
URL startURL;
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static std::optional<ApplicationManifest> decode(Decoder&);
};
template<class Encoder>
void ApplicationManifest::encode(Encoder& encoder) const
{
encoder << name << shortName << description << scope << display << startURL;
}
template<class Decoder>
std::optional<ApplicationManifest> ApplicationManifest::decode(Decoder& decoder)
{
ApplicationManifest result;
if (!decoder.decode(result.name))
return std::nullopt;
if (!decoder.decode(result.shortName))
return std::nullopt;
if (!decoder.decode(result.description))
return std::nullopt;
if (!decoder.decode(result.scope))
return std::nullopt;
if (!decoder.decodeEnum(result.display))
return std::nullopt;
if (!decoder.decode(result.startURL))
return std::nullopt;
return result;
}
}
namespace WTF {
template<> struct EnumTraits<WebCore::ApplicationManifest::Display> {
using values = EnumValues<
WebCore::ApplicationManifest::Display,
WebCore::ApplicationManifest::Display::Browser,
WebCore::ApplicationManifest::Display::MinimalUI,
WebCore::ApplicationManifest::Display::Standalone,
WebCore::ApplicationManifest::Display::Fullscreen
>;
};
}
#endif // ENABLE(APPLICATION_MANIFEST)