chromium/components/sync/service/sync_service_utils.h

// Copyright 2015 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_SYNC_SERVICE_SYNC_SERVICE_UTILS_H_
#define COMPONENTS_SYNC_SERVICE_SYNC_SERVICE_UTILS_H_

#include "components/sync/base/data_type.h"

namespace syncer {

class SyncService;

// Indicates whether uploading of data to Google is enabled, i.e. the user has
// given consent to upload this data. Since this enum is used for logging
// histograms, entries must not be removed or reordered.
enum class UploadState {};

// Represents the UI elements which contain trusted vault error button. These
// values are persisted to logs. Entries should not be renumbered and numeric
// values should never be reused. Keep in sync w/ TrustedVaultUserActionTrigger
// in tools/metrics/histograms/metadata/sync/enums.xml.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.sync
// LINT.IfChange(TrustedVaultUserActionTrigger)
enum class TrustedVaultUserActionTriggerForUMA {};
// LINT.ThenChange(/tools/metrics/histograms/metadata/sync/enums.xml:TrustedVaultUserActionTrigger)

// Returns whether |type| is being uploaded to Google. This is useful for
// features that depend on user consent for uploading data (e.g. history) to
// Google.
UploadState GetUploadToGoogleState(const SyncService* sync_service,
                                   DataType type);

void RecordKeyRetrievalTrigger(TrustedVaultUserActionTriggerForUMA trigger);

void RecordRecoverabilityDegradedFixTrigger(
    TrustedVaultUserActionTriggerForUMA trigger);

// Whether the user should be offered to opt in to trusted vault encryption.
bool ShouldOfferTrustedVaultOptIn(const SyncService* service);

}  // namespace syncer

#endif  // COMPONENTS_SYNC_SERVICE_SYNC_SERVICE_UTILS_H_