chromium/out/Default/gen/chrome/common/extensions/api/cookies.h

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

// GENERATED FROM THE API DEFINITION IN
//   chrome/common/extensions/api/cookies.json
// by tools/json_schema_compiler.
// DO NOT EDIT.

#ifndef CHROME_COMMON_EXTENSIONS_API_COOKIES_H__
#define CHROME_COMMON_EXTENSIONS_API_COOKIES_H__

#include <stdint.h>

#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "base/values.h"
#include <string_view>


namespace extensions {
namespace api {
namespace cookies {

//
// Types
//

// A cookie's 'SameSite' state
// (https://tools.ietf.org/html/draft-west-first-party-cookies).
// 'no_restriction' corresponds to a cookie set with 'SameSite=None', 'lax' to
// 'SameSite=Lax', and 'strict' to 'SameSite=Strict'. 'unspecified' corresponds
// to a cookie set without the SameSite attribute.
enum class SameSiteStatus {};


const char* ToString(SameSiteStatus as_enum);
SameSiteStatus ParseSameSiteStatus(std::string_view as_string);
std::u16string GetSameSiteStatusParseError(std::string_view as_string);

// Represents a partitioned cookie's partition key.
struct CookiePartitionKey {};

// Represents information about an HTTP cookie.
struct Cookie {};

// Represents a cookie store in the browser. An incognito mode window, for
// instance, uses a separate cookie store from a non-incognito window.
struct CookieStore {};

// The underlying reason behind the cookie's change. If a cookie was inserted,
// or removed via an explicit call to "chrome.cookies.remove", "cause" will be
// "explicit". If a cookie was automatically removed due to expiry, "cause" will
// be "expired". If a cookie was removed due to being overwritten with an
// already-expired expiration date, "cause" will be set to "expired_overwrite".
// If a cookie was automatically removed due to garbage collection, "cause" will
// be "evicted".  If a cookie was automatically removed due to a "set" call that
// overwrote it, "cause" will be "overwrite". Plan your response accordingly.
enum class OnChangedCause {};


const char* ToString(OnChangedCause as_enum);
OnChangedCause ParseOnChangedCause(std::string_view as_string);
std::u16string GetOnChangedCauseParseError(std::string_view as_string);

// Details to identify the cookie.
struct CookieDetails {};


//
// Functions
//

namespace Get {

struct Params {};

namespace Results {

// Contains details about the cookie. This parameter is null if no such cookie
// was found.
base::Value::List Create(const Cookie& cookie);
}  // namespace Results

}  // namespace Get

namespace GetAll {

struct Params {};

namespace Results {

// All the existing, unexpired cookies that match the given cookie info.
base::Value::List Create(const std::vector<Cookie>& cookies);
}  // namespace Results

}  // namespace GetAll

namespace Set {

struct Params {};

namespace Results {

// Contains details about the cookie that's been set.  If setting failed for any
// reason, this will be "null", and $(ref:runtime.lastError) will be set.
base::Value::List Create(const Cookie& cookie);
}  // namespace Results

}  // namespace Set

namespace Remove {

struct Params {};

namespace Results {

// Contains details about the cookie that's been removed.  If removal failed for
// any reason, this will be "null", and $(ref:runtime.lastError) will be set.
struct Details {};


// Contains details about the cookie that's been removed.  If removal failed for
// any reason, this will be "null", and $(ref:runtime.lastError) will be set.
base::Value::List Create(const Details& details);
}  // namespace Results

}  // namespace Remove

namespace GetAllCookieStores {

namespace Results {

// All the existing cookie stores.
base::Value::List Create(const std::vector<CookieStore>& cookie_stores);
}  // namespace Results

}  // namespace GetAllCookieStores

//
// Events
//

namespace OnChanged {

extern const char kEventName[];  // "cookies.onChanged"

struct ChangeInfo {};


base::Value::List Create(const ChangeInfo& change_info);
}  // namespace OnChanged

}  // namespace cookies
}  // namespace api
}  // namespace extensions

#endif  // CHROME_COMMON_EXTENSIONS_API_COOKIES_H__