#include "chrome/browser/extensions/extension_util.h"
#include <vector>
#include "base/check_is_test.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_sync_service.h"
#include "chrome/browser/extensions/permissions/permissions_updater.h"
#include "chrome/browser/extensions/shared_module_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h"
#include "chrome/common/extensions/sync_helper.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/site_instance.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/pref_names.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/user_script_manager.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/features/feature_developer_mode_only.h"
#include "extensions/common/icons/extension_icon_set.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
#include "extensions/common/permissions/permissions_data.h"
#include "ui/gfx/text_constants.h"
#include "ui/gfx/text_elider.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/file_manager/app_id.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#endif
namespace extensions {
namespace util {
namespace {
std::string ReloadExtension(const std::string& extension_id,
content::BrowserContext* context) { … }
std::string ReloadExtensionIfEnabled(const std::string& extension_id,
content::BrowserContext* context) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
bool IsForceInstalledExtension(const ExtensionId& extension_id,
content::BrowserContext* context) {
ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(context);
const PrefService::Preference* const pref =
extension_prefs->pref_service()->FindPreference(
pref_names::kInstallForceList);
if (!pref || !pref->IsManaged() ||
pref->GetType() != base::Value::Type::DICT) {
return false;
}
for (const auto item : pref->GetValue()->GetDict()) {
if (extension_id == item.first) {
return true;
}
}
return false;
}
#endif
bool IsLoginScreenExtension(
ExtensionId extension_id,
content::BrowserContext* context,
std::optional<bool> is_policy_installed = std::nullopt) { … }
}
bool HasIsolatedStorage(const ExtensionId& extension_id,
content::BrowserContext* context) { … }
bool HasIsolatedStorage(const Extension& extension,
content::BrowserContext* context) { … }
void SetIsIncognitoEnabled(const std::string& extension_id,
content::BrowserContext* context,
bool enabled) { … }
void SetAllowFileAccess(const std::string& extension_id,
content::BrowserContext* context,
bool allow) { … }
bool ShouldSync(const Extension* extension,
content::BrowserContext* context) { … }
bool IsExtensionIdle(const std::string& extension_id,
content::BrowserContext* context) { … }
base::Value::Dict GetExtensionInfo(const Extension* extension) { … }
std::unique_ptr<const PermissionSet> GetInstallPromptPermissionSetForExtension(
const Extension* extension,
Profile* profile) { … }
std::vector<content::BrowserContext*> GetAllRelatedProfiles(
Profile* profile,
const Extension& extension) { … }
void SetDeveloperModeForProfile(Profile* profile, bool in_developer_mode) { … }
std::u16string GetFixupExtensionNameForUIDisplay(
const std::string& extension_name) { … }
}
}