#include "extensions/common/extension.h"
#include <stddef.h>
#include <algorithm>
#include <iterator>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include "base/base64.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/i18n/rtl.h"
#include "base/json/json_writer.h"
#include "base/memory/singleton.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/elapsed_timer.h"
#include "base/version.h"
#include "components/crx_file/id_util.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handler.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/common/switches.h"
#include "extensions/common/url_pattern.h"
#include "net/base/filename_util.h"
#include "url/url_util.h"
ManifestLocation;
namespace extensions {
keys;
values;
errors;
namespace {
constexpr int kMinimumSupportedManifestVersion = …;
constexpr int kMaximumSupportedManifestVersion = …;
constexpr int kPEMOutputColumns = …;
static_assert …;
bool g_silence_deprecated_manifest_version_warnings = …;
constexpr char kKeyBeginHeaderMarker[] = …;
constexpr char kKeyBeginFooterMarker[] = …;
constexpr char kKeyInfoEndMarker[] = …;
constexpr char kPublic[] = …;
constexpr char kPrivate[] = …;
constexpr int kMaxInputSizeBytes = …;
bool ContainsReservedCharacters(const base::FilePath& path) { … }
bool IsManifestSupported(int manifest_version,
Manifest::Type type,
ManifestLocation location,
int creation_flags,
std::string* warning) { … }
bool ComputeExtensionID(const base::Value::Dict& manifest,
const base::FilePath& path,
int creation_flags,
std::u16string* error,
ExtensionId* extension_id) { … }
std::u16string InvalidManifestVersionError(const char* manifest_version_error,
bool is_platform_app) { … }
}
const int Extension::kInitFromValueFlagBits = …;
const char Extension::kMimeType[] = …;
const int Extension::kValidWebExtentSchemes = …;
const int Extension::kValidHostPermissionSchemes = …;
void Extension::set_silence_deprecated_manifest_version_warnings_for_testing(
bool silence) { … }
scoped_refptr<Extension> Extension::Create(const base::FilePath& path,
ManifestLocation location,
const base::Value::Dict& value,
int flags,
std::string* utf8_error) { … }
scoped_refptr<Extension> Extension::Create(const base::FilePath& path,
ManifestLocation location,
const base::Value::Dict& value,
int flags,
const ExtensionId& explicit_id,
std::string* utf8_error) { … }
Manifest::Type Extension::GetType() const { … }
GURL Extension::GetResourceURL(const GURL& extension_url,
const std::string& relative_path) { … }
bool Extension::ResourceMatches(const URLPatternSet& pattern_set,
const std::string& resource) const { … }
ExtensionResource Extension::GetResource(std::string_view relative_path) const { … }
ExtensionResource Extension::GetResource(
const base::FilePath& relative_file_path) const { … }
bool Extension::ParsePEMKeyBytes(const std::string& input,
std::string* output) { … }
bool Extension::ProducePEM(const std::string& input, std::string* output) { … }
bool Extension::FormatPEMForFileOutput(const std::string& input,
std::string* output,
bool is_public) { … }
GURL Extension::GetBaseURLFromExtensionId(const ExtensionId& extension_id) { … }
url::Origin Extension::CreateOriginFromExtensionId(
const ExtensionId& extension_id) { … }
bool Extension::OverlapsWithOrigin(const GURL& origin) const { … }
Extension::ManifestData* Extension::GetManifestData(const std::string& key)
const { … }
void Extension::SetManifestData(const std::string& key,
std::unique_ptr<Extension::ManifestData> data) { … }
void Extension::SetGUID(const ExtensionGuid& guid) { … }
const ExtensionGuid& Extension::guid() const { … }
ManifestLocation Extension::location() const { … }
const ExtensionId& Extension::id() const { … }
const HashedExtensionId& Extension::hashed_id() const { … }
std::string Extension::VersionString() const { … }
std::string Extension::DifferentialFingerprint() const { … }
std::string Extension::GetVersionForDisplay() const { … }
void Extension::AddInstallWarning(InstallWarning new_warning) { … }
void Extension::AddInstallWarnings(std::vector<InstallWarning> new_warnings) { … }
bool Extension::is_app() const { … }
bool Extension::is_platform_app() const { … }
bool Extension::is_hosted_app() const { … }
bool Extension::is_legacy_packaged_app() const { … }
bool Extension::is_extension() const { … }
bool Extension::is_shared_module() const { … }
bool Extension::is_theme() const { … }
bool Extension::is_login_screen_extension() const { … }
bool Extension::is_chromeos_system_extension() const { … }
void Extension::AddWebExtentPattern(const URLPattern& pattern) { … }
Extension::Extension(const base::FilePath& path,
std::unique_ptr<extensions::Manifest> manifest)
: … { … }
Extension::~Extension() { … }
bool Extension::InitFromValue(int flags, std::u16string* error) { … }
bool Extension::LoadRequiredFeatures(std::u16string* error) { … }
bool Extension::LoadName(std::u16string* error) { … }
bool Extension::LoadVersion(std::u16string* error) { … }
bool Extension::LoadAppFeatures(std::u16string* error) { … }
bool Extension::LoadExtent(const char* key,
URLPatternSet* extent,
const char* list_error,
const char* value_error,
std::u16string* error) { … }
bool Extension::LoadSharedFeatures(std::u16string* error) { … }
bool Extension::LoadDescription(std::u16string* error) { … }
bool Extension::LoadManifestVersion(std::u16string* error) { … }
bool Extension::LoadShortName(std::u16string* error) { … }
ExtensionInfo::ExtensionInfo(const base::Value::Dict* manifest,
const ExtensionId& id,
const base::FilePath& path,
ManifestLocation location)
: … { … }
ExtensionInfo::ExtensionInfo(ExtensionInfo&&) noexcept = default;
ExtensionInfo& ExtensionInfo::operator=(ExtensionInfo&&) = default;
ExtensionInfo::~ExtensionInfo() = default;
}