chromium/components/page_content_annotations/core/page_content_annotations_features.cc

// Copyright 2024 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/page_content_annotations/core/page_content_annotations_features.h"

#include "base/containers/contains.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "components/page_content_annotations/core/page_content_annotations_switches.h"
#include "ui/base/l10n/l10n_util.h"

namespace page_content_annotations::features {

namespace {

constexpr auto enabled_by_default_desktop_only =base::FEATURE_DISABLED_BY_DEFAULT;
#else
    base::FEATURE_ENABLED_BY_DEFAULT;
#endif

constexpr auto enabled_by_default_non_ios =base::FEATURE_DISABLED_BY_DEFAULT;
#else
    base::FEATURE_ENABLED_BY_DEFAULT;
#endif

// Returns whether |locale| is a supported locale for |feature|.
//
// This matches |locale| with the "supported_locales" feature param value in
// |feature|, which is expected to be a comma-separated list of locales. A
// feature param containing "en,es-ES,zh-TW" restricts the feature to English
// language users from any locale and Spanish language users from the Spain
// es-ES locale. A feature param containing "" is unrestricted by locale and any
// user may load it.
bool IsSupportedLocaleForFeature(
    const std::string locale,
    const base::Feature& feature,
    const std::string& default_value = "de,en,es,fr,it,nl,pt,tr") {}

bool IsSupportedCountryForFeature(const std::string& country_code,
                                  const base::Feature& feature,
                                  const std::string& default_value) {}

}  // namespace

// Enables page content to be annotated.
BASE_FEATURE();

// Enables the page visibility model to be annotated on every page load.
BASE_FEATURE();

BASE_FEATURE();

BASE_FEATURE();

BASE_FEATURE();

// Enables fetching page metadata from the remote Optimization Guide service.
BASE_FEATURE();

BASE_FEATURE();

BASE_FEATURE();

BASE_FEATURE();

// Enables text embeddings to annotated on every page visit and later queried.
BASE_FEATURE();

base::TimeDelta PCAServiceWaitForTitleDelayDuration() {}

bool ShouldEnablePageContentAnnotations() {}

bool ShouldQueryEmbeddings() {}

bool ShouldWriteContentAnnotationsToHistoryService() {}

size_t MaxContentAnnotationRequestsCached() {}

const base::FeatureParam<bool> kContentAnnotationsExtractRelatedSearchesParam{};

bool ShouldExtractRelatedSearches() {}

bool ShouldExecutePageVisibilityModelOnPageContent(const std::string& locale) {}

bool RemotePageMetadataEnabled(const std::string& locale,
                               const std::string& country_code) {}

int GetMinimumPageCategoryScoreToPersist() {}

int NumBitsForRAPPORMetrics() {}

double NoiseProbabilityForRAPPORMetrics() {}

bool PageVisibilityBatchAnnotationsEnabled() {}

bool TextEmbeddingBatchAnnotationsEnabled() {}

size_t AnnotateVisitBatchSize() {}

base::TimeDelta PageContentAnnotationValidationStartupDelay() {}

size_t PageContentAnnotationsValidationBatchSize() {}

base::TimeDelta PageContentAnnotationBatchSizeTimeoutDuration() {}

size_t MaxVisitAnnotationCacheSize() {}

bool ShouldPersistSalientImageMetadata(const std::string& locale,
                                       const std::string& country_code) {}

size_t MaxRelatedSearchesCacheSize() {}

}  // namespace page_content_annotations::features