electron/atom/browser/api/process_metric.h
Milan Burda d9215dd4ce feat: add creationTime / sandboxed / integrityLevel to app.getAppMetrics() (#18718)
This is useful for checking which processes are sandboxed on OS level.

Regarding creationTime, since the pid can be reused after a process dies, it is useful to use both the pid and the creationTime to uniquely identify a process.
2019-06-14 12:39:55 -07:00

46 lines
1 KiB
C++

// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_PROCESS_METRIC_H_
#define ATOM_BROWSER_API_PROCESS_METRIC_H_
#include <memory>
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"
namespace atom {
#if defined(OS_WIN)
enum class ProcessIntegrityLevel {
Unknown,
Untrusted,
Low,
Medium,
High,
};
#endif
struct ProcessMetric {
int type;
base::Process process;
std::unique_ptr<base::ProcessMetrics> metrics;
ProcessMetric(int type,
base::ProcessHandle handle,
std::unique_ptr<base::ProcessMetrics> metrics);
~ProcessMetric();
#if defined(OS_WIN)
ProcessIntegrityLevel GetIntegrityLevel() const;
static bool IsSandboxed(ProcessIntegrityLevel integrity_level);
#elif defined(OS_MACOSX)
bool IsSandboxed() const;
#endif
};
} // namespace atom
#endif // ATOM_BROWSER_API_PROCESS_METRIC_H_