#include "extensions/common/manifest_handlers/content_scripts_handler.h"
#include <stddef.h>
#include <memory>
#include "base/lazy_instance.h"
#include "base/strings/utf_string_conversions.h"
#include "base/types/optional_util.h"
#include "extensions/common/api/content_scripts.h"
#include "extensions/common/api/extension_types.h"
#include "extensions/common/api/scripts_internal.h"
#include "extensions/common/api/scripts_internal/script_serialization.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/mojom/host_id.mojom.h"
#include "extensions/common/mojom/run_location.mojom-shared.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/script_constants.h"
#include "extensions/common/url_pattern.h"
#include "extensions/common/url_pattern_set.h"
#include "extensions/common/utils/content_script_utils.h"
#include "extensions/common/utils/extension_types_utils.h"
#include "url/gurl.h"
namespace extensions {
errors;
content_scripts_api;
ContentScriptsKeys;
namespace {
std::unique_ptr<UserScript> CreateUserScript(
content_scripts_api::ContentScript content_script,
int definition_index,
bool can_execute_script_everywhere,
bool all_urls_includes_chrome_urls,
Extension* extension,
std::u16string* error) { … }
struct EmptyUserScriptList { … };
static base::LazyInstance<EmptyUserScriptList>::DestructorAtExit
g_empty_script_list = …;
}
ContentScriptsInfo::ContentScriptsInfo() = default;
ContentScriptsInfo::~ContentScriptsInfo() = default;
const UserScriptList& ContentScriptsInfo::GetContentScripts(
const Extension* extension) { … }
bool ContentScriptsInfo::ExtensionHasScriptAtURL(const Extension* extension,
const GURL& url) { … }
URLPatternSet ContentScriptsInfo::GetScriptableHosts(
const Extension* extension) { … }
ContentScriptsHandler::ContentScriptsHandler() = default;
ContentScriptsHandler::~ContentScriptsHandler() = default;
base::span<const char* const> ContentScriptsHandler::Keys() const { … }
bool ContentScriptsHandler::Parse(Extension* extension, std::u16string* error) { … }
bool ContentScriptsHandler::Validate(
const Extension* extension,
std::string* error,
std::vector<InstallWarning>* warnings) const { … }
}