chromium/chromeos/crosapi/mojom/prefs.mojom

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

module crosapi.mojom;

import "mojo/public/mojom/base/values.mojom";

// Pref paths.
[Stable, Extensible]
enum PrefPath {
  [Default] kUnknown = 0,
  // M89: metrics::prefs::kMetricsReportingEnabled (local state).
  kMetricsReportingEnabled = 1,
  // M89: ash::prefs::kAccessibilitySpokenFeedbackEnabled (profile).
  // Note this writes to a different prefstore than the extension version below.
  // Note that turning this pref on will install a helper component
  // extension in Lacros as well as turning on the accessibility feature
  // in Ash.
  kAccessibilitySpokenFeedbackEnabled = 2,
  // M90: ash::prefs::kDeviceSystemWideTracingEnabled (local state).
  [MinVersion=1] kDeviceSystemWideTracingEnabled = 3,
  // M98: prefs::kDnsOverHttpsMode (local state)
  [MinVersion=2] kDnsOverHttpsMode = 4,
  // Deprecated in m124: Use kDnsOverHttpsEffectiveTemplatesChromeOS to track
  // the effective DoH URI template. TODO(b/40160600): Remove this entry.
  // M98: prefs::kDnsOverHttpsTemplates (local state)
  [MinVersion=2] kDnsOverHttpsTemplates = 5,
  // M98: prefs::kDockedMagnifierEnabled (extension).
  [MinVersion=3]
  kDockedMagnifierEnabled = 6,
  // M98: prefs::kAccessibilityAutoclickEnabled (extension).
  [MinVersion=3]
  kAccessibilityAutoclickEnabled = 7,
  // M98: prefs::kAccessibilityCaretHighlightEnabled (extension).
  [MinVersion=3]
  kAccessibilityCaretHighlightEnabled = 8,
  // M98: prefs::kAccessibilityCursorColorEnabled (extension).
  [MinVersion=3]
  kAccessibilityCursorColorEnabled = 9,
  // M98: prefs::kAccessibilityCursorHighlightEnabled (extension).
  [MinVersion=3]
  kAccessibilityCursorHighlightEnabled = 10,
  // M98: prefs::kAccessibilityDictationEnabled (extension).
  [MinVersion=3]
  kAccessibilityDictationEnabled = 11,
  // M98: prefs::kAccessibilityFocusHighlightEnabled (extension).
  [MinVersion=3]
  kAccessibilityFocusHighlightEnabled = 12,
  // M98: prefs::kAccessibilityHighContrastEnabled (extension).
  [MinVersion=3]
  kAccessibilityHighContrastEnabled = 13,
  // M98: prefs::kAccessibilityLargeCursorEnabled (extension).
  [MinVersion=3]
  kAccessibilityLargeCursorEnabled = 14,
  // M98: prefs::kAccessibilityScreenMagnifierEnabled (extension).
  [MinVersion=3]
  kAccessibilityScreenMagnifierEnabled = 15,
  // M98: prefs::kAccessibilitySelectToSpeakEnabled (extension).
  // Note that turning this pref on will install a helper component
  // extension in Lacros as well as turning on the accessibility feature
  // in Ash.
  [MinVersion=3]
  kAccessibilitySelectToSpeakEnabled = 16,
  // M98: prefs::kAccessibilitySpokenFeedbackEnabled (extension).
  // Note this writes to a different prefstore than the profile version above.
  [MinVersion=3]
  kExtensionAccessibilitySpokenFeedbackEnabled = 17,
  // M98: prefs::kAccessibilityStickyKeysEnabled (extension).
  [MinVersion=3]
  kAccessibilityStickyKeysEnabled = 18,
  // M98: prefs::kAccessibilitySwitchAccessEnabled (extension).
  // Note that turning this pref on will install a helper component
  // extension in Lacros as well as turning on the accessibility feature
  // in Ash.
  [MinVersion=3]
  kAccessibilitySwitchAccessEnabled = 19,
  // M98: prefs::kAccessibilityVirtualKeyboardEnabled (extension).
  [MinVersion=3]
  kAccessibilityVirtualKeyboardEnabled = 20,
  // M100: quick_answers::prefs::kQuickAnswersEnabled (profile)
  [MinVersion=4] kQuickAnswersEnabled = 21,
  // M100: quick_answers::prefs::kQuickAnswersConsentStatus (profile)
  [MinVersion=4] kQuickAnswersConsentStatus = 22,
  // M100: quick_answers::prefs::kQuickAnswersDefinitionEnabled (profile)
  [MinVersion=4] kQuickAnswersDefinitionEnabled = 23,
  // M100: quick_answers::prefs::kQuickAnswersTranslationEnabled (profile)
  [MinVersion=4] kQuickAnswersTranslationEnabled = 24,
  // M100: quick_answers::prefs::kQuickAnswersUnitConversionEnabled (profile)
  [MinVersion=4] kQuickAnswersUnitConversionEnabled = 25,
  // M100: quick_answers::prefs::kQuickAnswersNoticeImpressionCount (profile)
  [MinVersion=4] kQuickAnswersNoticeImpressionCount = 26,
  // M100: quick_answers::prefs::kQuickAnswersNoticeImpressionDuration (profile)
  [MinVersion=4] kQuickAnswersNoticeImpressionDuration = 27,
  // M100: language::prefs::kPreferredLanguages (profile)
  [MinVersion=4] kPreferredLanguages = 28,
  // M100: language::prefs::kApplicationLocale (profile)
  [MinVersion=4] kApplicationLocale = 29,
  // M104: prefs::kSharedStorage (profile)
  [MinVersion=5] kSharedStorage = 30,
  // Deprecated in m123: No longer supported as ash-controlled pref. Do not use.
  [MinVersion=6] kProtectedContentDefaultDeprecated = 31,
  // Deprecated in m124: Use kDnsOverHttpsEffectiveTemplatesChromeOS to track
  // the effective DoH URI template. TODO(b/40160600): Remove this entry.
  // M109: prefs::kDnsOverHttpsTemplatesWithIdentifiers (local state)
  [MinVersion=7] kDnsOverHttpsTemplatesWithIdentifiers = 32,
  // Deprecated in m124: Use kDnsOverHttpsEffectiveTemplatesChromeOS to track
  // the effective DoH URI template. TODO(b/40160600): Remove this entry.
  // M109: prefs::kDnsOverHttpsSalt (local state)
  [MinVersion=7] kDnsOverHttpsSalt = 33,
  // M110: ash::prefs::kUserGeolocationAccessLevel
  [MinVersion=8] kUserGeolocationAccessLevel = 34,
  // M112: prefs::kMultitaskMenuNudgeClamshellShownCount
  [MinVersion=9] kMultitaskMenuNudgeClamshellShownCount = 35,
  // M112: prefs::kMultitaskMenuNudgeClamshellLastShown
  [MinVersion=9] kMultitaskMenuNudgeClamshellLastShown = 36,
  // M115: ash::kAttestationForContentProtectionEnabled
  [MinVersion=10] kAttestationForContentProtectionEnabled = 37,
  // M116: prefs::kAccessCodeCastDevices (profile)
  [MinVersion=11] kAccessCodeCastDevices= 38,
  // M116: prefs::kAccessCodeCastDeviceAdditionTime (profile)
  [MinVersion=11] kAccessCodeCastDeviceAdditionTime = 39,
  [MinVersion=12] kAccessToGetAllScreensMediaInSessionAllowedForUrls = 40,
  // Deprecated in m126: The feature is always active.
  [MinVersion=13] kAccessibilityPdfOcrAlwaysActiveDeprecated = 41,
  // M117 proxy_config::prefs::kProxy (profile)
  [MinVersion=14] kProxy = 42,
  // M121: DefaultSearchManager::kDefaultSearchProviderDataPrefName
  [MinVersion=15] kDefaultSearchProviderDataPrefName = 43,
  // M121: prefs::kIsolatedWebAppsEnabled
  [MinVersion=16] kIsolatedWebAppsEnabled = 44,
  // M124: prefs::kDnsOverHttpsEffectiveTemplatesChromeOS
  [MinVersion=17] kDnsOverHttpsEffectiveTemplatesChromeOS = 45,
  // M125: prefs::kAccessibilityReducedAnimationsEnabled
  [MinVersion=18] kAccessibilityReducedAnimationsEnabled = 46,
  // Deprecated in m128: Use kHmrEnabled to track
  [MinVersion=19] kMahiEnabledDeprecated = 47,
  // M126: prefs::kOverscrollHistoryNavigationEnabled
  [MinVersion=20] kOverscrollHistoryNavigationEnabled = 48,
  // M128: ash::prefs::kUserCameraAllowed
  [MinVersion=21] kUserCameraAllowed = 49,
  // M128: ash::prefs::kUserMicrophoneAllowed
  [MinVersion=21] kUserMicrophoneAllowed = 50,
  // M128: ash::prefs::kHmrEnabled
  [MinVersion=22] kHmrEnabled = 51,
  // M128: prefs::kHMRConsentStatus
  [MinVersion=23] kHMRConsentStatus = 52,
  // M128: prefs::kHMRConsentWindowDismissCount
  [MinVersion=23] kHMRConsentWindowDismissCount = 53,
};

// Information about who or what is controlling a particular pref. This is used
// to generate the LevelOfControl on the ChromeSetting. See:
// https://developer.chrome.com/docs/extensions/reference/types/#type-LevelOfControl
// Note that with respect to LevelOfControl, we do not consider extensions in
// ash as extensions. They are treated as a prefstore of higher precedence.
// However, no extensions in ash are expected to set these prefs.
[Stable, Extensible]
enum PrefControlState {
  [Default] kDefaultUnknown = 0,
  // Controlled by an extension in lacros. Ash does not have enough information
  // to know which extension in Lacros is controlling this pref.
  kLacrosExtensionControlled = 1,
  // This pref is not controlled by an extension in lacros but could be
  // controlled by an extension in lacros, because no prefstore of higher
  // precedence controls it (for example, the policy prefstore).
  kLacrosExtensionControllable = 2,
  // This pref is not controlled by an extension in lacros and cannot be
  // controlled by an extension in lacros, because a prefstore of higher
  // precedence controls it (for example, because it is controlled by policy).
  kNotExtensionControllable = 3,
  // The provided PrefPath does not map to an extension-controlled pref.
  kNotExtensionControlledPrefPath = 4,
};

// Interface for pref observers. Implemented by lacros-chrome. Used by
// ash-chrome to send pref updates.
[Stable, Uuid="07d804d1-3d8d-4da1-b9b9-05f8a6bfe4c4"]
interface PrefObserver {
  // Called when an observed pref changes.
  OnPrefChanged@0(mojo_base.mojom.Value value);
};

// Interface for prefs. Implemented by ash-chrome.
// Next version: 5
// Next method id: 5
[Stable, Uuid="815df607-0596-46f7-9ed9-14683b4826a3"]
interface Prefs {
  // Gets the specified ash pref. Returns empty if ash-chrome does not have path
  // registered, or if the pref is not found.
  GetPref@0(PrefPath path) => (mojo_base.mojom.Value? value);

  // Gets the specified ash pref. Additionally returns the control state of the
  // pref.
  [MinVersion=4]
  GetExtensionPrefWithControl@3(PrefPath path) => (
    mojo_base.mojom.Value? value, PrefControlState control);

  // Sets the specified ash pref. Does nothing if ash-chrome does not have path
  // registered.
  SetPref@1(PrefPath path, mojo_base.mojom.Value value) => ();

  // Clears the value of the specified ash pref set by lacros.
  // The pref must be extension-controlled.
  [MinVersion=2]
  ClearExtensionControlledPref@4(PrefPath path) => ();

  // Adds an observer for ash pref. The observer is fired immediately with the
  // current value. Multiple observers may be registered for any given pref.
  // Does nothing if ash-chrome does not have path registered.
  AddObserver@2(PrefPath path, pending_remote<PrefObserver> observer);
};