#include "third_party/blink/renderer/modules/cookie_store/cookie_store_manager.h"
#include <optional>
#include <utility>
#include "services/network/public/mojom/restricted_cookie_manager.mojom-blink.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_cookie_list_item.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_cookie_store_get_options.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/cookie_store/cookie_change_event.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
namespace {
mojom::blink::CookieChangeSubscriptionPtr ToBackendSubscription(
const KURL& default_cookie_url,
const CookieStoreGetOptions* subscription,
ExceptionState& exception_state) { … }
CookieStoreGetOptions* ToCookieChangeSubscription(
const mojom::blink::CookieChangeSubscription& backend_subscription) { … }
KURL DefaultCookieURL(ServiceWorkerRegistration* registration) { … }
}
const char CookieStoreManager::kSupplementName[] = …;
CookieStoreManager* CookieStoreManager::cookies(
ServiceWorkerRegistration& registration) { … }
CookieStoreManager::CookieStoreManager(ServiceWorkerRegistration& registration)
: … { … }
ScriptPromise<IDLUndefined> CookieStoreManager::subscribe(
ScriptState* script_state,
const HeapVector<Member<CookieStoreGetOptions>>& subscriptions,
ExceptionState& exception_state) { … }
ScriptPromise<IDLUndefined> CookieStoreManager::unsubscribe(
ScriptState* script_state,
const HeapVector<Member<CookieStoreGetOptions>>& subscriptions,
ExceptionState& exception_state) { … }
ScriptPromise<IDLSequence<CookieStoreGetOptions>>
CookieStoreManager::getSubscriptions(ScriptState* script_state,
ExceptionState& exception_state) { … }
void CookieStoreManager::Trace(Visitor* visitor) const { … }
void CookieStoreManager::OnSubscribeResult(
ScriptPromiseResolver<IDLUndefined>* resolver,
bool backend_success) { … }
void CookieStoreManager::OnGetSubscriptionsResult(
ScriptPromiseResolver<IDLSequence<CookieStoreGetOptions>>* resolver,
Vector<mojom::blink::CookieChangeSubscriptionPtr> backend_result,
bool backend_success) { … }
}