chromium/extensions/browser/user_script_world_configuration_manager.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {};

// Returns the key entry in the user script world dictionary to use for the
// provided `world_id`.
std::string_view GetUserScriptWorldKeyForWorldId(
    const std::optional<std::string>& world_id) {}

// Attempts to parse the given `dict` into a mojom::UserScriptWorldInfo. If
// `dict` is null, returns a default specification for a
// mojom::UserScriptWorldInfo.
mojom::UserScriptWorldInfoPtr ParseUserScriptWorldInfo(
    const ExtensionId& extension_id,
    const std::optional<std::string>& world_id,
    const base::Value::Dict* dict) {}

}  // namespace

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) {}

// static
BrowserContextKeyedServiceFactory&
UserScriptWorldConfigurationManager::GetFactory() {}

// static
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) {}

}  // namespace extensions