// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/optimization_guide/core/optimization_guide_prefs.h" #include "components/optimization_guide/core/feature_registry/enterprise_policy_registry.h" #include "components/optimization_guide/core/model_execution/feature_keys.h" #include "components/optimization_guide/core/optimization_guide_features.h" #include "components/prefs/pref_registry_simple.h" namespace optimization_guide { namespace prefs { // A pref that stores the last time a hints fetch was attempted. This limits the // frequency that hints are fetched and prevents a crash loop that continually // fetches hints on startup. const char kHintsFetcherLastFetchAttempt[] = …; // A pref that stores the last time a prediction model and host model features // fetch was attempted. This limits the frequency of fetching for updates and // prevents a crash loop that continually fetches prediction models and host // model features on startup. const char kModelAndFeaturesLastFetchAttempt[] = …; // A pref that stores the last time a prediction model fetch was successful. // This helps determine when to schedule the next fetch. const char kModelLastFetchSuccess[] = …; // A dictionary pref that stores hosts that have had hints successfully fetched // from the remote Optimization Guide Server. The entry for each host contains // the time that the fetch that covered this host expires, i.e., any hints // from the fetch would be considered stale. const char kHintsFetcherHostsSuccessfullyFetched[] = …; // A string pref that stores the version of the Optimization Hints component // that is currently being processed. This pref is cleared once processing // completes. It is used for detecting a potential crash loop on processing a // version of hints. const char kPendingHintsProcessingVersion[] = …; // A dictionary pref that stores optimization type was previously // registered so that the first run of optimization types can be identified. // The entry is the OptimizationType enum. The value of the key-value pair will // not be used. const char kPreviouslyRegisteredOptimizationTypes[] = …; // A dictionary pref that stores the file paths that need to be deleted as keys. // The value will not be used. const char kStoreFilePathsToDelete[] = …; // An integer pref that contains the user's setting state of the opt-in // main toggle. Changing this toggle affects the state of the per-feature // toggles. const char kModelExecutionMainToggleSettingState[] = …; // A dictionary pref that stores optimization types that had filter associated // with this type. The entry is the OptimizationType enum. The value of the // key-value pair will not be used. const char kPreviousOptimizationTypesWithFilter[] = …; // TODO(b/354704993): Move this to the SettingsUiMetadata. // Pref that contains user opt-in state for different features. std::string GetSettingEnabledPrefName(UserVisibleFeatureKey feature) { … } void RegisterSettingsEnabledPrefs(PrefRegistrySimple* registry) { … } namespace localstate { // A dictionary pref that stores the lightweight metadata of all the models in // the store, keyed by the optimization target and ModelCacheKey. const char kModelStoreMetadata[] = …; // A dictionary pref that stores the mapping between client generated // ModelCacheKey based on the user profile characteristics and the server // returned ModelCacheKey that was used in the actual model selection logic. const char kModelCacheKeyMapping[] = …; // A dictionary pref that stores the file paths that need to be deleted as keys. // The value will not be used. const char kStoreFilePathsToDelete[] = …; } // namespace localstate void RegisterProfilePrefs(PrefRegistrySimple* registry) { … } void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { … } } // namespace prefs } // namespace optimization_guide