chromium/out/Default/gen/extensions/common/api/web_request.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
//   extensions/common/api/web_request.json
// by tools/json_schema_compiler.
// DO NOT EDIT.

#ifndef EXTENSIONS_COMMON_API_WEB_REQUEST_H__
#define EXTENSIONS_COMMON_API_WEB_REQUEST_H__

#include <stdint.h>

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

#include "base/values.h"
#include <string_view>
#include "extensions/common/api/extension_types.h"


namespace extensions {
namespace api {
namespace web_request {

//
// Properties
//

// The maximum number of times that <code>handlerBehaviorChanged</code> can be
// called per 10 minute sustained interval. <code>handlerBehaviorChanged</code>
// is an expensive function call that shouldn't be called often.
extern const int MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES;

//
// Types
//

enum class ResourceType {};


const char* ToString(ResourceType as_enum);
ResourceType ParseResourceType(std::string_view as_string);
std::u16string GetResourceTypeParseError(std::string_view as_string);

enum class OnBeforeRequestOptions {};


const char* ToString(OnBeforeRequestOptions as_enum);
OnBeforeRequestOptions ParseOnBeforeRequestOptions(std::string_view as_string);
std::u16string GetOnBeforeRequestOptionsParseError(std::string_view as_string);

enum class OnBeforeSendHeadersOptions {};


const char* ToString(OnBeforeSendHeadersOptions as_enum);
OnBeforeSendHeadersOptions ParseOnBeforeSendHeadersOptions(std::string_view as_string);
std::u16string GetOnBeforeSendHeadersOptionsParseError(std::string_view as_string);

enum class OnSendHeadersOptions {};


const char* ToString(OnSendHeadersOptions as_enum);
OnSendHeadersOptions ParseOnSendHeadersOptions(std::string_view as_string);
std::u16string GetOnSendHeadersOptionsParseError(std::string_view as_string);

enum class OnHeadersReceivedOptions {};


const char* ToString(OnHeadersReceivedOptions as_enum);
OnHeadersReceivedOptions ParseOnHeadersReceivedOptions(std::string_view as_string);
std::u16string GetOnHeadersReceivedOptionsParseError(std::string_view as_string);

enum class OnAuthRequiredOptions {};


const char* ToString(OnAuthRequiredOptions as_enum);
OnAuthRequiredOptions ParseOnAuthRequiredOptions(std::string_view as_string);
std::u16string GetOnAuthRequiredOptionsParseError(std::string_view as_string);

enum class OnResponseStartedOptions {};


const char* ToString(OnResponseStartedOptions as_enum);
OnResponseStartedOptions ParseOnResponseStartedOptions(std::string_view as_string);
std::u16string GetOnResponseStartedOptionsParseError(std::string_view as_string);

enum class OnBeforeRedirectOptions {};


const char* ToString(OnBeforeRedirectOptions as_enum);
OnBeforeRedirectOptions ParseOnBeforeRedirectOptions(std::string_view as_string);
std::u16string GetOnBeforeRedirectOptionsParseError(std::string_view as_string);

enum class OnCompletedOptions {};


const char* ToString(OnCompletedOptions as_enum);
OnCompletedOptions ParseOnCompletedOptions(std::string_view as_string);
std::u16string GetOnCompletedOptionsParseError(std::string_view as_string);

enum class OnErrorOccurredOptions {};


const char* ToString(OnErrorOccurredOptions as_enum);
OnErrorOccurredOptions ParseOnErrorOccurredOptions(std::string_view as_string);
std::u16string GetOnErrorOccurredOptionsParseError(std::string_view as_string);

// An object describing filters to apply to webRequest events.
struct RequestFilter {};

// Contains data uploaded in a URL request.
struct UploadData {};

// Contains data passed within form data. For urlencoded form it is stored as
// string if data is utf-8 string and as ArrayBuffer otherwise. For form-data it
// is ArrayBuffer. If form-data represents uploading file, it is string with
// filename, if the filename is provided.
struct FormDataItem {};

enum class IgnoredActionType {};


const char* ToString(IgnoredActionType as_enum);
IgnoredActionType ParseIgnoredActionType(std::string_view as_string);
std::u16string GetIgnoredActionTypeParseError(std::string_view as_string);


//
// Functions
//

namespace HandlerBehaviorChanged {

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace HandlerBehaviorChanged

//
// Events
//

namespace OnBeforeRequest {

extern const char kEventName[];  // "webRequest.onBeforeRequest"

struct Details {};


base::Value::List Create(const Details& details);
}  // namespace OnBeforeRequest

namespace OnErrorOccurred {

extern const char kEventName[];  // "webRequest.onErrorOccurred"

struct Details {};


base::Value::List Create(const Details& details);
}  // namespace OnErrorOccurred

namespace OnActionIgnored {

extern const char kEventName[];  // "webRequest.onActionIgnored"

struct Details {};


base::Value::List Create(const Details& details);
}  // namespace OnActionIgnored

}  // namespace web_request
}  // namespace api
}  // namespace extensions

#endif  // EXTENSIONS_COMMON_API_WEB_REQUEST_H__