chromium/components/sharing_message/web_push/web_push_common.h

// 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.

#ifndef COMPONENTS_SHARING_MESSAGE_WEB_PUSH_WEB_PUSH_COMMON_H_
#define COMPONENTS_SHARING_MESSAGE_WEB_PUSH_WEB_PUSH_COMMON_H_

#include <optional>
#include <string>

#include "base/functional/callback.h"

// Message to be delivered to the other party via Web Push.
struct WebPushMessage {};

// Result of sending web push message.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class SendWebPushMessageResult {};

WebPushCallback;

// Invoke |callback| with |result| and logs the |result| to UMA. This should be
// called when after a web push message is sent. If |result| is
// SendWebPushMessageResult::Successful, |message_id| must be present.
void InvokeWebPushCallback(
    WebPushCallback callback,
    SendWebPushMessageResult result,
    std::optional<std::string> message_id = std::nullopt);

#endif  // COMPONENTS_SHARING_MESSAGE_WEB_PUSH_WEB_PUSH_COMMON_H_