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

#ifndef CHROME_COMMON_EXTENSIONS_API_DOWNLOADS_H__
#define CHROME_COMMON_EXTENSIONS_API_DOWNLOADS_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 downloads {

//
// Types
//

struct HeaderNameValuePair {};

// <dl><dt>uniquify</dt>     <dd>To avoid duplication, the <code>filename</code>
// is changed to     include a counter before the filename extension.</dd>
// <dt>overwrite</dt>     <dd>The existing file will be overwritten with the new
// file.</dd>     <dt>prompt</dt>     <dd>The user will be prompted with a file
// chooser dialog.</dd> </dl>
enum class FilenameConflictAction {};


const char* ToString(FilenameConflictAction as_enum);
FilenameConflictAction ParseFilenameConflictAction(std::string_view as_string);
std::u16string GetFilenameConflictActionParseError(std::string_view as_string);

struct FilenameSuggestion {};

enum class HttpMethod {};


const char* ToString(HttpMethod as_enum);
HttpMethod ParseHttpMethod(std::string_view as_string);
std::u16string GetHttpMethodParseError(std::string_view as_string);

enum class InterruptReason {};


const char* ToString(InterruptReason as_enum);
InterruptReason ParseInterruptReason(std::string_view as_string);
std::u16string GetInterruptReasonParseError(std::string_view as_string);

struct DownloadOptions {};

// <dl><dt>file</dt>     <dd>The download's filename is suspicious.</dd>
// <dt>url</dt>     <dd>The download's URL is known to be malicious.</dd>
// <dt>content</dt>     <dd>The downloaded file is known to be malicious.</dd>
// <dt>uncommon</dt>     <dd>The download's URL is not commonly downloaded and
// could be     dangerous.</dd>     <dt>host</dt>     <dd>The download came from
// a host known to distribute malicious     binaries and is likely
// dangerous.</dd>     <dt>unwanted</dt>     <dd>The download is potentially
// unwanted or unsafe. E.g. it could make     changes to browser or computer
// settings.</dd>     <dt>safe</dt>     <dd>The download presents no known
// danger to the user's computer.</dd>     <dt>accepted</dt>     <dd>The user
// has accepted the dangerous download.</dd> </dl>
enum class DangerType {};


const char* ToString(DangerType as_enum);
DangerType ParseDangerType(std::string_view as_string);
std::u16string GetDangerTypeParseError(std::string_view as_string);

// <dl><dt>in_progress</dt>     <dd>The download is currently receiving data
// from the server.</dd>     <dt>interrupted</dt>     <dd>An error broke the
// connection with the file host.</dd>     <dt>complete</dt>     <dd>The
// download completed successfully.</dd> </dl>
enum class State {};


const char* ToString(State as_enum);
State ParseState(std::string_view as_string);
std::u16string GetStateParseError(std::string_view as_string);

struct DownloadItem {};

struct DownloadQuery {};

struct StringDelta {};

struct DoubleDelta {};

struct BooleanDelta {};

struct DownloadDelta {};

struct GetFileIconOptions {};

struct UiOptions {};


//
// Functions
//

namespace Download {

struct Params {};

namespace Results {

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

}  // namespace Download

namespace Search {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<DownloadItem>& results);
}  // namespace Results

}  // namespace Search

namespace Pause {

struct Params {};

namespace Results {

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

}  // namespace Pause

namespace Resume {

struct Params {};

namespace Results {

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

}  // namespace Resume

namespace Cancel {

struct Params {};

namespace Results {

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

}  // namespace Cancel

namespace GetFileIcon {

struct Params {};

namespace Results {

base::Value::List Create(const std::string& icon_url);
}  // namespace Results

}  // namespace GetFileIcon

namespace Open {

struct Params {};

namespace Results {

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

}  // namespace Open

namespace Show {

struct Params {};

}  // namespace Show

namespace ShowDefaultFolder {

}  // namespace ShowDefaultFolder

namespace Erase {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<int>& erased_ids);
}  // namespace Results

}  // namespace Erase

namespace RemoveFile {

struct Params {};

namespace Results {

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

}  // namespace RemoveFile

namespace AcceptDanger {

struct Params {};

namespace Results {

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

}  // namespace AcceptDanger

namespace SetShelfEnabled {

struct Params {};

}  // namespace SetShelfEnabled

namespace SetUiOptions {

struct Params {};

namespace Results {

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

}  // namespace SetUiOptions

//
// Events
//

namespace OnCreated {

extern const char kEventName[];  // "downloads.onCreated"

base::Value::List Create(const DownloadItem& download_item);
}  // namespace OnCreated

namespace OnErased {

extern const char kEventName[];  // "downloads.onErased"

// The <code>id</code> of the $(ref:DownloadItem) that was erased.
base::Value::List Create(int download_id);
}  // namespace OnErased

namespace OnChanged {

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

base::Value::List Create(const DownloadDelta& download_delta);
}  // namespace OnChanged

namespace OnDeterminingFilename {

extern const char kEventName[];  // "downloads.onDeterminingFilename"

base::Value::List Create(const DownloadItem& download_item, base::Value::Dict suggest);
}  // namespace OnDeterminingFilename

}  // namespace downloads
}  // namespace api
}  // namespace extensions

#endif  // CHROME_COMMON_EXTENSIONS_API_DOWNLOADS_H__