#include "chrome/browser/background/background_application_list_model.h"
#include <algorithm>
#include <set>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/one_shot_event.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/background/background_contents_service.h"
#include "chrome/browser/background/background_contents_service_factory.h"
#include "chrome/browser/background/background_mode_manager.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/extensions/extension_constants.h"
#include "components/crx_file/id_util.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/image_loader.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_resource.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/icons/extension_icon_set.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "ui/base/l10n/l10n_util_collator.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
APIPermission;
Extension;
ExtensionList;
ExtensionRegistry;
ExtensionSet;
PermissionSet;
UnloadedExtensionReason;
APIPermissionID;
class ExtensionNameComparator { … };
class BackgroundApplicationListModel::Application final { … };
namespace {
void GetServiceApplications(extensions::ExtensionService* service,
ExtensionList* applications_result) { … }
}
void BackgroundApplicationListModel::Observer::OnApplicationDataChanged() { … }
void BackgroundApplicationListModel::Observer::OnApplicationListChanged(
const Profile* profile) { … }
BackgroundApplicationListModel::Observer::~Observer() { … }
BackgroundApplicationListModel::Application::~Application() { … }
BackgroundApplicationListModel::Application::Application(
BackgroundApplicationListModel* model,
const Extension* extension)
: … { … }
void BackgroundApplicationListModel::Application::OnImageLoaded(
const gfx::Image& image) { … }
void BackgroundApplicationListModel::Application::RequestIcon(
extension_misc::ExtensionIcons size) { … }
BackgroundApplicationListModel::~BackgroundApplicationListModel() = default;
BackgroundApplicationListModel::BackgroundApplicationListModel(Profile* profile)
: … { … }
void BackgroundApplicationListModel::AddObserver(Observer* observer) { … }
void BackgroundApplicationListModel::AssociateApplicationData(
const Extension* extension) { … }
void BackgroundApplicationListModel::DissociateApplicationData(
const Extension* extension) { … }
const Extension* BackgroundApplicationListModel::GetExtension(
int position) const { … }
const BackgroundApplicationListModel::Application*
BackgroundApplicationListModel::FindApplication(
const Extension* extension) const { … }
BackgroundApplicationListModel::Application*
BackgroundApplicationListModel::FindApplication(
const Extension* extension) { … }
gfx::ImageSkia BackgroundApplicationListModel::GetIcon(
const Extension* extension) { … }
int BackgroundApplicationListModel::GetPosition(
const Extension* extension) const { … }
bool BackgroundApplicationListModel::IsPersistentBackgroundApp(
const Extension& extension,
Profile* profile) { … }
bool BackgroundApplicationListModel::IsTransientBackgroundApp(
const Extension& extension,
Profile* profile) { … }
bool BackgroundApplicationListModel::HasPersistentBackgroundApps() const { … }
void BackgroundApplicationListModel::SendApplicationDataChangedNotifications() { … }
void BackgroundApplicationListModel::OnExtensionLoaded(
content::BrowserContext* browser_context,
const Extension* extension) { … }
void BackgroundApplicationListModel::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionReason reason) { … }
void BackgroundApplicationListModel::OnExtensionSystemReady() { … }
void BackgroundApplicationListModel::OnShutdown(ExtensionRegistry* registry) { … }
void BackgroundApplicationListModel::OnBackgroundContentsServiceChanged() { … }
void BackgroundApplicationListModel::OnBackgroundContentsServiceDestroying() { … }
void BackgroundApplicationListModel::OnExtensionPermissionsUpdated(
const extensions::Extension& extension,
const extensions::PermissionSet& permissions,
extensions::PermissionsManager::UpdateReason reason) { … }
void BackgroundApplicationListModel::RemoveObserver(Observer* observer) { … }
void BackgroundApplicationListModel::Update() { … }
void BackgroundApplicationListModel::OnBackgroundHostCreated(
extensions::ExtensionHost* host) { … }
void BackgroundApplicationListModel::OnBackgroundHostClose(
const std::string& extension_id) { … }