chromium/content/browser/web_exposed_isolation_info.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_WEB_EXPOSED_ISOLATION_INFO_H_
#define CONTENT_BROWSER_WEB_EXPOSED_ISOLATION_INFO_H_

#include <optional>

#include "content/common/content_export.h"
#include "url/origin.h"

namespace content {

// Represents the isolation level of a page or group of pages. This is used
// for process allocation and to selectively enable powerful features such
// as SharedArrayBuffer and Direct Sockets.
//
// Currently, three levels of isolation are represented:
//
// 1.  Non-isolated contexts.
//
// 2.  Cross-origin isolation, as defined in
//     https://html.spec.whatwg.org/multipage/document-sequences.html#cross-origin-isolation-mode.
//     This is computed purely by examining Cross-Origin-Opener-Policy and
//     Cross-Origin-Embedder-Policy headers on a given response.
//
// 3.  Isolated Application contexts, whose requirements are still being
//     fleshed out.
//
// TODO(mkwst): Improve the description of the Isolated Application context as
// we work out what it is: https://crbug.com/1206150.
class CONTENT_EXPORT WebExposedIsolationInfo {};

CONTENT_EXPORT std::ostream& operator<<(std::ostream& out,
                                        const WebExposedIsolationInfo& info);

// Disable these operators, AreCompatible() functions should be used instead.
CONTENT_EXPORT bool operator==(const std::optional<WebExposedIsolationInfo>& a,
                               const std::optional<WebExposedIsolationInfo>& b);
CONTENT_EXPORT bool operator==(const WebExposedIsolationInfo& a,
                               const std::optional<WebExposedIsolationInfo>& b);
CONTENT_EXPORT bool operator==(const std::optional<WebExposedIsolationInfo>& a,
                               const WebExposedIsolationInfo& b);
CONTENT_EXPORT bool operator!=(const std::optional<WebExposedIsolationInfo>& a,
                               const std::optional<WebExposedIsolationInfo>& b);
CONTENT_EXPORT bool operator!=(const WebExposedIsolationInfo& a,
                               const std::optional<WebExposedIsolationInfo>& b);
CONTENT_EXPORT bool operator!=(const std::optional<WebExposedIsolationInfo>& a,
                               const WebExposedIsolationInfo& b);

}  // namespace content

#endif  // CONTENT_BROWSER_WEB_EXPOSED_ISOLATION_INFO_H_