summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/public/web/WebSandboxFlags.h
blob: 697ff29b619020d5828c4891132bf9d6db00e3a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.

#ifndef WebSandboxFlags_h
#define WebSandboxFlags_h

#include "../platform/WebCommon.h"

namespace blink {

// See http://www.whatwg.org/specs/web-apps/current-work/#attr-iframe-sandbox
// for a list of the sandbox flags.  This enum should be kept in sync with
// Source/core/dom/SandboxFlags.h.  Enforced in AssertMatchingEnums.cpp
enum class WebSandboxFlags : int {
    None = 0,
    Navigation = 1,
    Plugins = 1 << 1,
    Origin = 1 << 2,
    Forms = 1 << 3,
    Scripts = 1 << 4,
    TopNavigation = 1 << 5,
    Popups = 1 << 6,
    AutomaticFeatures = 1 << 7,
    PointerLock = 1 << 8,
    DocumentDomain = 1 << 9,
    OrientationLock = 1 << 10,
    PropagatesToAuxiliaryBrowsingContexts = 1 << 11,
    Modals = 1 << 12,
    All = -1
};

inline WebSandboxFlags operator& (WebSandboxFlags a, WebSandboxFlags b)
{
    return static_cast<WebSandboxFlags>(static_cast<int>(a) & static_cast<int>(b));
}

inline WebSandboxFlags operator| (WebSandboxFlags a, WebSandboxFlags b)
{
    return static_cast<WebSandboxFlags>(static_cast<int>(a) | static_cast<int>(b));
}

inline WebSandboxFlags& operator|= (WebSandboxFlags& a, WebSandboxFlags b)
{
    return a = a | b;
}

inline WebSandboxFlags operator~(WebSandboxFlags flags)
{
    return static_cast<WebSandboxFlags>(~static_cast<int>(flags));
}

} // namespace blink

#endif // WebSandboxFlags_h