#include "third_party/blink/renderer/modules/push_messaging/push_subscription.h"
#include <memory>
#include "base/numerics/safe_conversions.h"
#include "third_party/blink/renderer/bindings/core/v8/callback_promise_adapter.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/modules/push_messaging/push_error.h"
#include "third_party/blink/renderer/modules/push_messaging/push_provider.h"
#include "third_party/blink/renderer/modules/push_messaging/push_subscription_options.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/wtf/text/base64.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
namespace {
String ToBase64URLWithoutPadding(DOMArrayBuffer* buffer) { … }
std::optional<blink::DOMTimeStamp> ToDOMTimeStamp(
const std::optional<base::Time>& time) { … }
}
PushSubscription* PushSubscription::Create(
mojom::blink::PushSubscriptionPtr subscription,
ServiceWorkerRegistration* service_worker_registration) { … }
PushSubscription::PushSubscription(
const KURL& endpoint,
bool user_visible_only,
const WTF::Vector<uint8_t>& application_server_key,
const WTF::Vector<unsigned char>& p256dh,
const WTF::Vector<unsigned char>& auth,
const std::optional<DOMTimeStamp>& expiration_time,
ServiceWorkerRegistration* service_worker_registration)
: … { … }
PushSubscription::~PushSubscription() = default;
std::optional<DOMTimeStamp> PushSubscription::expirationTime() const { … }
DOMArrayBuffer* PushSubscription::getKey(const AtomicString& name) const { … }
ScriptPromise<IDLBoolean> PushSubscription::unsubscribe(
ScriptState* script_state) { … }
ScriptValue PushSubscription::toJSONForBinding(ScriptState* script_state) { … }
void PushSubscription::Trace(Visitor* visitor) const { … }
}