OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 client_(client), | 223 client_(client), |
224 payments_client_(base::MakeUnique<payments::PaymentsClient>( | 224 payments_client_(base::MakeUnique<payments::PaymentsClient>( |
225 driver->GetURLRequestContext(), | 225 driver->GetURLRequestContext(), |
226 this)), | 226 this)), |
227 app_locale_(app_locale), | 227 app_locale_(app_locale), |
228 personal_data_(client->GetPersonalDataManager()), | 228 personal_data_(client->GetPersonalDataManager()), |
229 autocomplete_history_manager_( | 229 autocomplete_history_manager_( |
230 base::MakeUnique<AutocompleteHistoryManager>(driver, client)), | 230 base::MakeUnique<AutocompleteHistoryManager>(driver, client)), |
231 form_interactions_ukm_logger_( | 231 form_interactions_ukm_logger_( |
232 base::MakeUnique<AutofillMetrics::FormInteractionsUkmLogger>( | 232 base::MakeUnique<AutofillMetrics::FormInteractionsUkmLogger>( |
233 client->GetUkmService())), | 233 client->GetUkmRecorder())), |
234 address_form_event_logger_( | 234 address_form_event_logger_( |
235 base::MakeUnique<AutofillMetrics::FormEventLogger>( | 235 base::MakeUnique<AutofillMetrics::FormEventLogger>( |
236 false /* is_for_credit_card */, | 236 false /* is_for_credit_card */, |
237 form_interactions_ukm_logger_.get())), | 237 form_interactions_ukm_logger_.get())), |
238 credit_card_form_event_logger_( | 238 credit_card_form_event_logger_( |
239 base::MakeUnique<AutofillMetrics::FormEventLogger>( | 239 base::MakeUnique<AutofillMetrics::FormEventLogger>( |
240 true /* is_for_credit_card */, | 240 true /* is_for_credit_card */, |
241 form_interactions_ukm_logger_.get())), | 241 form_interactions_ukm_logger_.get())), |
242 has_logged_autofill_enabled_(false), | 242 has_logged_autofill_enabled_(false), |
243 has_logged_address_suggestions_count_(false), | 243 has_logged_address_suggestions_count_(false), |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 std::string() /* login_form_signature */, observed_submission); | 1530 std::string() /* login_form_signature */, observed_submission); |
1531 } | 1531 } |
1532 | 1532 |
1533 void AutofillManager::Reset() { | 1533 void AutofillManager::Reset() { |
1534 // Note that upload_request_ is not reset here because the prompt to | 1534 // Note that upload_request_ is not reset here because the prompt to |
1535 // save a card is shown after page navigation. | 1535 // save a card is shown after page navigation. |
1536 ProcessPendingFormForUpload(); | 1536 ProcessPendingFormForUpload(); |
1537 DCHECK(!pending_form_data_); | 1537 DCHECK(!pending_form_data_); |
1538 form_structures_.clear(); | 1538 form_structures_.clear(); |
1539 form_interactions_ukm_logger_.reset( | 1539 form_interactions_ukm_logger_.reset( |
1540 new AutofillMetrics::FormInteractionsUkmLogger(client_->GetUkmService())); | 1540 new AutofillMetrics::FormInteractionsUkmLogger( |
| 1541 client_->GetUkmRecorder())); |
1541 address_form_event_logger_.reset(new AutofillMetrics::FormEventLogger( | 1542 address_form_event_logger_.reset(new AutofillMetrics::FormEventLogger( |
1542 false /* is_for_credit_card */, form_interactions_ukm_logger_.get())); | 1543 false /* is_for_credit_card */, form_interactions_ukm_logger_.get())); |
1543 credit_card_form_event_logger_.reset(new AutofillMetrics::FormEventLogger( | 1544 credit_card_form_event_logger_.reset(new AutofillMetrics::FormEventLogger( |
1544 true /* is_for_credit_card */, form_interactions_ukm_logger_.get())); | 1545 true /* is_for_credit_card */, form_interactions_ukm_logger_.get())); |
1545 #if defined(OS_ANDROID) || defined(OS_IOS) | 1546 #if defined(OS_ANDROID) || defined(OS_IOS) |
1546 autofill_assistant_.Reset(); | 1547 autofill_assistant_.Reset(); |
1547 #endif | 1548 #endif |
1548 has_logged_autofill_enabled_ = false; | 1549 has_logged_autofill_enabled_ = false; |
1549 has_logged_address_suggestions_count_ = false; | 1550 has_logged_address_suggestions_count_ = false; |
1550 did_show_suggestions_ = false; | 1551 did_show_suggestions_ = false; |
(...skipping 16 matching lines...) Expand all Loading... |
1567 client_(client), | 1568 client_(client), |
1568 payments_client_(base::MakeUnique<payments::PaymentsClient>( | 1569 payments_client_(base::MakeUnique<payments::PaymentsClient>( |
1569 driver->GetURLRequestContext(), | 1570 driver->GetURLRequestContext(), |
1570 this)), | 1571 this)), |
1571 app_locale_("en-US"), | 1572 app_locale_("en-US"), |
1572 personal_data_(personal_data), | 1573 personal_data_(personal_data), |
1573 autocomplete_history_manager_( | 1574 autocomplete_history_manager_( |
1574 base::MakeUnique<AutocompleteHistoryManager>(driver, client)), | 1575 base::MakeUnique<AutocompleteHistoryManager>(driver, client)), |
1575 form_interactions_ukm_logger_( | 1576 form_interactions_ukm_logger_( |
1576 base::MakeUnique<AutofillMetrics::FormInteractionsUkmLogger>( | 1577 base::MakeUnique<AutofillMetrics::FormInteractionsUkmLogger>( |
1577 client->GetUkmService())), | 1578 client->GetUkmRecorder())), |
1578 address_form_event_logger_( | 1579 address_form_event_logger_( |
1579 base::MakeUnique<AutofillMetrics::FormEventLogger>( | 1580 base::MakeUnique<AutofillMetrics::FormEventLogger>( |
1580 false /* is_for_credit_card */, | 1581 false /* is_for_credit_card */, |
1581 form_interactions_ukm_logger_.get())), | 1582 form_interactions_ukm_logger_.get())), |
1582 credit_card_form_event_logger_( | 1583 credit_card_form_event_logger_( |
1583 base::MakeUnique<AutofillMetrics::FormEventLogger>( | 1584 base::MakeUnique<AutofillMetrics::FormEventLogger>( |
1584 true /* is_for_credit_card */, | 1585 true /* is_for_credit_card */, |
1585 form_interactions_ukm_logger_.get())), | 1586 form_interactions_ukm_logger_.get())), |
1586 has_logged_autofill_enabled_(false), | 1587 has_logged_autofill_enabled_(false), |
1587 has_logged_address_suggestions_count_(false), | 1588 has_logged_address_suggestions_count_(false), |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 auto form_structure = base::MakeUnique<FormStructure>(form); | 2053 auto form_structure = base::MakeUnique<FormStructure>(form); |
2053 form_structure->ParseFieldTypesFromAutocompleteAttributes(); | 2054 form_structure->ParseFieldTypesFromAutocompleteAttributes(); |
2054 if (!form_structure->ShouldBeParsed()) | 2055 if (!form_structure->ShouldBeParsed()) |
2055 return false; | 2056 return false; |
2056 | 2057 |
2057 // Ownership is transferred to |form_structures_| which maintains it until | 2058 // Ownership is transferred to |form_structures_| which maintains it until |
2058 // the manager is Reset() or destroyed. It is safe to use references below | 2059 // the manager is Reset() or destroyed. It is safe to use references below |
2059 // as long as receivers don't take ownership. | 2060 // as long as receivers don't take ownership. |
2060 form_structures_.push_back(std::move(form_structure)); | 2061 form_structures_.push_back(std::move(form_structure)); |
2061 *parsed_form_structure = form_structures_.back().get(); | 2062 *parsed_form_structure = form_structures_.back().get(); |
2062 (*parsed_form_structure)->DetermineHeuristicTypes(client_->GetUkmService()); | 2063 (*parsed_form_structure)->DetermineHeuristicTypes(client_->GetUkmRecorder()); |
2063 return true; | 2064 return true; |
2064 } | 2065 } |
2065 | 2066 |
2066 int AutofillManager::BackendIDToInt(const std::string& backend_id) const { | 2067 int AutofillManager::BackendIDToInt(const std::string& backend_id) const { |
2067 if (!base::IsValidGUID(backend_id)) | 2068 if (!base::IsValidGUID(backend_id)) |
2068 return 0; | 2069 return 0; |
2069 | 2070 |
2070 const auto found = backend_to_int_map_.find(backend_id); | 2071 const auto found = backend_to_int_map_.find(backend_id); |
2071 if (found == backend_to_int_map_.end()) { | 2072 if (found == backend_to_int_map_.end()) { |
2072 // Unknown one, make a new entry. | 2073 // Unknown one, make a new entry. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 fputs("Next oldest form:\n", file); | 2328 fputs("Next oldest form:\n", file); |
2328 } | 2329 } |
2329 fputs("\n", file); | 2330 fputs("\n", file); |
2330 | 2331 |
2331 fclose(file); | 2332 fclose(file); |
2332 } | 2333 } |
2333 #endif // ENABLE_FORM_DEBUG_DUMP | 2334 #endif // ENABLE_FORM_DEBUG_DUMP |
2334 | 2335 |
2335 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) { | 2336 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) { |
2336 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics); | 2337 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics); |
2337 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmService(), | 2338 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmRecorder(), |
2338 pending_upload_request_url_, | 2339 pending_upload_request_url_, |
2339 upload_decision_metrics); | 2340 upload_decision_metrics); |
2340 } | 2341 } |
2341 | 2342 |
2342 } // namespace autofill | 2343 } // namespace autofill |
OLD | NEW |