#include "extensions/common/extension_api.h"
#include <stddef.h>
#include <algorithm>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "extensions/common/extension.h"
#include "extensions/common/extensions_client.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
#include "extensions/common/features/simple_feature.h"
#include "extensions/common/mojom/context_type.mojom.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "url/gurl.h"
namespace extensions {
namespace {
const char* const kChildKinds[] = …;
base::Value::Dict LoadSchemaDictionary(const std::string& name,
std::string_view schema) { … }
const base::Value::Dict* FindListItem(const base::Value::List& list,
const std::string& property_name,
const std::string& property_value) { … }
const base::Value::Dict* GetSchemaChild(const base::Value::Dict& schema_node,
const std::string& child_name) { … }
struct ExtensionAPIStatic { … };
base::LazyInstance<ExtensionAPIStatic>::Leaky g_extension_api_static = …;
ExtensionAPI* g_shared_instance_for_test = …;
}
ExtensionAPI* ExtensionAPI::GetSharedInstance() { … }
ExtensionAPI* ExtensionAPI::CreateWithDefaultConfiguration() { … }
void ExtensionAPI::SplitDependencyName(const std::string& full_name,
std::string* feature_type,
std::string* feature_name) { … }
ExtensionAPI::OverrideSharedInstanceForTest::OverrideSharedInstanceForTest(
ExtensionAPI* testing_api)
: … { … }
ExtensionAPI::OverrideSharedInstanceForTest::~OverrideSharedInstanceForTest() { … }
void ExtensionAPI::LoadSchema(const std::string& name,
std::string_view schema) { … }
ExtensionAPI::ExtensionAPI() = default;
ExtensionAPI::~ExtensionAPI() = default;
void ExtensionAPI::InitDefaultConfiguration() { … }
void ExtensionAPI::RegisterDependencyProvider(const std::string& name,
const FeatureProvider* provider) { … }
bool ExtensionAPI::IsAnyFeatureAvailableToContext(
const Feature& api,
const Extension* extension,
mojom::ContextType context,
const GURL& url,
CheckAliasStatus check_alias,
int context_id,
const ContextData& context_data) { … }
Feature::Availability ExtensionAPI::IsAvailable(
const std::string& full_name,
const Extension* extension,
mojom::ContextType context,
const GURL& url,
CheckAliasStatus check_alias,
int context_id,
const ContextData& context_data) { … }
std::string_view ExtensionAPI::GetSchemaStringPiece(
const std::string& api_name) { … }
const base::Value::Dict* ExtensionAPI::GetSchema(const std::string& full_name) { … }
const Feature* ExtensionAPI::GetFeatureDependency(
const std::string& full_name) { … }
std::string ExtensionAPI::GetAPINameFromFullName(const std::string& full_name,
std::string* child_name) { … }
bool ExtensionAPI::IsKnownAPI(const std::string& name,
ExtensionsClient* client) { … }
Feature::Availability ExtensionAPI::IsAliasAvailable(
const std::string& full_name,
const Feature& feature,
const Extension* extension,
mojom::ContextType context,
const GURL& url,
int context_id,
const ContextData& context_data) { … }
std::string_view ExtensionAPI::GetSchemaStringPieceUnsafe(
const std::string& api_name) { … }
std::string ExtensionAPI::GetAPINameFromFullNameUnsafe(
const std::string& full_name,
std::string* child_name) { … }
}