chromium/chrome/browser/promos/promos_utils.cc

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

#include "chrome/browser/promos/promos_utils.h"

#include <string>
#include <vector>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/promos/promos_pref_names.h"
#include "chrome/browser/promos/promos_types.h"
#include "chrome/common/pref_names.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/prefs/pref_service.h"
#include "components/segmentation_platform/embedder/default_model/device_switcher_model.h"

namespace promos_utils {
// TODO(crbug.com/339262105): Clean up the old password promo methods after the
// generic promo launch.
// Max impression count per user for the iOS password promo on desktop.
constexpr int kiOSPasswordPromoMaxImpressionCount =;

// TODO(crbug.com/339262105): Clean up the old password promo methods after the
// generic promo launch.
// Minimum time threshold between impressions for a given user to see the iOS
// password promo on desktop.
constexpr base::TimeDelta kiOSPasswordPromoCooldownTime =;

// Max impression count per user, per promo for the iOS desktop promos on
// desktop.
constexpr int kiOSDesktopPromoMaxImpressionCount =;

// Total impression count per user in their lifetime, for all iOS desktop
// promos.
constexpr int kiOSDesktopPromoTotalImpressionCount =;

// Total amount of opt-outs across any Desktop to iOS promo to block impressions
// of other instances of Desktop to iOS promos, per user.
constexpr int kiOSDesktopPromoTotalOptOuts =;

// Minimum time threshold between impressions for a given user to see the iOS
// desktop promo on desktop.
constexpr base::TimeDelta kiOSDesktopPromoCooldownTime =;

// IOSDesktopPromoHistogramType returns the promo histogram type for the given
// promo type.
std::string IOSDesktopPromoHistogramType(IOSPromoType promo_type) {}

// VerifyIOSDesktopPromoTotalImpressions ensures that each individual user sees
// 10 of these promos total in their lifetime.
bool VerifyIOSDesktopPromoTotalImpressions(Profile* profile) {}

// VerifyIOSDesktopPromoTotalOptOuts verifies that a user hasn't opted-out of
// seeing more than 1 of the 4 promo types (Passwords, Bookmarks, Addresses,
// Payments).
bool VerifyIOSDesktopPromoTotalOptOuts(Profile* profile) {}

// VerifyMostRecentPromoTimestamp ensures that each individual user sees a
// iOS to Desktop promo a maximum of once every 90 days.
bool VerifyMostRecentPromoTimestamp(Profile* profile) {}

// TODO(crbug.com/339262105): Clean up the old password promo methods after
// the generic promo launch.
// RecordIOSPasswordPromoShownHistogram records which impression (count) was
// shown to the user.
void RecordIOSPasswordPromoShownHistogram(int impression_count) {}

// RecordIOSDesktopPromoShownHistogram records which impression (count) was
// shown to the user depending on the given promo type.
void RecordIOSDesktopPromoShownHistogram(IOSPromoType promo_type,
                                         int impression_count) {}

// IOSPromoPrefsConfig is a complex struct that needs definition of a
// constructor, an explicit out-of-line copy constructor and a destructor.
IOSPromoPrefsConfig::IOSPromoPrefsConfig() = default;
IOSPromoPrefsConfig::IOSPromoPrefsConfig(const IOSPromoPrefsConfig&) = default;
IOSPromoPrefsConfig::~IOSPromoPrefsConfig() = default;

IOSPromoPrefsConfig::IOSPromoPrefsConfig(IOSPromoType promo_type) {}

void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {}

// TODO(crbug.com/339262105): Clean up the old password promo methods after
// the generic promo launch.
void RecordIOSPasswordPromoUserInteractionHistogram(
    int impression_count,
    DesktopIOSPasswordPromoAction action) {}

// RecordIOSDesktopPromoUserInteractionHistogram records which impression
// (count) depending on the promo type.
void RecordIOSDesktopPromoUserInteractionHistogram(
    IOSPromoType promo_type,
    int impression_count,
    DesktopIOSPromoAction action) {}

// TODO(crbug.com/339262105): Clean up the old password promo methods after
// the generic promo launch.
bool ShouldShowIOSPasswordPromo(Profile* profile) {}

bool ShouldShowIOSDesktopPromo(Profile* profile, IOSPromoType promo_type) {}

bool UserNotClassifiedAsMobileDeviceSwitcher(
    const segmentation_platform::ClassificationResult& result) {}

// TODO(crbug.com/339262105): Clean up the old password promo methods after
// the generic promo launch.
void iOSPasswordPromoShown(Profile* profile) {}

void IOSDesktopPromoShown(Profile* profile, IOSPromoType promo_type) {}
}  // namespace promos_utils