#include "extensions/browser/process_map.h"
#include <string>
#include <tuple>
#include "base/containers/contains.h"
#include "base/containers/map_util.h"
#include "base/types/optional_util.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/process_map_factory.h"
#include "extensions/browser/script_injection_tracker.h"
#include "extensions/buildflags/buildflags.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/mojom/context_type.mojom.h"
#include "pdf/buildflags.h"
#if BUILDFLAG(ENABLE_GUEST_VIEW)
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#endif
#if BUILDFLAG(ENABLE_PDF)
#include "extensions/common/constants.h"
#include "pdf/pdf_features.h"
#endif
namespace extensions {
namespace {
bool ProcessHasWebUIBindings(int process_id) { … }
bool IsWebViewProcessForExtension(int process_id,
const ExtensionId& extension_id) { … }
}
ProcessMap::ProcessMap(content::BrowserContext* browser_context)
: … { … }
ProcessMap::~ProcessMap() = default;
void ProcessMap::Shutdown() { … }
ProcessMap* ProcessMap::Get(content::BrowserContext* browser_context) { … }
bool ProcessMap::Insert(const ExtensionId& extension_id, int process_id) { … }
int ProcessMap::Remove(int process_id) { … }
bool ProcessMap::Contains(const ExtensionId& extension_id_in,
int process_id) const { … }
bool ProcessMap::Contains(int process_id) const { … }
const Extension* ProcessMap::GetEnabledExtensionByProcessID(
int process_id) const { … }
std::optional<ExtensionId> ProcessMap::GetExtensionIdForProcess(
int process_id) const { … }
bool ProcessMap::IsPrivilegedExtensionProcess(const Extension& extension,
int process_id) { … }
bool ProcessMap::CanProcessHostContextType(
const Extension* extension,
const content::RenderProcessHost& process,
mojom::ContextType context_type) { … }
mojom::ContextType ProcessMap::GetMostLikelyContextType(
const Extension* extension,
int process_id,
const GURL* url) const { … }
}