#include "components/ukm/observers/ukm_consent_state_observer.h"
#include <memory>
#include <utility>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "components/metrics/metrics_switches.h"
#include "components/sync/base/data_type.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_service_utils.h"
#include "components/unified_consent/url_keyed_data_collection_consent_helper.h"
#include "google_apis/gaia/google_service_auth_error.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/components/kiosk/kiosk_utils.h"
#include "chromeos/components/mgs/managed_guest_session_utils.h"
#endif
UrlKeyedDataCollectionConsentHelper;
namespace ukm {
namespace {
bool IsMsbbConsentStateAllowed() { … }
bool CanUploadUkmForType(syncer::SyncService* sync_service,
syncer::DataType data_type,
bool msbb_consent) { … }
}
UkmConsentStateObserver::UkmConsentStateObserver()
: … { … }
UkmConsentStateObserver::UkmConsentStateObserver(NoInitialUkmConsentStateTag)
: … { … }
UkmConsentStateObserver::~UkmConsentStateObserver() { … }
bool UkmConsentStateObserver::ProfileState::IsUkmConsented() const { … }
void UkmConsentStateObserver::ProfileState::SetConsentType(
UkmConsentType type) { … }
UkmConsentStateObserver::ProfileState UkmConsentStateObserver::GetProfileState(
syncer::SyncService* sync_service,
UrlKeyedDataCollectionConsentHelper* consent_helper) { … }
void UkmConsentStateObserver::StartObserving(syncer::SyncService* sync_service,
PrefService* prefs) { … }
void UkmConsentStateObserver::UpdateUkmAllowedForAllProfiles(bool total_purge) { … }
UkmConsentState UkmConsentStateObserver::GetPreviousStatesForAllProfiles() { … }
void UkmConsentStateObserver::OnStateChanged(syncer::SyncService* sync) { … }
void UkmConsentStateObserver::OnUrlKeyedDataCollectionConsentStateChanged(
unified_consent::UrlKeyedDataCollectionConsentHelper* consent_helper) { … }
void UkmConsentStateObserver::UpdateProfileState(
syncer::SyncService* sync,
UrlKeyedDataCollectionConsentHelper* consent_helper) { … }
void UkmConsentStateObserver::OnSyncShutdown(syncer::SyncService* sync) { … }
bool UkmConsentStateObserver::IsUkmAllowedForAllProfiles() { … }
UkmConsentState UkmConsentStateObserver::GetUkmConsentState() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void UkmConsentStateObserver::SetIsDemoMode(bool is_device_in_demo_mode) {
is_device_in_demo_mode_ = is_device_in_demo_mode;
}
bool UkmConsentStateObserver::IsDeviceInDemoMode() {
return is_device_in_demo_mode_;
}
#endif
}