#include "chrome/browser/apps/platform_apps/api/sync_file_system/extension_sync_event_observer.h"
#include <utility>
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api_helpers.h"
#include "chrome/browser/sync_file_system/sync_event_observer.h"
#include "chrome/browser/sync_file_system/sync_file_system_service.h"
#include "chrome/browser/sync_file_system/sync_file_system_service_factory.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "chrome/common/apps/platform_apps/api/sync_file_system.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/extension_set.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/common/file_system/file_system_util.h"
SyncEventObserver;
namespace chrome_apps {
namespace api {
namespace {
enum class SyncActionMetrics { … };
SyncActionMetrics convertToHistogramEnum(
::sync_file_system::SyncAction action) { … }
}
extensions::BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>*
ExtensionSyncEventObserver::GetFactoryInstance() { … }
ExtensionSyncEventObserver::ExtensionSyncEventObserver(
content::BrowserContext* context)
: … { … }
void ExtensionSyncEventObserver::InitializeForService(
::sync_file_system::SyncFileSystemService* sync_service) { … }
ExtensionSyncEventObserver::~ExtensionSyncEventObserver() = default;
void ExtensionSyncEventObserver::Shutdown() { … }
std::string ExtensionSyncEventObserver::GetExtensionId(const GURL& app_origin) { … }
void ExtensionSyncEventObserver::OnSyncStateUpdated(
const GURL& app_origin,
::sync_file_system::SyncServiceState state,
const std::string& description) { … }
void ExtensionSyncEventObserver::OnFileSynced(
const storage::FileSystemURL& url,
::sync_file_system::SyncFileType file_type,
::sync_file_system::SyncFileStatus status,
::sync_file_system::SyncAction action,
::sync_file_system::SyncDirection direction) { … }
void ExtensionSyncEventObserver::BroadcastOrDispatchEvent(
const GURL& app_origin,
extensions::events::HistogramValue histogram_value,
const std::string& event_name,
base::Value::List values) { … }
}
}
template <>
void extensions::BrowserContextKeyedAPIFactory<
chrome_apps::api::ExtensionSyncEventObserver>::
DeclareFactoryDependencies() { … }