chromium/services/preferences/public/mojom/preferences.mojom

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

module prefs.mojom;

import "mojo/public/mojom/base/token.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/values.mojom";
import "services/preferences/public/mojom/tracked_preference_validation_delegate.mojom";

// These parameters are passed to prefs::CreateTrackedPersistentPrefStore() in
// services/preferences/persistent_pref_store_factory.cc.
struct TrackedPersistentPrefStoreConfiguration {
  mojo_base.mojom.FilePath unprotected_pref_filename;
  mojo_base.mojom.FilePath protected_pref_filename;
  array<TrackedPreferenceMetadata> tracking_configuration;
  uint64 reporting_ids_count;
  string seed;
  string legacy_device_id;
  string registry_seed;
  mojo_base.mojom.String16 registry_path;
  pending_remote<TrackedPreferenceValidationDelegate>? validation_delegate;
  pending_remote<ResetOnLoadObserver>? reset_on_load_observer;
};

struct TrackedPreferenceMetadata {
  enum EnforcementLevel { NO_ENFORCEMENT, ENFORCE_ON_LOAD };

  enum PrefTrackingStrategy {
    // Atomic preferences are tracked as a whole.
    ATOMIC,
    // Split preferences are dictionaries for which each top-level entry is
    // tracked independently.
    SPLIT,
  };

  enum ValueType {
    IMPERSONAL,
    // The preference value may contain personal information.
    PERSONAL,
  };

  uint64 reporting_id;
  string name;
  EnforcementLevel enforcement_level;
  PrefTrackingStrategy strategy;
  ValueType value_type;
};

interface ResetOnLoadObserver {
  OnResetOnLoad();
};