1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
// 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/autofill/core/browser/metrics/log_event.h"
#include <variant>
#include "base/notreached.h"
namespace autofill {
FillEventId GetNextFillEventId() {
static FillEventId::Generator fill_event_id_generator;
return fill_event_id_generator.GenerateNextId();
}
OptionalBoolean& operator|=(OptionalBoolean& a, OptionalBoolean b) {
if (b == OptionalBoolean::kTrue || a == OptionalBoolean::kUndefined) {
a = b;
}
return a;
}
OptionalBoolean ToOptionalBoolean(bool value) {
return static_cast<OptionalBoolean>(value);
}
bool OptionalBooleanToBool(OptionalBoolean value) {
switch (value) {
case OptionalBoolean::kFalse:
return false;
case OptionalBoolean::kTrue:
return true;
case OptionalBoolean::kUndefined:
NOTREACHED();
}
NOTREACHED();
}
bool AreCollapsible(const std::monostate& event1,
const std::monostate& event2) {
return true;
}
bool AreCollapsible(const AskForValuesToFillFieldLogEvent& event1,
const AskForValuesToFillFieldLogEvent& event2) {
return event1.has_suggestion == event2.has_suggestion &&
event1.suggestion_is_shown == event2.suggestion_is_shown;
}
bool AreCollapsible(const TriggerFillFieldLogEvent& event1,
const TriggerFillFieldLogEvent& event2) {
return event1.fill_event_id == event2.fill_event_id;
}
bool AreCollapsible(const FillFieldLogEvent& event1,
const FillFieldLogEvent& event2) {
return event1.fill_event_id == event2.fill_event_id &&
event1.had_value_before_filling == event2.had_value_before_filling &&
event1.autofill_skipped_status == event2.autofill_skipped_status &&
event1.was_autofilled_before_security_policy ==
event2.was_autofilled_before_security_policy &&
event1.had_value_after_filling == event2.had_value_after_filling &&
event1.filling_prevented_by_iframe_security_policy ==
event2.filling_prevented_by_iframe_security_policy &&
event1.was_refill == event2.was_refill;
}
bool AreCollapsible(const TypingFieldLogEvent& event1,
const TypingFieldLogEvent& event2) {
return event1.has_value_after_typing == event2.has_value_after_typing;
}
bool AreCollapsible(const HeuristicPredictionFieldLogEvent& event1,
const HeuristicPredictionFieldLogEvent& event2) {
return event1.field_type == event2.field_type &&
event1.heuristic_source == event2.heuristic_source &&
event1.is_active_heuristic_source ==
event2.is_active_heuristic_source &&
event1.rank_in_field_signature_group ==
event2.rank_in_field_signature_group;
}
bool AreCollapsible(const AutocompleteAttributeFieldLogEvent& event1,
const AutocompleteAttributeFieldLogEvent& event2) {
return event1.html_type == event2.html_type &&
event1.html_mode == event2.html_mode &&
event1.rank_in_field_signature_group ==
event2.rank_in_field_signature_group;
}
bool AreCollapsible(const ServerPredictionFieldLogEvent& event1,
const ServerPredictionFieldLogEvent& event2) {
return event1.server_type1 == event2.server_type1 &&
event1.prediction_source1 == event2.prediction_source1 &&
event1.server_type2 == event2.server_type2 &&
event1.prediction_source2 == event2.prediction_source2 &&
event1.server_type_prediction_is_override ==
event2.server_type_prediction_is_override &&
event1.rank_in_field_signature_group ==
event2.rank_in_field_signature_group;
}
bool AreCollapsible(const RationalizationFieldLogEvent& event1,
const RationalizationFieldLogEvent& event2) {
return event1.field_type == event2.field_type &&
event1.section_id == event2.section_id &&
event1.type_changed == event2.type_changed;
}
bool AreCollapsible(const AblationFieldLogEvent& event1,
const AblationFieldLogEvent& event2) {
return event1.ablation_group == event2.ablation_group &&
event1.conditional_ablation_group ==
event2.conditional_ablation_group &&
event1.day_in_ablation_window == event2.day_in_ablation_window;
}
} // namespace autofill
|