chromium/third_party/blink/renderer/modules/push_messaging/push_subscription.cc

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

#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 {

// This method and its dependencies must remain constant time, thus not branch
// based on the value of |buffer| while encoding, assuming a known length.
String ToBase64URLWithoutPadding(DOMArrayBuffer* buffer) {}

// Converts a {std::optional<base::Time>} into a
// {std::optional<base::DOMTimeStamp>} object.
// base::Time is in milliseconds from Windows epoch (1601-01-01 00:00:00 UTC)
// while blink::DOMTimeStamp is in milliseconds from UNIX epoch (1970-01-01
// 00:00:00 UTC)
std::optional<blink::DOMTimeStamp> ToDOMTimeStamp(
    const std::optional<base::Time>& time) {}

}  // namespace

// static
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 {}

}  // namespace blink