#include "chrome/browser/extensions/extension_sync_service.h"
#include <utility>
#include "base/auto_reset.h"
#include "base/feature_list.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/one_shot_event.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_sync_data.h"
#include "chrome/browser/extensions/extension_sync_service_factory.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/glue/sync_start_util.h"
#include "chrome/common/extensions/extension_constants.h"
#include "components/sync/model/sync_change.h"
#include "extensions/browser/app_sorting.h"
#include "extensions/browser/blocklist_extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permissions_data.h"
AppSorting;
Extension;
ExtensionManagement;
ExtensionManagementFactory;
ExtensionPrefs;
ExtensionRegistry;
ExtensionSet;
ExtensionSyncData;
ExtensionSystem;
SyncBundle;
namespace {
BASE_FEATURE(…);
bool IsCorrectSyncType(const Extension& extension, syncer::DataType type) { … }
bool ShouldAllowInstall(const Extension* extension,
content::BrowserContext* context) { … }
std::map<std::string, syncer::SyncData> ToSyncerSyncDataMap(
const std::vector<ExtensionSyncData>& data) { … }
syncer::SyncDataList ToSyncerSyncDataList(
const std::vector<ExtensionSyncData>& data) { … }
static_assert …;
const int kKnownSyncableDisableReasons = …;
const int kAllKnownDisableReasons = …;
const int kSyncableDisableReasons = …;
}
struct ExtensionSyncService::PendingUpdate { … };
ExtensionSyncService::ExtensionSyncService(Profile* profile)
: … { … }
ExtensionSyncService::~ExtensionSyncService() { … }
ExtensionSyncService* ExtensionSyncService::Get(
content::BrowserContext* context) { … }
void ExtensionSyncService::SyncExtensionChangeIfNeeded(
const Extension& extension) { … }
void ExtensionSyncService::WaitUntilReadyToSync(base::OnceClosure done) { … }
std::optional<syncer::ModelError>
ExtensionSyncService::MergeDataAndStartSyncing(
syncer::DataType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor) { … }
void ExtensionSyncService::StopSyncing(syncer::DataType type) { … }
syncer::SyncDataList ExtensionSyncService::GetAllSyncDataForTesting(
syncer::DataType type) const { … }
std::optional<syncer::ModelError> ExtensionSyncService::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) { … }
base::WeakPtr<syncer::SyncableService> ExtensionSyncService::AsWeakPtr() { … }
ExtensionSyncData ExtensionSyncService::CreateSyncData(
const Extension& extension) const { … }
void ExtensionSyncService::ApplySyncData(
const ExtensionSyncData& extension_sync_data) { … }
void ExtensionSyncService::SetSyncStartFlareForTesting(
const syncer::SyncableService::StartSyncFlare& flare) { … }
void ExtensionSyncService::DeleteThemeDoNotUse(const Extension& theme) { … }
extensions::ExtensionService* ExtensionSyncService::extension_service() const { … }
void ExtensionSyncService::OnExtensionInstalled(
content::BrowserContext* browser_context,
const Extension* extension,
bool is_update) { … }
void ExtensionSyncService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
const Extension* extension,
extensions::UninstallReason reason) { … }
void ExtensionSyncService::OnExtensionStateChanged(
const std::string& extension_id,
bool state) { … }
void ExtensionSyncService::OnExtensionDisableReasonsChanged(
const std::string& extension_id,
int disabled_reasons) { … }
SyncBundle* ExtensionSyncService::GetSyncBundle(syncer::DataType type) { … }
const SyncBundle* ExtensionSyncService::GetSyncBundle(
syncer::DataType type) const { … }
std::vector<ExtensionSyncData> ExtensionSyncService::GetLocalSyncDataList(
syncer::DataType type) const { … }
void ExtensionSyncService::FillSyncDataList(
const ExtensionSet& extensions,
syncer::DataType type,
std::vector<ExtensionSyncData>* sync_data_list) const { … }
bool ExtensionSyncService::ShouldSync(const Extension& extension) const { … }