autofill_client_impl.cc 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "weblayer/browser/autofill_client_impl.h"
  5. #include "build/build_config.h"
  6. #include "components/autofill/core/browser/data_model/autofill_profile.h"
  7. #include "components/autofill/core/browser/ui/suggestion.h"
  8. #include "content/public/browser/navigation_entry.h"
  9. #include "content/public/browser/ssl_status.h"
  10. #include "content/public/browser/web_contents.h"
  11. #include "services/metrics/public/cpp/ukm_recorder.h"
  12. #include "weblayer/browser/translate_client_impl.h"
  13. namespace weblayer {
  14. AutofillClientImpl::~AutofillClientImpl() = default;
  15. autofill::PersonalDataManager* AutofillClientImpl::GetPersonalDataManager() {
  16. NOTREACHED();
  17. return nullptr;
  18. }
  19. autofill::AutocompleteHistoryManager*
  20. AutofillClientImpl::GetAutocompleteHistoryManager() {
  21. NOTREACHED();
  22. return nullptr;
  23. }
  24. PrefService* AutofillClientImpl::GetPrefs() {
  25. return const_cast<PrefService*>(base::as_const(*this).GetPrefs());
  26. }
  27. const PrefService* AutofillClientImpl::GetPrefs() const {
  28. NOTREACHED();
  29. return nullptr;
  30. }
  31. syncer::SyncService* AutofillClientImpl::GetSyncService() {
  32. NOTREACHED();
  33. return nullptr;
  34. }
  35. signin::IdentityManager* AutofillClientImpl::GetIdentityManager() {
  36. NOTREACHED();
  37. return nullptr;
  38. }
  39. autofill::FormDataImporter* AutofillClientImpl::GetFormDataImporter() {
  40. NOTREACHED();
  41. return nullptr;
  42. }
  43. autofill::payments::PaymentsClient* AutofillClientImpl::GetPaymentsClient() {
  44. NOTREACHED();
  45. return nullptr;
  46. }
  47. autofill::StrikeDatabase* AutofillClientImpl::GetStrikeDatabase() {
  48. NOTREACHED();
  49. return nullptr;
  50. }
  51. ukm::UkmRecorder* AutofillClientImpl::GetUkmRecorder() {
  52. // TODO(crbug.com/1181141): Enable the autofill UKM.
  53. return nullptr;
  54. }
  55. ukm::SourceId AutofillClientImpl::GetUkmSourceId() {
  56. // TODO(crbug.com/1181141): Enable the autofill UKM.
  57. return ukm::kInvalidSourceId;
  58. }
  59. autofill::AddressNormalizer* AutofillClientImpl::GetAddressNormalizer() {
  60. NOTREACHED();
  61. return nullptr;
  62. }
  63. const GURL& AutofillClientImpl::GetLastCommittedURL() const {
  64. NOTREACHED();
  65. return GURL::EmptyGURL();
  66. }
  67. security_state::SecurityLevel
  68. AutofillClientImpl::GetSecurityLevelForUmaHistograms() {
  69. NOTREACHED();
  70. return security_state::SecurityLevel::SECURITY_LEVEL_COUNT;
  71. }
  72. const translate::LanguageState* AutofillClientImpl::GetLanguageState() {
  73. return nullptr;
  74. }
  75. translate::TranslateDriver* AutofillClientImpl::GetTranslateDriver() {
  76. // The TranslateDriver is used by AutofillManager to observe the page language
  77. // and run the type-prediction heuristics with language-dependent regexps.
  78. auto* translate_client = TranslateClientImpl::FromWebContents(web_contents());
  79. if (translate_client)
  80. return translate_client->translate_driver();
  81. return nullptr;
  82. }
  83. void AutofillClientImpl::ShowAutofillSettings(bool show_credit_card_settings) {
  84. NOTREACHED();
  85. }
  86. void AutofillClientImpl::ShowUnmaskPrompt(
  87. const autofill::CreditCard& card,
  88. UnmaskCardReason reason,
  89. base::WeakPtr<autofill::CardUnmaskDelegate> delegate) {
  90. NOTREACHED();
  91. }
  92. void AutofillClientImpl::OnUnmaskVerificationResult(PaymentsRpcResult result) {
  93. NOTREACHED();
  94. }
  95. #if !BUILDFLAG(IS_ANDROID)
  96. std::vector<std::string>
  97. AutofillClientImpl::GetAllowedMerchantsForVirtualCards() {
  98. NOTREACHED();
  99. return std::vector<std::string>();
  100. }
  101. std::vector<std::string>
  102. AutofillClientImpl::GetAllowedBinRangesForVirtualCards() {
  103. NOTREACHED();
  104. return std::vector<std::string>();
  105. }
  106. void AutofillClientImpl::ShowLocalCardMigrationDialog(
  107. base::OnceClosure show_migration_dialog_closure) {
  108. NOTREACHED();
  109. }
  110. void AutofillClientImpl::ConfirmMigrateLocalCardToCloud(
  111. const autofill::LegalMessageLines& legal_message_lines,
  112. const std::string& user_email,
  113. const std::vector<autofill::MigratableCreditCard>& migratable_credit_cards,
  114. LocalCardMigrationCallback start_migrating_cards_callback) {
  115. NOTREACHED();
  116. }
  117. void AutofillClientImpl::ShowLocalCardMigrationResults(
  118. const bool has_server_error,
  119. const std::u16string& tip_message,
  120. const std::vector<autofill::MigratableCreditCard>& migratable_credit_cards,
  121. MigrationDeleteCardCallback delete_local_card_callback) {
  122. NOTREACHED();
  123. }
  124. void AutofillClientImpl::ShowWebauthnOfferDialog(
  125. WebauthnDialogCallback offer_dialog_callback) {
  126. NOTREACHED();
  127. }
  128. void AutofillClientImpl::ShowWebauthnVerifyPendingDialog(
  129. WebauthnDialogCallback verify_pending_dialog_callback) {
  130. NOTREACHED();
  131. }
  132. void AutofillClientImpl::UpdateWebauthnOfferDialogWithError() {
  133. NOTREACHED();
  134. }
  135. bool AutofillClientImpl::CloseWebauthnDialog() {
  136. NOTREACHED();
  137. return false;
  138. }
  139. void AutofillClientImpl::ConfirmSaveUpiIdLocally(
  140. const std::string& upi_id,
  141. base::OnceCallback<void(bool user_decision)> callback) {
  142. NOTREACHED();
  143. }
  144. void AutofillClientImpl::OfferVirtualCardOptions(
  145. const std::vector<autofill::CreditCard*>& candidates,
  146. base::OnceCallback<void(const std::string&)> callback) {
  147. NOTREACHED();
  148. }
  149. #else // !BUILDFLAG(IS_ANDROID)
  150. void AutofillClientImpl::ConfirmAccountNameFixFlow(
  151. base::OnceCallback<void(const std::u16string&)> callback) {
  152. NOTREACHED();
  153. }
  154. void AutofillClientImpl::ConfirmExpirationDateFixFlow(
  155. const autofill::CreditCard& card,
  156. base::OnceCallback<void(const std::u16string&, const std::u16string&)>
  157. callback) {
  158. NOTREACHED();
  159. }
  160. #endif
  161. void AutofillClientImpl::ConfirmSaveCreditCardLocally(
  162. const autofill::CreditCard& card,
  163. SaveCreditCardOptions options,
  164. LocalSaveCardPromptCallback callback) {
  165. NOTREACHED();
  166. }
  167. void AutofillClientImpl::ConfirmSaveCreditCardToCloud(
  168. const autofill::CreditCard& card,
  169. const autofill::LegalMessageLines& legal_message_lines,
  170. SaveCreditCardOptions options,
  171. UploadSaveCardPromptCallback callback) {
  172. NOTREACHED();
  173. }
  174. void AutofillClientImpl::CreditCardUploadCompleted(bool card_saved) {
  175. NOTREACHED();
  176. }
  177. void AutofillClientImpl::ConfirmCreditCardFillAssist(
  178. const autofill::CreditCard& card,
  179. base::OnceClosure callback) {
  180. NOTREACHED();
  181. }
  182. void AutofillClientImpl::ConfirmSaveAddressProfile(
  183. const autofill::AutofillProfile& profile,
  184. const autofill::AutofillProfile* original_profile,
  185. SaveAddressProfilePromptOptions options,
  186. AddressProfileSavePromptCallback callback) {
  187. NOTREACHED();
  188. }
  189. bool AutofillClientImpl::HasCreditCardScanFeature() {
  190. NOTREACHED();
  191. return false;
  192. }
  193. void AutofillClientImpl::ScanCreditCard(CreditCardScanCallback callback) {
  194. NOTREACHED();
  195. }
  196. bool AutofillClientImpl::IsTouchToFillCreditCardSupported() {
  197. return false;
  198. }
  199. bool AutofillClientImpl::ShowTouchToFillCreditCard(
  200. base::WeakPtr<autofill::TouchToFillDelegate> delegate) {
  201. NOTREACHED();
  202. return false;
  203. }
  204. void AutofillClientImpl::HideTouchToFillCreditCard() {
  205. NOTREACHED();
  206. }
  207. void AutofillClientImpl::ShowAutofillPopup(
  208. const autofill::AutofillClient::PopupOpenArgs& open_args,
  209. base::WeakPtr<autofill::AutofillPopupDelegate> delegate) {
  210. NOTREACHED();
  211. }
  212. void AutofillClientImpl::UpdateAutofillPopupDataListValues(
  213. const std::vector<std::u16string>& values,
  214. const std::vector<std::u16string>& labels) {
  215. NOTREACHED();
  216. }
  217. void AutofillClientImpl::HideAutofillPopup(autofill::PopupHidingReason reason) {
  218. // This is invoked on the user moving away from an autofill context (e.g., a
  219. // navigation finishing or a tab being hidden). As all showing/hiding of
  220. // autofill UI in WebLayer is driven by the system, there is no action to
  221. // take.
  222. }
  223. base::span<const autofill::Suggestion> AutofillClientImpl::GetPopupSuggestions()
  224. const {
  225. NOTIMPLEMENTED();
  226. return base::span<const autofill::Suggestion>();
  227. }
  228. void AutofillClientImpl::PinPopupView() {
  229. NOTIMPLEMENTED();
  230. }
  231. autofill::AutofillClient::PopupOpenArgs AutofillClientImpl::GetReopenPopupArgs()
  232. const {
  233. NOTIMPLEMENTED();
  234. return {};
  235. }
  236. void AutofillClientImpl::UpdatePopup(
  237. const std::vector<autofill::Suggestion>& suggestions,
  238. autofill::PopupType popup_type) {
  239. NOTREACHED();
  240. }
  241. bool AutofillClientImpl::IsAutocompleteEnabled() {
  242. NOTREACHED();
  243. return false;
  244. }
  245. bool AutofillClientImpl::IsPasswordManagerEnabled() {
  246. // This function is currently only used by the BrowserAutofillManager,
  247. // but not by the AndroidAutofillManager. See crbug.com/1293341 for context.
  248. NOTREACHED();
  249. return false;
  250. }
  251. void AutofillClientImpl::PropagateAutofillPredictions(
  252. autofill::AutofillDriver* driver,
  253. const std::vector<autofill::FormStructure*>& forms) {
  254. NOTREACHED();
  255. }
  256. void AutofillClientImpl::DidFillOrPreviewField(
  257. const std::u16string& autofilled_value,
  258. const std::u16string& profile_full_name) {
  259. NOTREACHED();
  260. }
  261. bool AutofillClientImpl::IsContextSecure() const {
  262. NOTREACHED();
  263. return false;
  264. }
  265. bool AutofillClientImpl::ShouldShowSigninPromo() {
  266. NOTREACHED();
  267. return false;
  268. }
  269. bool AutofillClientImpl::AreServerCardsSupported() const {
  270. NOTREACHED();
  271. return false;
  272. }
  273. void AutofillClientImpl::ExecuteCommand(int id) {
  274. NOTREACHED();
  275. }
  276. void AutofillClientImpl::OpenPromoCodeOfferDetailsURL(const GURL& url) {
  277. NOTREACHED();
  278. }
  279. void AutofillClientImpl::LoadRiskData(
  280. base::OnceCallback<void(const std::string&)> callback) {
  281. NOTREACHED();
  282. }
  283. AutofillClientImpl::AutofillClientImpl(content::WebContents* web_contents)
  284. : content::WebContentsUserData<AutofillClientImpl>(*web_contents),
  285. content::WebContentsObserver(web_contents) {}
  286. WEB_CONTENTS_USER_DATA_KEY_IMPL(AutofillClientImpl);
  287. } // namespace weblayer