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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
|
// Copyright 2018 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/foundations/autofill_client.h"
#include <optional>
#include <utility>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/filling/filling_product.h"
#include "components/autofill/core/browser/integrators/autofill_ai/autofill_ai_delegate.h"
#include "components/autofill/core/browser/integrators/compose/autofill_compose_delegate.h"
#include "components/autofill/core/browser/integrators/identity_credential/identity_credential_delegate.h"
#include "components/autofill/core/browser/integrators/password_manager/password_manager_delegate.h"
#include "components/autofill/core/browser/integrators/plus_addresses/autofill_plus_address_delegate.h"
#include "components/autofill/core/browser/payments/credit_card_access_manager.h"
#include "components/autofill/core/browser/studies/autofill_ablation_study.h"
#include "components/autofill/core/browser/suggestions/suggestion.h"
#include "components/autofill/core/browser/ui/popup_open_enums.h"
#include "components/optimization_guide/proto/features/common_quality_data.pb.h"
#include "components/version_info/channel.h"
namespace autofill {
AutofillClient::PopupOpenArgs::PopupOpenArgs() = default;
AutofillClient::PopupOpenArgs::PopupOpenArgs(
const gfx::RectF& element_bounds,
base::i18n::TextDirection text_direction,
std::vector<Suggestion> suggestions,
AutofillSuggestionTriggerSource trigger_source,
int32_t form_control_ax_id,
PopupAnchorType anchor_type)
: element_bounds(element_bounds),
text_direction(text_direction),
suggestions(std::move(suggestions)),
trigger_source(trigger_source),
form_control_ax_id(form_control_ax_id),
anchor_type(anchor_type) {}
AutofillClient::PopupOpenArgs::PopupOpenArgs(
const AutofillClient::PopupOpenArgs&) = default;
AutofillClient::PopupOpenArgs::PopupOpenArgs(AutofillClient::PopupOpenArgs&&) =
default;
AutofillClient::PopupOpenArgs::~PopupOpenArgs() = default;
AutofillClient::PopupOpenArgs& AutofillClient::PopupOpenArgs::operator=(
const AutofillClient::PopupOpenArgs&) = default;
AutofillClient::PopupOpenArgs& AutofillClient::PopupOpenArgs::operator=(
AutofillClient::PopupOpenArgs&&) = default;
version_info::Channel AutofillClient::GetChannel() const {
return version_info::Channel::UNKNOWN;
}
bool AutofillClient::IsOffTheRecord() const {
return false;
}
const EntityDataManager* AutofillClient::GetEntityDataManager() const {
return const_cast<AutofillClient*>(this)->GetEntityDataManager();
}
const PersonalDataManager& AutofillClient::GetPersonalDataManager() const {
return const_cast<AutofillClient*>(this)->GetPersonalDataManager();
}
const ValuablesDataManager* AutofillClient::GetValuablesDataManager() const {
return const_cast<AutofillClient*>(this)->GetValuablesDataManager();
}
AutofillOptimizationGuide* AutofillClient::GetAutofillOptimizationGuide()
const {
return nullptr;
}
FieldClassificationModelHandler*
AutofillClient::GetAutofillFieldClassificationModelHandler() {
return nullptr;
}
FieldClassificationModelHandler*
AutofillClient::GetPasswordManagerFieldClassificationModelHandler() {
return nullptr;
}
AutofillComposeDelegate* AutofillClient::GetComposeDelegate() {
return nullptr;
}
AutofillPlusAddressDelegate* AutofillClient::GetPlusAddressDelegate() {
return nullptr;
}
PasswordManagerDelegate* AutofillClient::GetPasswordManagerDelegate(
const FieldGlobalId& field_id) {
return nullptr;
}
void AutofillClient::GetAiPageContent(GetAiPageContentCallback callback) {
std::move(callback).Run(std::nullopt);
}
AutofillAiDelegate* AutofillClient::GetAutofillAiDelegate() {
return nullptr;
}
AutofillAiModelCache* AutofillClient::GetAutofillAiModelCache() {
return nullptr;
}
AutofillAiModelExecutor* AutofillClient::GetAutofillAiModelExecutor() {
return nullptr;
}
IdentityCredentialDelegate* AutofillClient::GetIdentityCredentialDelegate() {
return nullptr;
}
void AutofillClient::OfferPlusAddressCreation(
const url::Origin& main_frame_origin,
bool is_manual_fallback,
PlusAddressCallback callback) {}
void AutofillClient::ShowPlusAddressError(
PlusAddressErrorDialogType error_dialog_type,
base::OnceClosure on_accepted) {}
void AutofillClient::ShowPlusAddressAffiliationError(
std::u16string affiliated_domain,
std::u16string affiliated_plus_address,
base::OnceClosure on_accepted) {}
const GoogleGroupsManager* AutofillClient::GetGoogleGroupsManager() const {
return nullptr;
}
payments::PaymentsAutofillClient* AutofillClient::GetPaymentsAutofillClient() {
return nullptr;
}
const payments::PaymentsAutofillClient*
AutofillClient::GetPaymentsAutofillClient() const {
// Gets a pointer to a non-const implementation of
// payments::PaymentsAutofillClient for the given platform this is called on,
// which is then converted to a pointer to a const implementation. The
// implementation returned will already be an existing object that is created
// when the given implementation of AutofillClient is created. If there is no
// payments::PaymentsAutofillClient for a given platform this will return
// nullptr.
return const_cast<AutofillClient*>(this)->GetPaymentsAutofillClient();
}
GeoIpCountryCode AutofillClient::GetVariationConfigCountryCode() const {
return GeoIpCountryCode(std::string());
}
profile_metrics::BrowserProfileType AutofillClient::GetProfileType() const {
// This is an abstract interface and thus never instantiated directly,
// therefore it is safe to always return |kRegular| here.
return profile_metrics::BrowserProfileType::kRegular;
}
FastCheckoutClient* AutofillClient::GetFastCheckoutClient() {
return nullptr;
}
LogManager* AutofillClient::GetCurrentLogManager() {
return nullptr;
}
bool AutofillClient::ShouldFormatForLargeKeyboardAccessory() const {
return false;
}
const AutofillAblationStudy& AutofillClient::GetAblationStudy() const {
return AutofillAblationStudy::disabled_study();
}
#if BUILDFLAG(IS_ANDROID)
AutofillSnackbarControllerImpl*
AutofillClient::GetAutofillSnackbarController() {
return nullptr;
}
#endif
void AutofillClient::TriggerUserPerceptionOfAutofillSurvey(
FillingProduct filling_product,
const std::map<std::string, std::string>& field_filling_stats_data) {
NOTIMPLEMENTED();
}
std::unique_ptr<device_reauth::DeviceAuthenticator>
AutofillClient::GetDeviceAuthenticator() {
return nullptr;
}
void AutofillClient::ShowPlusAddressEmailOverrideNotification(
const std::string& original_email,
EmailOverrideUndoCallback email_override_undo_callback) {}
bool AutofillClient::ShowAutofillFieldIphForFeature(
const FormFieldData&,
AutofillClient::IphFeature feature) {
return false;
}
void AutofillClient::HideAutofillFieldIph() {}
void AutofillClient::NotifyIphFeatureUsed(AutofillClient::IphFeature feature) {}
std::optional<AutofillClient::PopupScreenLocation>
AutofillClient::GetPopupScreenLocation() const {
NOTIMPLEMENTED();
return std::nullopt;
}
std::optional<AutofillClient::SuggestionUiSessionId>
AutofillClient::GetSessionIdForCurrentAutofillSuggestions() const {
return std::nullopt;
}
base::span<const Suggestion> AutofillClient::GetAutofillSuggestions() const {
NOTIMPLEMENTED();
return {};
}
void AutofillClient::UpdateAutofillSuggestions(
const std::vector<Suggestion>& suggestions,
FillingProduct main_filling_product,
AutofillSuggestionTriggerSource trigger_source) {
NOTIMPLEMENTED();
}
void AutofillClient::set_test_addresses(
std::vector<AutofillProfile> test_addresses) {}
base::span<const AutofillProfile> AutofillClient::GetTestAddresses() const {
return {};
}
PasswordFormClassification AutofillClient::ClassifyAsPasswordForm(
AutofillManager& manager,
FormGlobalId form_id,
FieldGlobalId field_id) const {
return {};
}
void AutofillClient::TriggerPlusAddressUserPerceptionSurvey(
plus_addresses::hats::SurveyType survey_type) {}
const syncer::SyncService* AutofillClient::GetSyncService() const {
return const_cast<const syncer::SyncService*>(
const_cast<AutofillClient*>(this)->GetSyncService());
}
} // namespace autofill
|