#include "third_party/blink/renderer/modules/storage_access/document_storage_access.h"
#include "base/metrics/histogram_functions.h"
#include "net/storage_access_api/status.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom-blink-forward.h"
#include "third_party/blink/renderer/bindings/core/v8/idl_types.h"
#include "third_party/blink/renderer/bindings/core/v8/script_function.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_storage_access_types.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/loader/cookie_jar.h"
#include "third_party/blink/renderer/modules/storage_access/storage_access_handle.h"
namespace blink {
namespace {
enum class RequestStorageResult { … };
void FireRequestStorageAccessHistogram(RequestStorageResult result) { … }
void FireRequestStorageAccessForHistogram(RequestStorageResult result) { … }
}
const char DocumentStorageAccess::kNoAccessRequested[] = …;
const char DocumentStorageAccess::kSupplementName[] = …;
DocumentStorageAccess& DocumentStorageAccess::From(Document& document) { … }
ScriptPromise<IDLBoolean> DocumentStorageAccess::hasStorageAccess(
ScriptState* script_state,
Document& document) { … }
ScriptPromise<IDLUndefined> DocumentStorageAccess::requestStorageAccess(
ScriptState* script_state,
Document& document) { … }
ScriptPromise<StorageAccessHandle> DocumentStorageAccess::requestStorageAccess(
ScriptState* script_state,
Document& document,
const StorageAccessTypes* storage_access_types) { … }
ScriptPromise<IDLBoolean> DocumentStorageAccess::hasUnpartitionedCookieAccess(
ScriptState* script_state,
Document& document) { … }
ScriptPromise<IDLUndefined> DocumentStorageAccess::requestStorageAccessFor(
ScriptState* script_state,
Document& document,
const AtomicString& site) { … }
DocumentStorageAccess::DocumentStorageAccess(Document& document)
: … { … }
void DocumentStorageAccess::Trace(Visitor* visitor) const { … }
ScriptPromise<IDLBoolean> DocumentStorageAccess::hasStorageAccess(
ScriptState* script_state) { … }
ScriptPromise<IDLUndefined> DocumentStorageAccess::requestStorageAccess(
ScriptState* script_state) { … }
ScriptPromise<StorageAccessHandle> DocumentStorageAccess::requestStorageAccess(
ScriptState* script_state,
const StorageAccessTypes* storage_access_types) { … }
ScriptPromise<IDLBoolean> DocumentStorageAccess::hasUnpartitionedCookieAccess(
ScriptState* script_state) { … }
template <typename T>
ScriptPromise<T> DocumentStorageAccess::RequestStorageAccessImpl(
ScriptState* script_state,
bool request_unpartitioned_cookie_access,
base::OnceCallback<void(ScriptPromiseResolver<T>*)> on_resolve) { … }
template <typename T>
void DocumentStorageAccess::ProcessStorageAccessPermissionState(
ScriptPromiseResolver<T>* resolver,
bool request_unpartitioned_cookie_access,
base::OnceCallback<void(ScriptPromiseResolver<T>*)> on_resolve,
mojom::blink::PermissionStatus status) { … }
ScriptPromise<IDLUndefined> DocumentStorageAccess::requestStorageAccessFor(
ScriptState* script_state,
const AtomicString& origin) { … }
void DocumentStorageAccess::ProcessTopLevelStorageAccessPermissionState(
ScriptPromiseResolver<IDLUndefined>* resolver,
mojom::blink::PermissionStatus status) { … }
}