#include "components/autofill/core/browser/autofill_driver_router.h"
#include <algorithm>
#include <functional>
#include "base/check_deref.h"
#include "base/containers/contains.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h"
#include "components/autofill/core/common/signatures.h"
#include "components/autofill/core/common/unique_ids.h"
namespace autofill {
namespace {
void ForEachFrame(internal::FormForest& form_forest,
base::FunctionRef<void(AutofillDriver&)> fun) { … }
}
AutofillDriverRouter::AutofillDriverRouter() = default;
AutofillDriverRouter::~AutofillDriverRouter() = default;
AutofillDriver* AutofillDriverRouter::DriverOfFrame(LocalFrameToken frame) { … }
void AutofillDriverRouter::UnregisterDriver(AutofillDriver& driver,
bool driver_is_dying) { … }
void AutofillDriverRouter::TriggerFormExtractionExcept(
AutofillDriver& exception) { … }
void AutofillDriverRouter::FormsSeen(
RoutedCallback<const std::vector<FormData>&,
const std::vector<FormGlobalId>&> callback,
AutofillDriver& source,
std::vector<FormData> renderer_forms,
const std::vector<FormGlobalId>& removed_forms) { … }
void AutofillDriverRouter::FormSubmitted(
RoutedCallback<const FormData&, bool, mojom::SubmissionSource> callback,
AutofillDriver& source,
FormData form,
bool known_success,
mojom::SubmissionSource submission_source) { … }
void AutofillDriverRouter::CaretMovedInFormField(
RoutedCallback<const FormData&, const FieldGlobalId&, const gfx::Rect&>
callback,
AutofillDriver& source,
FormData form,
const FieldGlobalId& field_id,
const gfx::Rect& caret_bounds) { … }
void AutofillDriverRouter::TextFieldDidChange(
RoutedCallback<const FormData&, const FieldGlobalId&, base::TimeTicks>
callback,
AutofillDriver& source,
FormData form,
const FieldGlobalId& field_id,
base::TimeTicks timestamp) { … }
void AutofillDriverRouter::TextFieldDidScroll(
RoutedCallback<const FormData&, const FieldGlobalId&> callback,
AutofillDriver& source,
FormData form,
const FieldGlobalId& field_id) { … }
void AutofillDriverRouter::SelectControlDidChange(
RoutedCallback<const FormData&, const FieldGlobalId&> callback,
AutofillDriver& source,
FormData form,
const FieldGlobalId& field_id) { … }
void AutofillDriverRouter::AskForValuesToFill(
RoutedCallback<const FormData&,
const FieldGlobalId&,
const gfx::Rect&,
AutofillSuggestionTriggerSource> callback,
AutofillDriver& source,
FormData form,
const FieldGlobalId& field_id,
const gfx::Rect& caret_bounds,
AutofillSuggestionTriggerSource trigger_source) { … }
void AutofillDriverRouter::HidePopup(RoutedCallback<> callback,
AutofillDriver& source) { … }
void AutofillDriverRouter::FocusOnNonFormField(RoutedCallback<> callback,
AutofillDriver& source) { … }
void AutofillDriverRouter::FocusOnFormField(
RoutedCallback<const FormData&, const FieldGlobalId&> callback,
AutofillDriver& source,
FormData form,
const FieldGlobalId& field_id,
RoutedCallback<> focus_no_longer_on_form) { … }
void AutofillDriverRouter::DidFillAutofillFormData(
RoutedCallback<const FormData&, base::TimeTicks> callback,
AutofillDriver& source,
FormData form,
base::TimeTicks timestamp) { … }
void AutofillDriverRouter::DidEndTextFieldEditing(RoutedCallback<> callback,
AutofillDriver& source) { … }
void AutofillDriverRouter::SelectOrSelectListFieldOptionsDidChange(
RoutedCallback<const FormData&> callback,
AutofillDriver& source,
FormData form) { … }
void AutofillDriverRouter::JavaScriptChangedAutofilledValue(
RoutedCallback<const FormData&,
const FieldGlobalId&,
const std::u16string&,
bool> callback,
AutofillDriver& source,
FormData form,
const FieldGlobalId& field_id,
const std::u16string& old_value,
bool formatting_only) { … }
base::flat_set<FieldGlobalId> AutofillDriverRouter::ApplyFormAction(
RoutedCallback<mojom::FormActionType,
mojom::ActionPersistence,
const std::vector<FormFieldData::FillData>&> callback,
mojom::FormActionType action_type,
mojom::ActionPersistence action_persistence,
base::span<const FormFieldData> data,
const url::Origin& main_origin,
const url::Origin& triggered_origin,
const base::flat_map<FieldGlobalId, FieldType>& field_type_map) { … }
void AutofillDriverRouter::ApplyFieldAction(
RoutedCallback<mojom::FieldActionType,
mojom::ActionPersistence,
FieldRendererId,
const std::u16string&> callback,
mojom::FieldActionType action_type,
mojom::ActionPersistence action_persistence,
const FieldGlobalId& field_id,
const std::u16string& value) { … }
void AutofillDriverRouter::ExtractForm(
RoutedCallback<FormRendererId, RendererFormHandler> callback,
FormGlobalId form_id,
BrowserFormHandler browser_form_handler) { … }
void AutofillDriverRouter::SendTypePredictionsToRenderer(
RoutedCallback<const std::vector<FormDataPredictions>&> callback,
const std::vector<FormDataPredictions>& browser_fdps) { … }
void AutofillDriverRouter::RendererShouldAcceptDataListSuggestion(
RoutedCallback<FieldRendererId, const std::u16string&> callback,
const FieldGlobalId& field_id,
const std::u16string& value) { … }
void AutofillDriverRouter::RendererShouldClearPreviewedForm(
RoutedCallback<> callback) { … }
void AutofillDriverRouter::RendererShouldTriggerSuggestions(
RoutedCallback<FieldRendererId, AutofillSuggestionTriggerSource> callback,
const FieldGlobalId& field_id,
AutofillSuggestionTriggerSource trigger_source) { … }
void AutofillDriverRouter::RendererShouldSetSuggestionAvailability(
RoutedCallback<FieldRendererId, mojom::AutofillSuggestionAvailability>
callback,
const FieldGlobalId& field_id,
mojom::AutofillSuggestionAvailability suggestion_availability) { … }
std::vector<FormData> AutofillDriverRouter::GetRendererForms(
const FormData& browser_form) const { … }
}