#include "chrome/browser/compose/proactive_nudge_tracker.h"
#include <memory>
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/types/cxx23_to_underlying.h"
#include "chrome/browser/compose/proto/compose_optimization_guide.pb.h"
#include "components/autofill/core/common/signatures.h"
#include "components/compose/core/browser/compose_metrics.h"
#include "components/compose/core/browser/config.h"
#include "components/segmentation_platform/public/constants.h"
#include "components/segmentation_platform/public/input_context.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace compose {
namespace {
ProcessedValue;
scoped_refptr<segmentation_platform::InputContext> PopulateInputContextForField(
const ProactiveNudgeTracker::Signals& signals,
const compose::ComposeHintMetadata& compose_hint) { … }
}
ProactiveNudgeTracker::Signals::Signals() = default;
ProactiveNudgeTracker::Signals::~Signals() = default;
ProactiveNudgeTracker::Signals::Signals(Signals&&) = default;
ProactiveNudgeTracker::Signals& ProactiveNudgeTracker::Signals::operator=(
Signals&&) = default;
class ProactiveNudgeTracker::EngagementTracker { … };
ProactiveNudgeTracker::State::State() = default;
ProactiveNudgeTracker::State::~State() = default;
float ProactiveNudgeTracker::Delegate::SegmentationFallbackShowResult() { … }
float ProactiveNudgeTracker::Delegate::SegmentationForceShowResult() { … }
ProactiveNudgeTracker::ProactiveNudgeTracker(
segmentation_platform::SegmentationPlatformService* segmentation_service,
Delegate* delegate)
: … { … }
void ProactiveNudgeTracker::StartObserving(content::WebContents* web_contents) { … }
ProactiveNudgeTracker::~ProactiveNudgeTracker() { … }
bool ProactiveNudgeTracker::ProactiveNudgeRequestedForFormField(
Signals signals) { … }
bool ProactiveNudgeTracker::IsTimerRunning() { … }
void ProactiveNudgeTracker::FocusChangedInPage() { … }
void ProactiveNudgeTracker::Clear() { … }
void ProactiveNudgeTracker::OnAfterFocusOnFormField(
autofill::AutofillManager& manager,
autofill::FormGlobalId form,
autofill::FieldGlobalId field) { … }
void ProactiveNudgeTracker::OnAfterTextFieldDidChange(
autofill::AutofillManager& manager,
autofill::FormGlobalId form,
autofill::FieldGlobalId field,
const std::u16string& text_value) { … }
void ProactiveNudgeTracker::OnAfterCaretMovedInFormField(
autofill::AutofillManager& manager,
const autofill::FormGlobalId& form,
const autofill::FieldGlobalId& field,
const std::u16string& selection,
const gfx::Rect& caret_bounds) { … }
bool ProactiveNudgeTracker::SegmentationStateIsValid() { … }
void ProactiveNudgeTracker::ResetState() { … }
void ProactiveNudgeTracker::UpdateStateForCurrentFormField() { … }
std::optional<ProactiveNudgeTracker::ShowState>
ProactiveNudgeTracker::CheckForStateTransition() { … }
void ProactiveNudgeTracker::TransitionToState(ShowState new_show_state) { … }
void ProactiveNudgeTracker::BeginWaitingForTimerToStop() { … }
bool ProactiveNudgeTracker::CanStartFocusTimer() { … }
bool ProactiveNudgeTracker::CanStartTextSettledTimer() { … }
bool ProactiveNudgeTracker::CanStartSelectionTimer() { … }
void ProactiveNudgeTracker::StartOrRestartTimer() { … }
void ProactiveNudgeTracker::BeginTimerCanceled() { … }
void ProactiveNudgeTracker::BeginSegmentation() { … }
void ProactiveNudgeTracker::BeginWaitingForProactiveNudgeRequest() { … }
void ProactiveNudgeTracker::BeginBlockedBySegmentation() { … }
void ProactiveNudgeTracker::BeginShown() { … }
void ProactiveNudgeTracker::ShowTimerElapsed() { … }
void ProactiveNudgeTracker::GotClassificationResult(
const segmentation_platform::ClassificationResult& result) { … }
void ProactiveNudgeTracker::CollectTrainingData(
const segmentation_platform::TrainingRequestId training_request_id,
ProactiveNudgeDerivedEngagement engagement) { … }
bool ProactiveNudgeTracker::MatchesCurrentField(autofill::FormGlobalId form,
autofill::FieldGlobalId field) { … }
void ProactiveNudgeTracker::ComposeSessionCompleted(
autofill::FieldGlobalId field_global_id,
ComposeSessionCloseReason session_close_reason,
const compose::ComposeSessionEvents& events) { … }
void ProactiveNudgeTracker::OnUserDisabledNudge(bool single_site_only) { … }
std::optional<bool> ProactiveNudgeTracker::CachedSegmentationResult() { … }
}