#include "chrome/browser/ui/webui/extensions/extensions_internals_source.h"
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include "base/containers/flat_map.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/webui_url_constants.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/activity.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/event_listener_map.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/process_manager.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
ManifestLocation;
namespace {
const char* TypeToString(extensions::Manifest::Type type) { … }
const char* LocationToString(ManifestLocation loc) { … }
base::Value::List CreationFlagsToList(int creation_flags) { … }
base::Value::List DisableReasonsToList(int disable_reasons) { … }
constexpr std::string_view kActivitesKey = …;
constexpr std::string_view kBackgroundPageKeepalivesKey = …;
constexpr std::string_view kCountKey = …;
constexpr std::string_view kEventNameKey = …;
constexpr std::string_view kEventsListenersKey = …;
constexpr std::string_view kExtraDataKey = …;
constexpr std::string_view kFilterKey = …;
constexpr std::string_view kInternalsCreationFlagsKey = …;
constexpr std::string_view kInternalsDisableReasonsKey = …;
constexpr std::string_view kInternalsIdKey = …;
constexpr std::string_view kInternalsGuidKey = …;
constexpr std::string_view kInternalsNameKey = …;
constexpr std::string_view kInternalsVersionKey = …;
constexpr std::string_view kIsForServiceWorkerKey = …;
constexpr std::string_view kIsLazyKey = …;
constexpr std::string_view kListenersKey = …;
constexpr std::string_view kListenerUrlKey = …;
constexpr std::string_view kLocationKey = …;
constexpr std::string_view kManifestVersionKey = …;
constexpr std::string_view kPathKey = …;
constexpr std::string_view kPermissionsKey = …;
constexpr std::string_view kPermissionsActiveKey = …;
constexpr std::string_view kPermissionsOptionalKey = …;
constexpr std::string_view kPermissionsTabSpecificKey = …;
constexpr std::string_view kPermissionsWithheldKey = …;
constexpr std::string_view kPermissionsApiKey = …;
constexpr std::string_view kPermissionsManifestKey = …;
constexpr std::string_view kPermissionsExplicitHostsKey = …;
constexpr std::string_view kPermissionsScriptableHostsKey = …;
constexpr std::string_view kServiceWorkerKeepalivesKey = …;
constexpr std::string_view kTimeoutTypeKey = …;
constexpr std::string_view kTypeKey = …;
base::Value::Dict FormatBackgroundPageKeepaliveData(
extensions::ProcessManager* process_manager,
const extensions::Extension* extension) { … }
base::Value::Dict FormatServiceWorkerKeepaliveData(
extensions::ProcessManager& process_manager,
const extensions::ExtensionId& extension_id) { … }
template <typename T>
base::Value::List FormatDetailedPermissionSet(const T& permissions) { … }
base::Value::Dict FormatPermissionSet(
const extensions::PermissionSet& permission_set) { … }
base::Value::Dict FormatPermissionsData(
const extensions::Extension& extension) { … }
void AddEventListenerData(extensions::EventRouter* event_router,
base::Value::List* data) { … }
}
ExtensionsInternalsSource::ExtensionsInternalsSource(Profile* profile)
: … { … }
ExtensionsInternalsSource::~ExtensionsInternalsSource() = default;
std::string ExtensionsInternalsSource::GetSource() { … }
std::string ExtensionsInternalsSource::GetMimeType(const GURL& url) { … }
void ExtensionsInternalsSource::StartDataRequest(
const GURL& url,
const content::WebContents::Getter& wc_getter,
content::URLDataSource::GotDataCallback callback) { … }
std::string ExtensionsInternalsSource::WriteToString() const { … }