chromium/components/permissions/permission_hats_trigger_helper.cc

// Copyright 2022 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/permissions/permission_hats_trigger_helper.h"

#include <optional>
#include <string_view>
#include <utility>

#include "base/check_is_test.h"
#include "base/no_destructor.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/messages/android/message_enums.h"
#include "components/permissions/constants.h"
#include "components/permissions/features.h"
#include "components/permissions/permission_uma_util.h"
#include "components/permissions/pref_names.h"
#include "components/permissions/request_type.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"

namespace permissions {

namespace {

bool is_test =;

std::vector<std::string> SplitCsvString(const std::string& csv_string) {}

bool StringMatchesFilter(const std::string& string, const std::string& filter) {}

std::map<std::string, std::pair<std::string, std::string>>
GetKeyToValueFilterPairMap(
    PermissionHatsTriggerHelper::PromptParametersForHats prompt_parameters) {}

// Typos in the gcl configuration cannot be verified and may be missed by
// reviewers. In the worst case, no filters are configured. By definition of
// our filters, this would match all requests. To safeguard against this kind
// of misconfiguration (which would lead to very high HaTS QPS), we enforce
// that at least one valid filter must be configured.
bool IsValidConfiguration(
    PermissionHatsTriggerHelper::PromptParametersForHats prompt_parameters) {}

std::vector<double> ParseProbabilityVector(std::string probability_vector_csv) {}

std::vector<double>& GetProbabilityVector(std::string probability_vector_csv) {}

std::vector<std::string> ParseRequestFilterVector(
    std::string request_vector_csv) {}

std::vector<std::string>& GetRequestFilterVector(
    std::string request_vector_csv) {}
}  // namespace

PermissionHatsTriggerHelper::PromptParametersForHats::PromptParametersForHats(
    RequestType request_type,
    std::optional<PermissionAction> action,
    PermissionPromptDisposition prompt_disposition,
    PermissionPromptDispositionReason prompt_disposition_reason,
    PermissionRequestGestureType gesture_type,
    const std::string& channel,
    const std::string& survey_display_time,
    std::optional<base::TimeDelta> prompt_display_duration,
    OneTimePermissionPromptsDecidedBucket one_time_prompts_decided_bucket,
    std::optional<GURL> gurl,
    std::optional<permissions::feature_params::PermissionElementPromptPosition>
        pepc_prompt_position,
    ContentSetting initial_permission_status)
    :{}

PermissionHatsTriggerHelper::SurveyParametersForHats::SurveyParametersForHats(
    double trigger_probability,
    std::optional<std::string> supplied_trigger_id,
    std::optional<std::u16string> custom_survey_invitation,
    std::optional<messages::MessageIdentifier> message_identifier)
    :{}

PermissionHatsTriggerHelper::SurveyParametersForHats::
    ~SurveyParametersForHats() = default;

PermissionHatsTriggerHelper::SurveyParametersForHats::SurveyParametersForHats(
    const SurveyParametersForHats& other) = default;

PermissionHatsTriggerHelper::PromptParametersForHats::PromptParametersForHats(
    const PromptParametersForHats& other) = default;
PermissionHatsTriggerHelper::PromptParametersForHats::
    ~PromptParametersForHats() = default;

PermissionHatsTriggerHelper::SurveyProductSpecificData::
    SurveyProductSpecificData(SurveyBitsData survey_bits_data,
                              SurveyStringData survey_string_data)
    :{}

PermissionHatsTriggerHelper::SurveyProductSpecificData::
    ~SurveyProductSpecificData() = default;

PermissionHatsTriggerHelper::SurveyProductSpecificData
PermissionHatsTriggerHelper::SurveyProductSpecificData::PopulateFrom(
    PromptParametersForHats prompt_parameters) {}

// static
void PermissionHatsTriggerHelper::RegisterProfilePrefs(
    user_prefs::PrefRegistrySyncable* registry) {}

bool PermissionHatsTriggerHelper::ArePromptTriggerCriteriaSatisfied(
    PromptParametersForHats prompt_parameters) {}

// static
void PermissionHatsTriggerHelper::
    IncrementOneTimePermissionPromptsDecidedIfApplicable(
        ContentSettingsType type,
        PrefService* pref_service) {}

// static
PermissionHatsTriggerHelper::OneTimePermissionPromptsDecidedBucket
PermissionHatsTriggerHelper::GetOneTimePromptsDecidedBucket(
    PrefService* pref_service) {}

// static
std::string PermissionHatsTriggerHelper::GetOneTimePromptsDecidedBucketString(
    OneTimePermissionPromptsDecidedBucket bucket) {}

// static
std::optional<PermissionHatsTriggerHelper::SurveyParametersForHats>
PermissionHatsTriggerHelper::GetSurveyParametersForRequestType(
    permissions::RequestType request_type) {}

// static
void PermissionHatsTriggerHelper::SetIsTest() {}

}  // namespace permissions