chromium/components/sharing_message/web_push/web_push_sender.cc

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

#include "components/sharing_message/web_push/web_push_sender.h"

#include <limits.h>

#include "base/base64url.h"
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "components/gcm_driver/crypto/p256_key_util.h"
#include "components/sharing_message/web_push/json_web_token_util.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/header_util.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "url/gurl.h"

namespace {

// VAPID header constants.
const char kClaimsKeyAudience[] =;
const char kFCMServerAudience[] =;

const char kClaimsKeyExpirationTime[] =;
// It's 12 hours rather than 24 hours to avoid any issues with clock differences
// between the sending application and the push service.
constexpr base::TimeDelta kClaimsValidPeriod =;

const char kAuthorizationRequestHeaderFormat[] =;

// Endpoint constants.
const char kFCMServerUrlFormat[] =;

// HTTP header constants.
const char kTTL[] =;
const char kUrgency[] =;

const char kContentEncodingProperty[] =;
const char kContentCodingAes128Gcm[] =;

// Other constants.
const char kContentEncodingOctetStream[] =;

std::optional<std::string> GetAuthHeader(crypto::ECPrivateKey* vapid_key) {}

std::string GetUrgencyHeader(WebPushMessage::Urgency urgency) {}

std::unique_ptr<network::SimpleURLLoader> BuildURLLoader(
    const std::string& fcm_token,
    int time_to_live,
    const std::string& urgency_header,
    const std::string& auth_header,
    const std::string& message) {}

}  // namespace

WebPushSender::WebPushSender(
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
    :{}

WebPushSender::~WebPushSender() = default;

void WebPushSender::SendMessage(const std::string& fcm_token,
                                crypto::ECPrivateKey* vapid_key,
                                WebPushMessage message,
                                WebPushCallback callback) {}

void WebPushSender::OnMessageSent(
    std::unique_ptr<network::SimpleURLLoader> url_loader,
    WebPushCallback callback,
    std::unique_ptr<std::string> response_body) {}