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

#ifndef CHROME_COMMON_EXTENSIONS_API_PROCESSES_H__
#define CHROME_COMMON_EXTENSIONS_API_PROCESSES_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 processes {

//
// Types
//

// The types of the browser processes.
enum class ProcessType {};


const char* ToString(ProcessType as_enum);
ProcessType ParseProcessType(std::string_view as_string);
std::u16string GetProcessTypeParseError(std::string_view as_string);

struct TaskInfo {};

struct Cache {};

struct Process {};


//
// Functions
//

namespace GetProcessIdForTab {

struct Params {};

namespace Results {

// Process ID of the tab's renderer process.
base::Value::List Create(int process_id);
}  // namespace Results

}  // namespace GetProcessIdForTab

namespace Terminate {

struct Params {};

namespace Results {

// True if terminating the process was successful, and false otherwise.
base::Value::List Create(bool did_terminate);
}  // namespace Results

}  // namespace Terminate

namespace GetProcessInfo {

struct Params {};

namespace Results {

// A dictionary of $(ref:Process) objects for each requested process that is a
// live child process of the current browser process, indexed by process ID.
// Metrics requiring aggregation over time will not be populated in each Process
// object.
struct Processes {};


// A dictionary of $(ref:Process) objects for each requested process that is a
// live child process of the current browser process, indexed by process ID.
// Metrics requiring aggregation over time will not be populated in each Process
// object.
base::Value::List Create(const Processes& processes);
}  // namespace Results

}  // namespace GetProcessInfo

//
// Events
//

namespace OnUpdated {

extern const char kEventName[];  // "processes.onUpdated"

// A dictionary of updated $(ref:Process) objects for each live process in the
// browser, indexed by process ID.  Metrics requiring aggregation over time will
// be populated in each Process object.
struct Processes {};


// A dictionary of updated $(ref:Process) objects for each live process in the
// browser, indexed by process ID.  Metrics requiring aggregation over time will
// be populated in each Process object.
base::Value::List Create(const Processes& processes);
}  // namespace OnUpdated

namespace OnUpdatedWithMemory {

extern const char kEventName[];  // "processes.onUpdatedWithMemory"

// A dictionary of updated $(ref:Process) objects for each live process in the
// browser, indexed by process ID.  Memory usage details will be included in
// each Process object.
struct Processes {};


// A dictionary of updated $(ref:Process) objects for each live process in the
// browser, indexed by process ID.  Memory usage details will be included in
// each Process object.
base::Value::List Create(const Processes& processes);
}  // namespace OnUpdatedWithMemory

namespace OnCreated {

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

// Details of the process that was created. Metrics requiring aggregation over
// time will not be populated in the object.
base::Value::List Create(const Process& process);
}  // namespace OnCreated

namespace OnUnresponsive {

extern const char kEventName[];  // "processes.onUnresponsive"

// Details of the unresponsive process. Metrics requiring aggregation over time
// will not be populated in the object. Only available for renderer processes.
base::Value::List Create(const Process& process);
}  // namespace OnUnresponsive

namespace OnExited {

extern const char kEventName[];  // "processes.onExited"

// The ID of the process that exited.
// The type of exit that occurred for the process - normal, abnormal, killed,
// crashed. Only available for renderer processes.
// The exit code if the process exited abnormally. Only available for renderer
// processes.
base::Value::List Create(int process_id, int exit_type, int exit_code);
}  // namespace OnExited

}  // namespace processes
}  // namespace api
}  // namespace extensions

#endif  // CHROME_COMMON_EXTENSIONS_API_PROCESSES_H__