#include "extensions/browser/user_script_world_configuration_manager.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_factory.h"
#include "extensions/browser/extension_registry_factory.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/renderer_startup_helper.h"
namespace extensions {
namespace {
constexpr char kDefaultUserScriptWorldKey[] = …;
constexpr char kUserScriptWorldMessagingKey[] = …;
constexpr char kUserScriptWorldCspKey[] = …;
class UserScriptWorldConfigurationManagerFactory
: public BrowserContextKeyedServiceFactory { … };
std::string_view GetUserScriptWorldKeyForWorldId(
const std::optional<std::string>& world_id) { … }
mojom::UserScriptWorldInfoPtr ParseUserScriptWorldInfo(
const ExtensionId& extension_id,
const std::optional<std::string>& world_id,
const base::Value::Dict* dict) { … }
}
UserScriptWorldConfigurationManager::UserScriptWorldConfigurationManager(
content::BrowserContext* browser_context)
: … { … }
UserScriptWorldConfigurationManager::~UserScriptWorldConfigurationManager() =
default;
void UserScriptWorldConfigurationManager::SetUserScriptWorldInfo(
const Extension& extension,
const std::optional<std::string>& world_id,
std::optional<std::string> csp,
bool enable_messaging) { … }
void UserScriptWorldConfigurationManager::ClearUserScriptWorldInfo(
const Extension& extension,
const std::optional<std::string>& world_id) { … }
mojom::UserScriptWorldInfoPtr
UserScriptWorldConfigurationManager::GetUserScriptWorldInfo(
const ExtensionId& extension_id,
const std::optional<std::string>& world_id) { … }
std::vector<mojom::UserScriptWorldInfoPtr>
UserScriptWorldConfigurationManager::GetAllUserScriptWorlds(
const ExtensionId& extension_id) { … }
BrowserContextKeyedServiceFactory&
UserScriptWorldConfigurationManager::GetFactory() { … }
UserScriptWorldConfigurationManager* UserScriptWorldConfigurationManager::Get(
content::BrowserContext* browser_context) { … }
void UserScriptWorldConfigurationManager::OnExtensionWillBeInstalled(
content::BrowserContext* browser_context,
const Extension* extension,
bool is_update,
const std::string& old_name) { … }
}