chromium/components/ukm/observers/ukm_consent_state_observer.h

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_UKM_OBSERVERS_UKM_CONSENT_STATE_OBSERVER_H_
#define COMPONENTS_UKM_OBSERVERS_UKM_CONSENT_STATE_OBSERVER_H_

#include <stdint.h>

#include <map>
#include <optional>

#include "base/feature_list.h"
#include "base/scoped_multi_source_observation.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_service_observer.h"
#include "components/ukm/ukm_consent_state.h"
#include "components/unified_consent/url_keyed_data_collection_consent_helper.h"
#include "services/metrics/public/cpp/metrics_export.h"

class PrefService;

namespace ukm {

// Marker type used to indicate that the initial UkmConsentState should
// be left in an uninitialized state (i.e. std::nullopt).
struct NoInitialUkmConsentStateTag {};
constexpr NoInitialUkmConsentStateTag NoInitialUkmConsentState;

// Observer that monitors whether UKM is allowed for all profiles.
//
// For one profile, UKM is allowed iff URL-keyed anonymized data collection is
// enabled.
class UkmConsentStateObserver
    : public syncer::SyncServiceObserver,
      public unified_consent::UrlKeyedDataCollectionConsentHelper::Observer {};

}  // namespace ukm

#endif  // COMPONENTS_UKM_OBSERVERS_UKM_CONSENT_STATE_OBSERVER_H_