Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2883563002: Refactor UKM interface for mojo-ification (Closed)
Patch Set: Fix uma_session_stats.cc Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 auto form_structure = base::MakeUnique<FormStructure>(form); 2054 auto form_structure = base::MakeUnique<FormStructure>(form);
2054 form_structure->ParseFieldTypesFromAutocompleteAttributes(); 2055 form_structure->ParseFieldTypesFromAutocompleteAttributes();
2055 if (!form_structure->ShouldBeParsed()) 2056 if (!form_structure->ShouldBeParsed())
2056 return false; 2057 return false;
2057 2058
2058 // Ownership is transferred to |form_structures_| which maintains it until 2059 // Ownership is transferred to |form_structures_| which maintains it until
2059 // the manager is Reset() or destroyed. It is safe to use references below 2060 // the manager is Reset() or destroyed. It is safe to use references below
2060 // as long as receivers don't take ownership. 2061 // as long as receivers don't take ownership.
2061 form_structures_.push_back(std::move(form_structure)); 2062 form_structures_.push_back(std::move(form_structure));
2062 *parsed_form_structure = form_structures_.back().get(); 2063 *parsed_form_structure = form_structures_.back().get();
2063 (*parsed_form_structure)->DetermineHeuristicTypes(client_->GetUkmService()); 2064 (*parsed_form_structure)->DetermineHeuristicTypes(client_->GetUkmRecorder());
2064 return true; 2065 return true;
2065 } 2066 }
2066 2067
2067 int AutofillManager::BackendIDToInt(const std::string& backend_id) const { 2068 int AutofillManager::BackendIDToInt(const std::string& backend_id) const {
2068 if (!base::IsValidGUID(backend_id)) 2069 if (!base::IsValidGUID(backend_id))
2069 return 0; 2070 return 0;
2070 2071
2071 const auto found = backend_to_int_map_.find(backend_id); 2072 const auto found = backend_to_int_map_.find(backend_id);
2072 if (found == backend_to_int_map_.end()) { 2073 if (found == backend_to_int_map_.end()) {
2073 // Unknown one, make a new entry. 2074 // Unknown one, make a new entry.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 fputs("Next oldest form:\n", file); 2329 fputs("Next oldest form:\n", file);
2329 } 2330 }
2330 fputs("\n", file); 2331 fputs("\n", file);
2331 2332
2332 fclose(file); 2333 fclose(file);
2333 } 2334 }
2334 #endif // ENABLE_FORM_DEBUG_DUMP 2335 #endif // ENABLE_FORM_DEBUG_DUMP
2335 2336
2336 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) { 2337 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) {
2337 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics); 2338 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics);
2338 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmService(), 2339 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmRecorder(),
2339 pending_upload_request_url_, 2340 pending_upload_request_url_,
2340 upload_decision_metrics); 2341 upload_decision_metrics);
2341 } 2342 }
2342 2343
2343 } // namespace autofill 2344 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698